[MLton-commit] r5657

Matthew Fluet fluet at mlton.org
Tue Jun 19 14:50:09 PDT 2007


Merge x86_64 branch revisions into trunk
----------------------------------------------------------------------

U   mlton/trunk/Makefile
U   mlton/trunk/basis-library/arrays-and-vectors/sequence.fun
U   mlton/trunk/basis-library/build/sources.mlb
A   mlton/trunk/basis-library/c-types.mlb
A   mlton/trunk/basis-library/config/bind/pointer-mlton.sml
A   mlton/trunk/basis-library/config/choose-char.sml
A   mlton/trunk/basis-library/config/choose-int.sml
A   mlton/trunk/basis-library/config/choose-real.sml
A   mlton/trunk/basis-library/config/choose-string.sml
A   mlton/trunk/basis-library/config/choose-word.sml
D   mlton/trunk/basis-library/config/choose.sml
U   mlton/trunk/basis-library/integer/int-inf.sml
U   mlton/trunk/basis-library/integer/int-inf0.sml
U   mlton/trunk/basis-library/integer/num0.sml
U   mlton/trunk/basis-library/integer/pack-word.sml
U   mlton/trunk/basis-library/integer/word.sig
U   mlton/trunk/basis-library/integer/word.sml
U   mlton/trunk/basis-library/libs/all.mlb
U   mlton/trunk/basis-library/mlton/ffi.sig
U   mlton/trunk/basis-library/mlton/ffi.sml
U   mlton/trunk/basis-library/mlton/mlton.sig
U   mlton/trunk/basis-library/mlton/mlton.sml
U   mlton/trunk/basis-library/mlton/pointer.sml
U   mlton/trunk/basis-library/mlton/thread.sml
U   mlton/trunk/basis-library/mlton/word.sig
U   mlton/trunk/basis-library/posix/error.sml
U   mlton/trunk/basis-library/primitive/basis-ffi.sml
D   mlton/trunk/basis-library/primitive/check-pack-real.sml
D   mlton/trunk/basis-library/primitive/check-pack-word.sml
U   mlton/trunk/basis-library/primitive/check-real.sml
U   mlton/trunk/basis-library/primitive/prim-basis.sml
U   mlton/trunk/basis-library/primitive/prim-char.sml
U   mlton/trunk/basis-library/primitive/prim-int.sml
U   mlton/trunk/basis-library/primitive/prim-iwconv.sml
U   mlton/trunk/basis-library/primitive/prim-mlton.sml
U   mlton/trunk/basis-library/primitive/prim-pack-real.sml
U   mlton/trunk/basis-library/primitive/prim-pack-word.sml
U   mlton/trunk/basis-library/primitive/prim-real.sml
U   mlton/trunk/basis-library/primitive/prim-word.sml
U   mlton/trunk/basis-library/primitive/primitive.mlb
U   mlton/trunk/basis-library/real/pack-real.sml
U   mlton/trunk/basis-library/real/real.sml
A   mlton/trunk/basis-library/top-level/infixes-overflow.sml
U   mlton/trunk/basis-library/util/CUtil.sml
U   mlton/trunk/benchmark/Makefile
U   mlton/trunk/bin/add-cross
U   mlton/trunk/bin/mlton-script
U   mlton/trunk/bin/regression
U   mlton/trunk/doc/changelog
U   mlton/trunk/doc/x86_64-port-notes/TODO
A   mlton/trunk/doc/x86_64-port-notes/bench-20060527.txt
A   mlton/trunk/doc/x86_64-port-notes/bench-20070317.txt
D   mlton/trunk/doc/x86_64-port-notes/bench.txt
A   mlton/trunk/include/amd64-main.h
U   mlton/trunk/include/bytecode-main.h
U   mlton/trunk/include/bytecode.h
U   mlton/trunk/include/c-chunk.h
U   mlton/trunk/include/c-main.h
U   mlton/trunk/include/main.h
U   mlton/trunk/include/x86-main.h
U   mlton/trunk/lib/mlnlffi/memory/linkage-libdl.sml
D   mlton/trunk/lib/mlnlffi/memory/memaccess-a4c1s2i4l4ll8f4d8.sml
U   mlton/trunk/lib/mlnlffi/memory/memaccess.sig
A   mlton/trunk/lib/mlnlffi/memory/memaccess.sml
D   mlton/trunk/lib/mlnlffi/memory/memalloc-a4-unix.sml
A   mlton/trunk/lib/mlnlffi/memory/memalloc-unix.sml
D   mlton/trunk/lib/mlnlffi/memory/memory.32bit-unix.mlb
U   mlton/trunk/lib/mlnlffi/memory/memory.mlb
A   mlton/trunk/lib/mlnlffi/memory/memory.unix.mlb
D   mlton/trunk/lib/mlnlffi/memory/mlrep-i8i16i32i32i64f32f64.sml
A   mlton/trunk/lib/mlnlffi/memory/mlrep.sml
D   mlton/trunk/lib/mlnlffi/memory/platform/memory.amd64-freebsd.mlb
D   mlton/trunk/lib/mlnlffi/memory/platform/memory.amd64-linux.mlb
D   mlton/trunk/lib/mlnlffi/memory/platform/memory.amd64-netbsd.mlb
D   mlton/trunk/lib/mlnlffi/memory/platform/memory.amd64-openbsd.mlb
A   mlton/trunk/lib/mlnlffi/memory/platform/memory.cygwin.mlb
A   mlton/trunk/lib/mlnlffi/memory/platform/memory.darwin.mlb
A   mlton/trunk/lib/mlnlffi/memory/platform/memory.freebsd.mlb
D   mlton/trunk/lib/mlnlffi/memory/platform/memory.hppa-linux.mlb
A   mlton/trunk/lib/mlnlffi/memory/platform/memory.linux.mlb
A   mlton/trunk/lib/mlnlffi/memory/platform/memory.mingw.mlb
A   mlton/trunk/lib/mlnlffi/memory/platform/memory.netbsd.mlb
A   mlton/trunk/lib/mlnlffi/memory/platform/memory.openbsd.mlb
D   mlton/trunk/lib/mlnlffi/memory/platform/memory.powerpc-darwin.mlb
D   mlton/trunk/lib/mlnlffi/memory/platform/memory.powerpc-linux.mlb
A   mlton/trunk/lib/mlnlffi/memory/platform/memory.solaris.mlb
D   mlton/trunk/lib/mlnlffi/memory/platform/memory.sparc-linux.mlb
D   mlton/trunk/lib/mlnlffi/memory/platform/memory.sparc-solaris.mlb
D   mlton/trunk/lib/mlnlffi/memory/platform/memory.x86-cygwin.mlb
D   mlton/trunk/lib/mlnlffi/memory/platform/memory.x86-darwin.mlb
D   mlton/trunk/lib/mlnlffi/memory/platform/memory.x86-freebsd.mlb
D   mlton/trunk/lib/mlnlffi/memory/platform/memory.x86-linux.mlb
D   mlton/trunk/lib/mlnlffi/memory/platform/memory.x86-mingw.mlb
D   mlton/trunk/lib/mlnlffi/memory/platform/memory.x86-netbsd.mlb
D   mlton/trunk/lib/mlnlffi/memory/platform/memory.x86-openbsd.mlb
U   mlton/trunk/mlnlffigen/control.sml
A   mlton/trunk/mlnlffigen/sizes-amd64.sml
U   mlton/trunk/mlnlffigen/sources.mlb
U   mlton/trunk/mlton/Makefile
U   mlton/trunk/mlton/ast/prim-tycons.fun
U   mlton/trunk/mlton/ast/prim-tycons.sig
U   mlton/trunk/mlton/ast/word-size.fun
U   mlton/trunk/mlton/ast/word-size.sig
U   mlton/trunk/mlton/atoms/c-type.fun
U   mlton/trunk/mlton/atoms/c-type.sig
U   mlton/trunk/mlton/atoms/const.fun
U   mlton/trunk/mlton/atoms/const.sig
U   mlton/trunk/mlton/atoms/hash-type.fun
U   mlton/trunk/mlton/atoms/prim.fun
U   mlton/trunk/mlton/atoms/prim.sig
U   mlton/trunk/mlton/atoms/type-ops.fun
U   mlton/trunk/mlton/atoms/type-ops.sig
U   mlton/trunk/mlton/atoms/word-x-vector.fun
U   mlton/trunk/mlton/atoms/word-x.fun
U   mlton/trunk/mlton/atoms/word-x.sig
U   mlton/trunk/mlton/backend/allocate-registers.fun
U   mlton/trunk/mlton/backend/backend.fun
U   mlton/trunk/mlton/backend/limit-check.fun
U   mlton/trunk/mlton/backend/machine.fun
U   mlton/trunk/mlton/backend/machine.sig
U   mlton/trunk/mlton/backend/object-type.sig
A   mlton/trunk/mlton/backend/objptr-tycon.fun
A   mlton/trunk/mlton/backend/objptr-tycon.sig
U   mlton/trunk/mlton/backend/packed-representation.fun
D   mlton/trunk/mlton/backend/pointer-tycon.fun
D   mlton/trunk/mlton/backend/pointer-tycon.sig
U   mlton/trunk/mlton/backend/profile.fun
U   mlton/trunk/mlton/backend/rep-type.fun
U   mlton/trunk/mlton/backend/rep-type.sig
U   mlton/trunk/mlton/backend/representation.sig
U   mlton/trunk/mlton/backend/rssa.fun
U   mlton/trunk/mlton/backend/rssa.sig
U   mlton/trunk/mlton/backend/runtime.fun
U   mlton/trunk/mlton/backend/runtime.sig
U   mlton/trunk/mlton/backend/scale.fun
U   mlton/trunk/mlton/backend/scale.sig
U   mlton/trunk/mlton/backend/signal-check.fun
D   mlton/trunk/mlton/backend/small-int-inf.fun
D   mlton/trunk/mlton/backend/small-int-inf.sig
U   mlton/trunk/mlton/backend/sources.cm
U   mlton/trunk/mlton/backend/sources.mlb
U   mlton/trunk/mlton/backend/ssa-to-rssa.fun
U   mlton/trunk/mlton/backend/switch.fun
A   mlton/trunk/mlton/codegen/amd64-codegen/
U   mlton/trunk/mlton/codegen/bytecode/bytecode.fun
U   mlton/trunk/mlton/codegen/c-codegen/c-codegen.fun
U   mlton/trunk/mlton/codegen/sources.cm
U   mlton/trunk/mlton/codegen/sources.mlb
U   mlton/trunk/mlton/codegen/x86-codegen/sources.cm
U   mlton/trunk/mlton/codegen/x86-codegen/sources.mlb
U   mlton/trunk/mlton/codegen/x86-codegen/x86-allocate-registers.fun
U   mlton/trunk/mlton/codegen/x86-codegen/x86-codegen.fun
U   mlton/trunk/mlton/codegen/x86-codegen/x86-generate-transfers.fun
U   mlton/trunk/mlton/codegen/x86-codegen/x86-mlton-basic.fun
U   mlton/trunk/mlton/codegen/x86-codegen/x86-mlton-basic.sig
U   mlton/trunk/mlton/codegen/x86-codegen/x86-mlton.fun
U   mlton/trunk/mlton/codegen/x86-codegen/x86-pseudo.sig
U   mlton/trunk/mlton/codegen/x86-codegen/x86-simplify.fun
U   mlton/trunk/mlton/codegen/x86-codegen/x86-simplify.sig
U   mlton/trunk/mlton/codegen/x86-codegen/x86-translate.fun
U   mlton/trunk/mlton/codegen/x86-codegen/x86.fun
U   mlton/trunk/mlton/codegen/x86-codegen/x86.sig
U   mlton/trunk/mlton/control/bits.sml
U   mlton/trunk/mlton/control/control-flags.sig
U   mlton/trunk/mlton/control/control-flags.sml
U   mlton/trunk/mlton/control/sources.cm
U   mlton/trunk/mlton/control/sources.mlb
U   mlton/trunk/mlton/defunctorize/defunctorize.fun
U   mlton/trunk/mlton/elaborate/elaborate-core.fun
U   mlton/trunk/mlton/elaborate/type-env.fun
U   mlton/trunk/mlton/elaborate/type-env.sig
U   mlton/trunk/mlton/main/compile.fun
U   mlton/trunk/mlton/main/lookup-constant.fun
U   mlton/trunk/mlton/main/main.fun
U   mlton/trunk/mlton/match-compile/match-compile.fun
U   mlton/trunk/mlton/ssa/analyze2.fun
U   mlton/trunk/mlton/ssa/analyze2.sig
U   mlton/trunk/mlton/ssa/constant-propagation.fun
U   mlton/trunk/mlton/ssa/deep-flatten.fun
U   mlton/trunk/mlton/ssa/poly-equal.fun
U   mlton/trunk/mlton/ssa/ref-flatten.fun
U   mlton/trunk/mlton/ssa/ssa-to-ssa2.fun
U   mlton/trunk/mlton/ssa/ssa-tree.fun
U   mlton/trunk/mlton/ssa/ssa-tree.sig
U   mlton/trunk/mlton/ssa/ssa-tree2.fun
U   mlton/trunk/mlton/ssa/ssa-tree2.sig
U   mlton/trunk/mlton/ssa/type-check2.fun
U   mlton/trunk/mlton/ssa/useless.fun
A   mlton/trunk/regression/mlton.share.amd64-linux.ok
A   mlton/trunk/regression/real.amd64-linux.ok
A   mlton/trunk/regression/size2.amd64-linux.ok
U   mlton/trunk/runtime/Makefile
U   mlton/trunk/runtime/basis/Net/Socket/Socket.c
U   mlton/trunk/runtime/basis/Posix/Process/termSig.c
U   mlton/trunk/runtime/basis/Posix/Signal.c
D   mlton/trunk/runtime/basis/Real/PackReal.c
U   mlton/trunk/runtime/basis/Real/class.c
U   mlton/trunk/runtime/basis/Real/gdtoa.c
D   mlton/trunk/runtime/basis/Real/nextAfter.c
U   mlton/trunk/runtime/basis/Real/signBit.c
U   mlton/trunk/runtime/basis/System/Date.c
U   mlton/trunk/runtime/basis/System/Time.c
D   mlton/trunk/runtime/basis/Word/PackWord.c
U   mlton/trunk/runtime/basis/Word/Word-ops.h
U   mlton/trunk/runtime/basis/coerce.h
A   mlton/trunk/runtime/basis/cpointer.c
A   mlton/trunk/runtime/basis/cpointer.h
U   mlton/trunk/runtime/basis-ffi.h
U   mlton/trunk/runtime/bytecode/interpret.c
U   mlton/trunk/runtime/bytecode/interpret.h
U   mlton/trunk/runtime/bytecode/opcode.h
U   mlton/trunk/runtime/cenv.h
U   mlton/trunk/runtime/gc/array-allocate.c
U   mlton/trunk/runtime/gc/array.h
U   mlton/trunk/runtime/gc/cheney-copy.c
U   mlton/trunk/runtime/gc/copy-thread.c
U   mlton/trunk/runtime/gc/current.c
U   mlton/trunk/runtime/gc/debug.h
U   mlton/trunk/runtime/gc/dfs-mark.c
U   mlton/trunk/runtime/gc/foreach.c
U   mlton/trunk/runtime/gc/forward.c
U   mlton/trunk/runtime/gc/garbage-collection.c
U   mlton/trunk/runtime/gc/gc_state.c
U   mlton/trunk/runtime/gc/gc_state.h
U   mlton/trunk/runtime/gc/generational.c
U   mlton/trunk/runtime/gc/heap.c
U   mlton/trunk/runtime/gc/init-world.c
U   mlton/trunk/runtime/gc/init.c
U   mlton/trunk/runtime/gc/int-inf.h
U   mlton/trunk/runtime/gc/invariant.c
U   mlton/trunk/runtime/gc/mark-compact.c
U   mlton/trunk/runtime/gc/model.h
U   mlton/trunk/runtime/gc/new-object.c
U   mlton/trunk/runtime/gc/object-size.c
U   mlton/trunk/runtime/gc/object-size.h
U   mlton/trunk/runtime/gc/object.h
U   mlton/trunk/runtime/gc/objptr.c
U   mlton/trunk/runtime/gc/objptr.h
U   mlton/trunk/runtime/gc/rusage.h
U   mlton/trunk/runtime/gc/stack.c
U   mlton/trunk/runtime/gc/stack.h
U   mlton/trunk/runtime/gc/string.h
U   mlton/trunk/runtime/gc/switch-thread.c
U   mlton/trunk/runtime/gc/switch-thread.h
U   mlton/trunk/runtime/gc/thread.c
U   mlton/trunk/runtime/gc/thread.h
U   mlton/trunk/runtime/gc/weak.c
U   mlton/trunk/runtime/gc/weak.h
U   mlton/trunk/runtime/gc.c
U   mlton/trunk/runtime/gc.h
U   mlton/trunk/runtime/gen/basis-ffi.def
U   mlton/trunk/runtime/gen/basis-ffi.h
U   mlton/trunk/runtime/gen/basis-ffi.sml
U   mlton/trunk/runtime/gen/gen-types.c
U   mlton/trunk/runtime/platform/aix.h
U   mlton/trunk/runtime/platform/cygwin.h
U   mlton/trunk/runtime/platform/darwin.h
U   mlton/trunk/runtime/platform/freebsd.h
U   mlton/trunk/runtime/platform/hpux.h
U   mlton/trunk/runtime/platform/linux.h
U   mlton/trunk/runtime/platform/mingw.h
U   mlton/trunk/runtime/platform/netbsd.h
U   mlton/trunk/runtime/platform/openbsd.h
U   mlton/trunk/runtime/platform/recv.nonblock.c
U   mlton/trunk/runtime/platform/solaris.h
U   mlton/trunk/runtime/platform.h
D   mlton/trunk/runtime/util/assert.c
D   mlton/trunk/runtime/util/assert.h
U   mlton/trunk/runtime/util/pointer.h
U   mlton/trunk/runtime/util.c
U   mlton/trunk/runtime/util.h

----------------------------------------------------------------------

Modified: mlton/trunk/Makefile
===================================================================
--- mlton/trunk/Makefile	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/Makefile	2007-06-19 21:49:40 UTC (rev 5657)
@@ -289,14 +289,14 @@
 		basis-library/config/c/$(TARGET_ARCH)-$(TARGET_OS)/c-types.sml	
 	$(CP) runtime/gen/basis-ffi.sml \
 		basis-library/primitive/basis-ffi.sml
-	$(CP) runtime/bytecode/opcodes "$(LIB)/"
+        # $(CP) runtime/bytecode/opcodes "$(LIB)/"
 	$(CP) runtime/*.h "$(INC)/"
 	mv "$(INC)/c-types.h" "$(LIB)/$(TARGET)/include"
 	for d in basis basis/Real basis/Word gc platform util; do	\
 		mkdir -p "$(INC)/$$d";					\
 		$(CP) runtime/$$d/*.h "$(INC)/$$d";			\
 	done
-	$(CP) runtime/bytecode/interpret.h "$(INC)"
+        # $(CP) runtime/bytecode/interpret.h "$(INC)"
 	for x in "$(LIB)"/"$(TARGET)"/*.a; do $(RANLIB) "$$x"; done
 
 .PHONY: script
@@ -409,10 +409,19 @@
 install-no-docs:
 	mkdir -p "$(TLIB)" "$(TBIN)" "$(TMAN)"
 	$(CP) "$(LIB)/." "$(TLIB)/"
-	rm -f "$(TLIB)/self/libmlton-gdb.a"
 	sed "/^lib=/s;.*;lib='$(prefix)/$(ULIB)';" 			\
-		<"$(SRC)/bin/mlton-script" >"$(TBIN)/mlton"
+		<"$(BIN)/mlton" >"$(TBIN)/mlton"
 	chmod a+x "$(TBIN)/mlton"
+	if [ -x "$(BIN)/mlton.trace" ]; then                            \
+		sed "/^lib=/s;.*;lib='$(prefix)/$(ULIB)';" 		\
+			<"$(BIN)/mlton.trace" >"$(TBIN)/mlton.trace";   \
+		chmod a+x "$(TBIN)/mlton.trace";                        \
+	fi
+	if [ -x "$(BIN)/mlton.debug" ]; then                            \
+		sed "/^lib=/s;.*;lib='$(prefix)/$(ULIB)';" 		\
+			<"$(BIN)/mlton.debug" >"$(TBIN)/mlton.debug";   \
+		chmod a+x "$(TBIN)/mlton.debug";                        \
+	fi
 	cd "$(BIN)" && $(CP) "$(LEX)$(EXE)" "$(NLFFIGEN)$(EXE)"		\
 		 "$(PROF)$(EXE)" "$(YACC)$(EXE)" "$(TBIN)/"
 	( cd "$(SRC)/man" && tar cf - $(MAN_PAGES)) | \

Modified: mlton/trunk/basis-library/arrays-and-vectors/sequence.fun
===================================================================
--- mlton/trunk/basis-library/arrays-and-vectors/sequence.fun	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/arrays-and-vectors/sequence.fun	2007-06-19 21:49:40 UTC (rev 5657)
@@ -99,19 +99,24 @@
        *)
 
       local
-         fun doit (toInt, fromInt, maxInt') =
-            (SeqIndex.maxLen', toInt SeqIndex.maxLen') 
-            handle Overflow => (fromInt maxInt', maxInt')
+         fun doit (precision, toInt, fromInt, maxInt') =
+            if Primitive.Int32.>= (valOf SeqIndex.precision, precision)
+               then (fromInt maxInt', maxInt')
+            else (SeqIndex.maxLen', toInt SeqIndex.maxLen')
          structure S =
             Int_ChooseInt
             (type 'a t = SeqIndex.int * 'a
-             val fInt8 = doit (SeqIndex.schckToInt8, SeqIndex.schckFromInt8,
+             val fInt8 = doit (valOf Primitive.Int8.precision,
+                               SeqIndex.schckToInt8, SeqIndex.schckFromInt8,
                                Primitive.Int8.maxInt')
-             val fInt16 = doit (SeqIndex.schckToInt16, SeqIndex.schckFromInt16,
+             val fInt16 = doit (valOf Primitive.Int16.precision,
+                               SeqIndex.schckToInt16, SeqIndex.schckFromInt16,
                                 Primitive.Int16.maxInt')
-             val fInt32 = doit (SeqIndex.schckToInt32, SeqIndex.schckFromInt32,
+             val fInt32 = doit (valOf Primitive.Int32.precision,
+                                SeqIndex.schckToInt32, SeqIndex.schckFromInt32,
                                 Primitive.Int32.maxInt')
-             val fInt64 = doit (SeqIndex.schckToInt64, SeqIndex.schckFromInt64,
+             val fInt64 = doit (valOf Primitive.Int64.precision,
+                                SeqIndex.schckToInt64, SeqIndex.schckFromInt64,
                                 Primitive.Int64.maxInt')
              val fIntInf = (SeqIndex.maxLen', SeqIndex.schckToIntInf SeqIndex.maxLen'))
       in

Modified: mlton/trunk/basis-library/build/sources.mlb
===================================================================
--- mlton/trunk/basis-library/build/sources.mlb	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/build/sources.mlb	2007-06-19 21:49:40 UTC (rev 5657)
@@ -13,6 +13,7 @@
 in
    ../primitive/primitive.mlb
    ../top-level/infixes.sml
+   ../top-level/infixes-overflow.sml
    ../top-level/infixes-unsafe.sml
    ../util/dynamic-wind.sig
    ../util/dynamic-wind.sml

Copied: mlton/trunk/basis-library/c-types.mlb (from rev 5656, mlton/branches/on-20050822-x86_64-branch/basis-library/c-types.mlb)

Copied: mlton/trunk/basis-library/config/bind/pointer-mlton.sml (from rev 5656, mlton/branches/on-20050822-x86_64-branch/basis-library/config/bind/pointer-mlton.sml)

Copied: mlton/trunk/basis-library/config/choose-char.sml (from rev 5656, mlton/branches/on-20050822-x86_64-branch/basis-library/config/choose-char.sml)

Copied: mlton/trunk/basis-library/config/choose-int.sml (from rev 5656, mlton/branches/on-20050822-x86_64-branch/basis-library/config/choose-int.sml)

Copied: mlton/trunk/basis-library/config/choose-real.sml (from rev 5656, mlton/branches/on-20050822-x86_64-branch/basis-library/config/choose-real.sml)

Copied: mlton/trunk/basis-library/config/choose-string.sml (from rev 5656, mlton/branches/on-20050822-x86_64-branch/basis-library/config/choose-string.sml)

Copied: mlton/trunk/basis-library/config/choose-word.sml (from rev 5656, mlton/branches/on-20050822-x86_64-branch/basis-library/config/choose-word.sml)

Deleted: mlton/trunk/basis-library/config/choose.sml
===================================================================
--- mlton/trunk/basis-library/config/choose.sml	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/config/choose.sml	2007-06-19 21:49:40 UTC (rev 5657)
@@ -1,126 +0,0 @@
-(* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
- *    Jagannathan, and Stephen Weeks.
- *
- * MLton is released under a BSD-style license.
- * See the file MLton-LICENSE for details.
- *)
-
-signature CHOOSE_CHARN_ARG =
-   sig
-      type 'a t
-      val fChar8: Char8.char t
-      val fChar16: Char16.char t
-      val fChar32: Char32.char t
-   end
-
-functor ChooseCharN_Char8 (A : CHOOSE_CHARN_ARG) : 
-   sig val f : Char8.char A.t end = 
-   struct val f = A.fChar8 end
-functor ChooseCharN_Char16 (A : CHOOSE_CHARN_ARG) : 
-   sig val f : Char16.char A.t end = 
-   struct val f = A.fChar16 end
-functor ChooseCharN_Char32 (A : CHOOSE_CHARN_ARG) : 
-   sig val f : Char32.char A.t end = 
-   struct val f = A.fChar32 end
-
-signature CHOOSE_INTN_ARG =
-   sig
-      type 'a t
-      val fInt8: Int8.int t
-      val fInt16: Int16.int t
-      val fInt32: Int32.int t
-      val fInt64: Int64.int t
-   end
-
-functor ChooseIntN_Int8 (A : CHOOSE_INTN_ARG) : 
-   sig val f : Int8.int A.t end = 
-   struct val f = A.fInt8 end
-functor ChooseIntN_Int16 (A : CHOOSE_INTN_ARG) : 
-   sig val f : Int16.int A.t end = 
-   struct val f = A.fInt16 end
-functor ChooseIntN_Int32 (A : CHOOSE_INTN_ARG) : 
-   sig val f : Int32.int A.t end = 
-   struct val f = A.fInt32 end
-functor ChooseIntN_Int64 (A : CHOOSE_INTN_ARG) : 
-   sig val f : Int64.int A.t end = 
-   struct val f = A.fInt64 end
-
-signature CHOOSE_INT_ARG =
-   sig
-      type 'a t
-      val fInt8: Int8.int t
-      val fInt16: Int16.int t
-      val fInt32: Int32.int t
-      val fInt64: Int64.int t
-      val fIntInf: IntInf.int t
-   end
-
-functor ChooseInt_Int8 (A : CHOOSE_INT_ARG) : 
-   sig val f : Int8.int A.t end = 
-   struct val f = A.fInt8 end
-functor ChooseInt_Int16 (A : CHOOSE_INT_ARG) : 
-   sig val f : Int16.int A.t end = 
-   struct val f = A.fInt16 end
-functor ChooseInt_Int32 (A : CHOOSE_INT_ARG) : 
-   sig val f : Int32.int A.t end = 
-   struct val f = A.fInt32 end
-functor ChooseInt_Int64 (A : CHOOSE_INT_ARG) : 
-   sig val f : Int64.int A.t end = 
-   struct val f = A.fInt64 end
-functor ChooseInt_IntInf (A : CHOOSE_INT_ARG) : 
-   sig val f : IntInf.int A.t end = 
-   struct val f = A.fIntInf end
-
-signature CHOOSE_REALN_ARG =
-   sig
-      type 'a t
-      val fReal32: Real32.real t
-      val fReal64: Real64.real t
-   end
-
-functor ChooseRealN_Real32 (A : CHOOSE_REALN_ARG) : 
-   sig val f : Real32.real A.t end = 
-   struct val f = A.fReal32 end
-functor ChooseRealN_Real64 (A : CHOOSE_REALN_ARG) : 
-   sig val f : Real64.real A.t end = 
-   struct val f = A.fReal64 end
-
-signature CHOOSE_STRINGN_ARG =
-   sig
-      type 'a t
-      val fString8: String8.string t
-      val fString16: String16.string t
-      val fString32: String32.string t
-   end
-
-functor ChooseStringN_String8 (A : CHOOSE_STRINGN_ARG) : 
-   sig val f : String8.string A.t end = 
-   struct val f = A.fString8 end
-functor ChooseStringN_String16 (A : CHOOSE_STRINGN_ARG) : 
-   sig val f : String16.string A.t end = 
-   struct val f = A.fString16 end
-functor ChooseStringN_String32 (A : CHOOSE_STRINGN_ARG) : 
-   sig val f : String32.string A.t end = 
-   struct val f = A.fString32 end
-
-signature CHOOSE_WORDN_ARG =
-   sig
-      type 'a t
-      val fWord8: Word8.word t
-      val fWord16: Word16.word t
-      val fWord32: Word32.word t
-      val fWord64: Word64.word t
-   end
-
-functor ChooseWordN_Word8 (A : CHOOSE_WORDN_ARG) : 
-   sig val f : Word8.word A.t end = 
-   struct val f = A.fWord8 end
-functor ChooseWordN_Word16 (A : CHOOSE_WORDN_ARG) : 
-   sig val f : Word16.word A.t end = 
-   struct val f = A.fWord16 end
-functor ChooseWordN_Word32 (A : CHOOSE_WORDN_ARG) : 
-   sig val f : Word32.word A.t end = 
-   struct val f = A.fWord32 end
-functor ChooseWordN_Word64 (A : CHOOSE_WORDN_ARG) : 
-   sig val f : Word64.word A.t end = 
-   struct val f = A.fWord64 end

Modified: mlton/trunk/basis-library/integer/int-inf.sml
===================================================================
--- mlton/trunk/basis-library/integer/int-inf.sml	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/integer/int-inf.sml	2007-06-19 21:49:40 UTC (rev 5657)
@@ -164,8 +164,18 @@
                                     shift = W.* (base, shift),
                                     chunk = W.+ (W.* (base, chunk), dig),
                                     s = s'}
-               val digitsPerChunk = 
-                  Int32.quot (Int32.- (Int32.fromInt W.wordSize, 3), W.log2 base)
+               (* digitsPerChunk = floor((W.wordSize - 3) / (log2 base)) *)
+               val digitsPerChunk =
+                  case (W.wordSize, base) of
+                     (64, 0w16) => 15
+                   | (64, 0w10) => 18
+                   | (64, 0w8) => 20
+                   | (64, 0w2) => 61
+                   | (32, 0w16) => 7
+                   | (32, 0w10) => 8
+                   | (32, 0w8) => 9
+                   | (32, 0w2) => 29
+                   | _ => raise (Fail "IntInf.scan:digitsPerChunk")
                fun reader (s: 'a): (chunk * 'a) option =
                   case dread s of
                      NONE => NONE

Modified: mlton/trunk/basis-library/integer/int-inf0.sml
===================================================================
--- mlton/trunk/basis-library/integer/int-inf0.sml	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/integer/int-inf0.sml	2007-06-19 21:49:40 UTC (rev 5657)
@@ -41,19 +41,23 @@
          end
 
       val abs: int -> int
+      val +! : int * int -> int
       val +? : int * int -> int
       val + : int * int -> int
       val divMod: int * int -> int * int
       val div: int * int -> int
       val gcd: int * int -> int
       val mod: int * int -> int
+      val *! : int * int -> int
       val *? : int * int -> int
       val * : int * int -> int
+      val ~! : int -> int
       val ~? : int -> int
       val ~ : int -> int
       val quotRem: int * int -> int * int
       val quot: int * int -> int
       val rem: int * int -> int
+      val -! : int * int -> int
       val -? : int * int -> int
       val - : int * int -> int
 
@@ -665,6 +669,9 @@
          val castToWord8 = sextdToWord8
          val castToInt8 = sextdToInt8
          fun schckToWord8 i =
+            if not Primitive.Controls.detectOverflow
+               then sextdToWord8 i
+            else
             case chckToWord8Aux i of
                Small w => ObjptrWord.schckToWord8 w
              | Big (isneg, extra, ans) => 
@@ -688,6 +695,9 @@
                        end
          fun schckToInt8 i = IntWordConv.idFromWord8ToInt8 (schckToWord8 i)
          fun zchckToWord8 i =
+            if not Primitive.Controls.detectOverflow
+               then zextdToWord8 i
+            else
             case chckToWord8Aux i of
                Small w => ObjptrWord.schckToWord8 w
              | Big (isneg, extra, ans) => 
@@ -713,6 +723,9 @@
          val castToWord16 = sextdToWord16
          val castToInt16 = sextdToInt16
          fun schckToWord16 i =
+            if not Primitive.Controls.detectOverflow
+               then sextdToWord16 i
+            else
             case chckToWord16Aux i of
                Small w => ObjptrWord.schckToWord16 w
              | Big (isneg, extra, ans) => 
@@ -736,6 +749,9 @@
                        end
          fun schckToInt16 i = IntWordConv.idFromWord16ToInt16 (schckToWord16 i)
          fun zchckToWord16 i =
+            if not Primitive.Controls.detectOverflow
+               then zextdToWord16 i
+            else
             case chckToWord16Aux i of
                Small w => ObjptrWord.schckToWord16 w
              | Big (isneg, extra, ans) => 
@@ -761,6 +777,9 @@
          val castToWord32 = sextdToWord32
          val castToInt32 = sextdToInt32
          fun schckToWord32 i =
+            if not Primitive.Controls.detectOverflow
+               then sextdToWord32 i
+            else
             case chckToWord32Aux i of
                Small w => ObjptrWord.schckToWord32 w
              | Big (isneg, extra, ans) => 
@@ -784,6 +803,9 @@
                        end
          fun schckToInt32 i = IntWordConv.idFromWord32ToInt32 (schckToWord32 i)
          fun zchckToWord32 i =
+            if not Primitive.Controls.detectOverflow
+               then zextdToWord32 i
+            else
             case chckToWord32Aux i of
                Small w => ObjptrWord.schckToWord32 w
              | Big (isneg, extra, ans) => 
@@ -809,6 +831,9 @@
          val castToWord64 = sextdToWord64
          val castToInt64 = sextdToInt64
          fun schckToWord64 i =
+            if not Primitive.Controls.detectOverflow
+               then sextdToWord64 i
+            else
             case chckToWord64Aux i of
                Small w => ObjptrWord.schckToWord64 w
              | Big (isneg, extra, ans) => 
@@ -832,6 +857,9 @@
                        end
          fun schckToInt64 i = IntWordConv.idFromWord64ToInt64 (schckToWord64 i)
          fun zchckToWord64 i =
+            if not Primitive.Controls.detectOverflow
+               then zextdToWord64 i
+            else
             case chckToWord64Aux i of
                Small w => ObjptrWord.schckToWord64 w
              | Big (isneg, extra, ans) => 
@@ -920,9 +948,9 @@
                 | SOME i => i
             end
       in
-         val bigAdd = make (I.+, Prim.+, S.max, 1)
-         val bigSub = make (I.-, Prim.-, S.max, 1)
-         val bigMul = make (I.*, Prim.*, S.+, 0)
+         val bigAdd = make (I.+!, Prim.+, S.max, 1)
+         val bigSub = make (I.-!, Prim.-, S.max, 1)
+         val bigMul = make (I.*!, Prim.*, S.+, 0)
       end
 
       fun bigNeg (arg: bigInt): bigInt =
@@ -1248,19 +1276,23 @@
         end
 
       val abs = bigAbs
+      val op +! = bigAdd
       val op +? = bigAdd
       val op + = bigAdd
       val divMod = bigDivMod
       val op div = bigDiv
       val gcd = bigGcd
       val op mod = bigMod
+      val op *! = bigMul
       val op *? = bigMul
       val op * = bigMul
+      val op ~! = bigNeg
       val op ~? = bigNeg
       val op ~ = bigNeg
       val quotRem = bigQuotRem
       val quot = bigQuot
       val rem = bigRem
+      val op -! = bigSub
       val op -? = bigSub
       val op - = bigSub
 

Modified: mlton/trunk/basis-library/integer/num0.sml
===================================================================
--- mlton/trunk/basis-library/integer/num0.sml	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/integer/num0.sml	2007-06-19 21:49:40 UTC (rev 5657)
@@ -160,9 +160,12 @@
                if Primitive.Controls.safe 
                   andalso y = zero
                   then raise Div
-                  else if Primitive.Controls.detectOverflow 
+                  else if (Primitive.Controls.detectOverflow
+                           orelse Primitive.Controls.safe)
                           andalso x = minInt' andalso y = ~one
-                          then raise Overflow
+                          then if Primitive.Controls.detectOverflow 
+                                  then raise Overflow
+                                  else minInt'
                           else quotUnsafe (x, y)
 
             fun rem (x, y) =
@@ -183,9 +186,12 @@
                                           else quotUnsafe (x -? one, y) -? one
                                   else raise Div
                   else if y < zero
-                          then if Primitive.Controls.detectOverflow 
+                          then if (Primitive.Controls.detectOverflow
+                                   orelse Primitive.Controls.safe)
                                   andalso x = minInt' andalso y = ~one
-                                  then raise Overflow
+                                  then if Primitive.Controls.detectOverflow 
+                                          then raise Overflow
+                                          else minInt'
                                   else quotUnsafe (x, y)
                           else if y > zero
                                   then quotUnsafe (x +? one, y) -? one

Modified: mlton/trunk/basis-library/integer/pack-word.sml
===================================================================
--- mlton/trunk/basis-library/integer/pack-word.sml	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/integer/pack-word.sml	2007-06-19 21:49:40 UTC (rev 5657)
@@ -10,12 +10,10 @@
                         type word
                         val wordSize: int
                         val isBigEndian: bool
-                        val subArr: Word8.word array * C_Ptrdiff.t -> word
-                        val subArrRev: Word8.word array * C_Ptrdiff.t -> word
-                        val subVec: Word8.word vector * C_Ptrdiff.t -> word
-                        val subVecRev: Word8.word vector * C_Ptrdiff.t -> word
-                        val update: Word8.word array * C_Ptrdiff.t * word -> unit
-                        val updateRev: Word8.word array * C_Ptrdiff.t * word -> unit
+                        val subArr: Word8.word array * SeqIndex.int -> word
+                        val subVec: Word8.word vector * SeqIndex.int -> word
+                        val update: Word8.word array * SeqIndex.int * word -> unit
+                        val bswap: word -> word
                         val toLarge: word -> LargeWord.word
                         val toLargeX: word -> LargeWord.word
                         val fromLarge: LargeWord.word -> word
@@ -26,24 +24,28 @@
 
 val bytesPerElem = Int.div (wordSize, 8)
 
-val (subA, subV, updA) =
-   if isBigEndian = Primitive.MLton.Platform.Arch.hostIsBigEndian
-      then (subArr, subVec, update)
-   else (subArrRev, subVecRev, updateRev)
-
-fun offset (i, n) =
+fun offset (i, n) = 
    let
-      val i = Int.* (bytesPerElem, i)
+      val i' = Int.* (bytesPerElem, i)
       val () =
          if Primitive.Controls.safe
-            andalso (Int.geu (Int.+ (i, Int.- (bytesPerElem, 1)), n))
+            andalso (Int.geu (Int.+ (i', Int.- (bytesPerElem, 1)), n))
             then raise Subscript
             else ()
    in
-      C_Ptrdiff.fromInt i
+      SeqIndex.fromInt i
    end
    handle Overflow => raise Subscript
 
+val subArrRev = bswap o subArr
+val subVecRev = bswap o subVec
+fun updateRev (a, i, w) = update (a, i, bswap w)
+
+val (subA, subV, updA) =
+   if isBigEndian = Primitive.MLton.Platform.Arch.hostIsBigEndian
+      then (subArr, subVec, update)
+   else (subArrRev, subVecRev, updateRev)
+
 fun update (a, i, w) =
    let
       val i = offset (i, Word8Array.length a)
@@ -70,51 +72,51 @@
 
 structure PackWord8Big: PACK_WORD =
    PackWord (val isBigEndian = true
-             open PrimitiveFFI.PackWord8
+             open Primitive.PackWord8
              open Word8)
 structure PackWord8Little: PACK_WORD =
    PackWord (val isBigEndian = false
-             open PrimitiveFFI.PackWord8
+             open Primitive.PackWord8
              open Word8)
 structure PackWord8Host: PACK_WORD =
    PackWord (val isBigEndian = Primitive.MLton.Platform.Arch.hostIsBigEndian
-             open PrimitiveFFI.PackWord8
+             open Primitive.PackWord8
              open Word8)
 structure PackWord16Big: PACK_WORD =
    PackWord (val isBigEndian = true
-             open PrimitiveFFI.PackWord16
+             open Primitive.PackWord16
              open Word16)
 structure PackWord16Little: PACK_WORD =
    PackWord (val isBigEndian = false
-             open PrimitiveFFI.PackWord16
+             open Primitive.PackWord16
              open Word16)
 structure PackWord16Host: PACK_WORD =
    PackWord (val isBigEndian = Primitive.MLton.Platform.Arch.hostIsBigEndian
-             open PrimitiveFFI.PackWord16
+             open Primitive.PackWord16
              open Word16)
 structure PackWord32Big: PACK_WORD =
    PackWord (val isBigEndian = true
-             open PrimitiveFFI.PackWord32
+             open Primitive.PackWord32
              open Word32)
 structure PackWord32Little: PACK_WORD =
    PackWord (val isBigEndian = false
-             open PrimitiveFFI.PackWord32
+             open Primitive.PackWord32
              open Word32)
 structure PackWord32Host: PACK_WORD =
    PackWord (val isBigEndian = Primitive.MLton.Platform.Arch.hostIsBigEndian
-             open PrimitiveFFI.PackWord32
+             open Primitive.PackWord32
              open Word32)
 structure PackWord64Big: PACK_WORD =
    PackWord (val isBigEndian = true
-             open PrimitiveFFI.PackWord64
+             open Primitive.PackWord64
              open Word64)
 structure PackWord64Little: PACK_WORD =
    PackWord (val isBigEndian = false
-             open PrimitiveFFI.PackWord64
+             open Primitive.PackWord64
              open Word64)
 structure PackWord64Host: PACK_WORD =
    PackWord (val isBigEndian = Primitive.MLton.Platform.Arch.hostIsBigEndian
-             open PrimitiveFFI.PackWord64
+             open Primitive.PackWord64
              open Word64)
 local
    structure PackWord =
@@ -122,69 +124,36 @@
          local
             structure S =
                Word_ChooseWordN
-               (type 'a t = Word8.word array * C_Ptrdiff.t -> 'a
-                val fWord8 = PrimitiveFFI.PackWord8.subArr
-                val fWord16 = PrimitiveFFI.PackWord16.subArr
-                val fWord32 = PrimitiveFFI.PackWord32.subArr
-                val fWord64 = PrimitiveFFI.PackWord64.subArr)
+               (type 'a t = Word8.word array * SeqIndex.t -> 'a
+                val fWord8 = Primitive.PackWord8.subArr
+                val fWord16 = Primitive.PackWord16.subArr
+                val fWord32 = Primitive.PackWord32.subArr
+                val fWord64 = Primitive.PackWord64.subArr)
          in
             val subArr = S.f
          end
          local
             structure S =
                Word_ChooseWordN
-               (type 'a t = Word8.word array * C_Ptrdiff.t -> 'a
-                val fWord8 = PrimitiveFFI.PackWord8.subArrRev
-                val fWord16 = PrimitiveFFI.PackWord16.subArrRev
-                val fWord32 = PrimitiveFFI.PackWord32.subArrRev
-                val fWord64 = PrimitiveFFI.PackWord64.subArrRev)
+               (type 'a t = Word8.word vector * SeqIndex.t -> 'a
+                val fWord8 = Primitive.PackWord8.subVec
+                val fWord16 = Primitive.PackWord16.subVec
+                val fWord32 = Primitive.PackWord32.subVec
+                val fWord64 = Primitive.PackWord64.subVec)
          in
-            val subArrRev = S.f
-         end
-         local
-            structure S =
-               Word_ChooseWordN
-               (type 'a t = Word8.word vector * C_Ptrdiff.t -> 'a
-                val fWord8 = PrimitiveFFI.PackWord8.subVec
-                val fWord16 = PrimitiveFFI.PackWord16.subVec
-                val fWord32 = PrimitiveFFI.PackWord32.subVec
-                val fWord64 = PrimitiveFFI.PackWord64.subVec)
-         in
             val subVec = S.f
          end
          local
             structure S =
                Word_ChooseWordN
-               (type 'a t = Word8.word vector * C_Ptrdiff.t -> 'a
-                val fWord8 = PrimitiveFFI.PackWord8.subVecRev
-                val fWord16 = PrimitiveFFI.PackWord16.subVecRev
-                val fWord32 = PrimitiveFFI.PackWord32.subVecRev
-                val fWord64 = PrimitiveFFI.PackWord64.subVecRev)
+               (type 'a t = Word8.word array * SeqIndex.t * 'a -> unit
+                val fWord8 = Primitive.PackWord8.update
+                val fWord16 = Primitive.PackWord16.update
+                val fWord32 = Primitive.PackWord32.update
+                val fWord64 = Primitive.PackWord64.update)
          in
-            val subVecRev = S.f
-         end
-         local
-            structure S =
-               Word_ChooseWordN
-               (type 'a t = Word8.word array * C_Ptrdiff.t * 'a -> unit
-                val fWord8 = PrimitiveFFI.PackWord8.update
-                val fWord16 = PrimitiveFFI.PackWord16.update
-                val fWord32 = PrimitiveFFI.PackWord32.update
-                val fWord64 = PrimitiveFFI.PackWord64.update)
-         in
             val update = S.f
          end
-         local
-            structure S =
-               Word_ChooseWordN
-               (type 'a t = Word8.word array * C_Ptrdiff.t * 'a -> unit
-                val fWord8 = PrimitiveFFI.PackWord8.updateRev
-                val fWord16 = PrimitiveFFI.PackWord16.updateRev
-                val fWord32 = PrimitiveFFI.PackWord32.updateRev
-                val fWord64 = PrimitiveFFI.PackWord64.updateRev)
-         in
-            val updateRev = S.f
-         end
       end
 in
 structure PackWordBig: PACK_WORD =
@@ -206,69 +175,36 @@
          local
             structure S =
                LargeWord_ChooseWordN
-               (type 'a t = Word8.word array * C_Ptrdiff.t -> 'a
-                val fWord8 = PrimitiveFFI.PackWord8.subArr
-                val fWord16 = PrimitiveFFI.PackWord16.subArr
-                val fWord32 = PrimitiveFFI.PackWord32.subArr
-                val fWord64 = PrimitiveFFI.PackWord64.subArr)
+               (type 'a t = Word8.word array * SeqIndex.t -> 'a
+                val fWord8 = Primitive.PackWord8.subArr
+                val fWord16 = Primitive.PackWord16.subArr
+                val fWord32 = Primitive.PackWord32.subArr
+                val fWord64 = Primitive.PackWord64.subArr)
          in
             val subArr = S.f
          end
          local
             structure S =
                LargeWord_ChooseWordN
-               (type 'a t = Word8.word array * C_Ptrdiff.t -> 'a
-                val fWord8 = PrimitiveFFI.PackWord8.subArrRev
-                val fWord16 = PrimitiveFFI.PackWord16.subArrRev
-                val fWord32 = PrimitiveFFI.PackWord32.subArrRev
-                val fWord64 = PrimitiveFFI.PackWord64.subArrRev)
+               (type 'a t = Word8.word vector * SeqIndex.t -> 'a
+                val fWord8 = Primitive.PackWord8.subVec
+                val fWord16 = Primitive.PackWord16.subVec
+                val fWord32 = Primitive.PackWord32.subVec
+                val fWord64 = Primitive.PackWord64.subVec)
          in
-            val subArrRev = S.f
-         end
-         local
-            structure S =
-               LargeWord_ChooseWordN
-               (type 'a t = Word8.word vector * C_Ptrdiff.t -> 'a
-                val fWord8 = PrimitiveFFI.PackWord8.subVec
-                val fWord16 = PrimitiveFFI.PackWord16.subVec
-                val fWord32 = PrimitiveFFI.PackWord32.subVec
-                val fWord64 = PrimitiveFFI.PackWord64.subVec)
-         in
             val subVec = S.f
          end
          local
             structure S =
                LargeWord_ChooseWordN
-               (type 'a t = Word8.word vector * C_Ptrdiff.t -> 'a
-                val fWord8 = PrimitiveFFI.PackWord8.subVecRev
-                val fWord16 = PrimitiveFFI.PackWord16.subVecRev
-                val fWord32 = PrimitiveFFI.PackWord32.subVecRev
-                val fWord64 = PrimitiveFFI.PackWord64.subVecRev)
+               (type 'a t = Word8.word array * SeqIndex.t * 'a -> unit
+                val fWord8 = Primitive.PackWord8.update
+                val fWord16 = Primitive.PackWord16.update
+                val fWord32 = Primitive.PackWord32.update
+                val fWord64 = Primitive.PackWord64.update)
          in
-            val subVecRev = S.f
-         end
-         local
-            structure S =
-               LargeWord_ChooseWordN
-               (type 'a t = Word8.word array * C_Ptrdiff.t * 'a -> unit
-                val fWord8 = PrimitiveFFI.PackWord8.update
-                val fWord16 = PrimitiveFFI.PackWord16.update
-                val fWord32 = PrimitiveFFI.PackWord32.update
-                val fWord64 = PrimitiveFFI.PackWord64.update)
-         in
             val update = S.f
          end
-         local
-            structure S =
-               LargeWord_ChooseWordN
-               (type 'a t = Word8.word array * C_Ptrdiff.t * 'a -> unit
-                val fWord8 = PrimitiveFFI.PackWord8.updateRev
-                val fWord16 = PrimitiveFFI.PackWord16.updateRev
-                val fWord32 = PrimitiveFFI.PackWord32.updateRev
-                val fWord64 = PrimitiveFFI.PackWord64.updateRev)
-         in
-            val updateRev = S.f
-         end
       end
 in
 structure PackLargeWordBig: PACK_WORD =

Modified: mlton/trunk/basis-library/integer/word.sig
===================================================================
--- mlton/trunk/basis-library/integer/word.sig	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/integer/word.sig	2007-06-19 21:49:40 UTC (rev 5657)
@@ -66,6 +66,7 @@
       val toWordX: word -> Word.word
       val fromWord: Word.word -> word
 
+      val bswap: word -> word
       val rol: word * Word.word -> word
       val ror: word * Word.word -> word
       val log2 : word -> Primitive.Int32.int

Modified: mlton/trunk/basis-library/integer/word.sml
===================================================================
--- mlton/trunk/basis-library/integer/word.sml	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/integer/word.sml	2007-06-19 21:49:40 UTC (rev 5657)
@@ -30,6 +30,27 @@
 fun rol (i, n) = W.rolUnsafe (i, Primitive.Word32.zextdFromWord n)
 fun ror (i, n) = W.rorUnsafe (i, Primitive.Word32.zextdFromWord n)
 
+local
+   fun st (w, msk, sft) =
+      let
+         val odd = andb (w, msk)
+         val evn = xorb (w, odd)
+      in
+         (xorb (W.<<? (odd, sft), W.>>? (evn, sft)),
+          xorb (msk, W.<<? (msk, Primitive.Word32.>>? (sft, 0w1))),
+          Primitive.Word32.>>? (sft, 0w1))
+      end
+   val (f, sft) =
+      case W.sizeInBitsWord of
+         0w8 => (fn x => x, 0w4)
+       | 0w16 => (st, 0w8)
+       | 0w32 => (st o st, 0w16)
+       | 0w64 => (st o st o st, 0w32)
+       | _ => raise (Fail "Word.bswap")
+in
+   fun bswap w = #1 (f (w, W.<<? (one, sft) - one, sft))
+end
+
 val fromInt = W.sextdFromInt
 val toIntX = W.schckToInt
 fun toInt w =

Modified: mlton/trunk/basis-library/libs/all.mlb
===================================================================
--- mlton/trunk/basis-library/libs/all.mlb	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/libs/all.mlb	2007-06-19 21:49:40 UTC (rev 5657)
@@ -14,5 +14,6 @@
    ../mlton.mlb
    ../sml-nj.mlb
    ../unsafe.mlb
+   ../c-types.mlb
 in
 end

Modified: mlton/trunk/basis-library/mlton/ffi.sig
===================================================================
--- mlton/trunk/basis-library/mlton/ffi.sig	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/mlton/ffi.sig	2007-06-19 21:49:40 UTC (rev 5657)
@@ -15,11 +15,12 @@
       val getChar16: int -> Char16.char
       val getChar32: int -> Char32.char
 *)
+      val getCPointer: int -> MLtonPointer.t
       val getInt8: int -> Int8.int
       val getInt16: int -> Int16.int
       val getInt32: int -> Int32.int
       val getInt64: int -> Int64.int
-      val getPointer: int -> 'a
+      val getObjptr: int -> 'a
       val getReal32: int -> Real32.real
       val getReal64: int -> Real64.real
       val getWord8: int -> Word8.word
@@ -33,11 +34,12 @@
       val setChar16: Char16.char -> unit
       val setChar32: Char32.char -> unit
 *)
+      val setCPointer: MLtonPointer.t -> unit
       val setInt8: Int8.int -> unit
       val setInt16: Int16.int -> unit
       val setInt32: Int32.int -> unit
       val setInt64: Int64.int -> unit
-      val setPointer: 'a -> unit
+      val setObjptr: 'a -> unit
       val setReal32: Real32.real -> unit
       val setReal64: Real64.real -> unit
       val setWord8: Word8.word -> unit

Modified: mlton/trunk/basis-library/mlton/ffi.sml
===================================================================
--- mlton/trunk/basis-library/mlton/ffi.sml	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/mlton/ffi.sml	2007-06-19 21:49:40 UTC (rev 5657)
@@ -17,6 +17,8 @@
       (fn i => get (p, C_Ptrdiff.fromInt i), 
        fn x => set (p, C_Ptrdiff.fromInt 0, x))
 in
+   fun getCPointer i = Pointer.getCPointer (Prim.cpointerArray, C_Ptrdiff.fromInt i)
+   fun setCPointer x = Pointer.setCPointer (Prim.cpointerArray, C_Ptrdiff.fromInt 0, x)
    val (getInt8, setInt8) =
       make (Prim.int8Array, Pointer.getInt8, Pointer.setInt8)
    val (getInt16, setInt16) =
@@ -25,8 +27,8 @@
       make (Prim.int32Array, Pointer.getInt32, Pointer.setInt32)
    val (getInt64, setInt64) =
       make (Prim.int64Array, Pointer.getInt64, Pointer.setInt64)
-   fun getPointer i = Pointer.getPointer (Prim.pointerArray, C_Ptrdiff.fromInt i)
-   fun setPointer x = Pointer.setPointer (Prim.pointerArray, C_Ptrdiff.fromInt 0, x)
+   fun getObjptr i = Pointer.getObjptr (Prim.objptrArray, C_Ptrdiff.fromInt i)
+   fun setObjptr x = Pointer.setObjptr (Prim.objptrArray, C_Ptrdiff.fromInt 0, x)
    val (getReal32, setReal32) =
       make (Prim.real32Array, Pointer.getReal32, Pointer.setReal32)
    val (getReal64, setReal64) =

Modified: mlton/trunk/basis-library/mlton/mlton.sig
===================================================================
--- mlton/trunk/basis-library/mlton/mlton.sig	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/mlton/mlton.sig	2007-06-19 21:49:40 UTC (rev 5657)
@@ -39,6 +39,14 @@
       structure Profile: MLTON_PROFILE
 (*      structure Ptrace: MLTON_PTRACE *)
       structure Random: MLTON_RANDOM
+      structure Real32: sig
+                           val castFromWord: Word32.word -> Real32.real
+                           val castToWord: Real32.real -> Word32.word
+                        end
+      structure Real64: sig
+                           val castFromWord: Word64.word -> Real64.real
+                           val castToWord: Real64.real -> Word64.word
+                        end
       structure Rlimit: MLTON_RLIMIT
       structure Rusage: MLTON_RUSAGE
       structure Signal: MLTON_SIGNAL
@@ -50,6 +58,9 @@
       structure Weak: MLTON_WEAK
       structure Word: MLTON_WORD
       structure Word8: MLTON_WORD
+      structure Word16: MLTON_WORD
+      structure Word32: MLTON_WORD
+      structure Word64: MLTON_WORD
       structure Word8Array: MLTON_MONO_ARRAY
       structure Word8Vector: MLTON_MONO_VECTOR
       structure World: MLTON_WORLD

Modified: mlton/trunk/basis-library/mlton/mlton.sml
===================================================================
--- mlton/trunk/basis-library/mlton/mlton.sml	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/mlton/mlton.sml	2007-06-19 21:49:40 UTC (rev 5657)
@@ -60,6 +60,8 @@
 (* structure Ptrace = MLtonPtrace *)
 structure Profile = MLtonProfile
 structure Random = MLtonRandom
+structure Real32 = Primitive.PackReal32
+structure Real64 = Primitive.PackReal64
 structure Rlimit = MLtonRlimit
 structure Rusage = MLtonRusage
 structure Signal = MLtonSignal
@@ -80,6 +82,21 @@
       open Word8
       type t = word
    end
+structure Word16 =
+   struct
+      open Word16
+      type t = word
+   end
+structure Word32 =
+   struct
+      open Word32
+      type t = word
+   end
+structure Word64 =
+   struct
+      open Word64
+      type t = word
+   end
 
 structure Word8Array = struct
    open Word8Array

Modified: mlton/trunk/basis-library/mlton/pointer.sml
===================================================================
--- mlton/trunk/basis-library/mlton/pointer.sml	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/mlton/pointer.sml	2007-06-19 21:49:40 UTC (rev 5657)
@@ -10,10 +10,9 @@
 
 open Primitive.MLton.Pointer
 
-fun add (p, t) = fromWord (C_Pointer.+ (toWord p, C_Pointer.fromWord t))
-fun compare (p, p') = C_Pointer.compare (toWord p, toWord p')
-fun diff (p, p') = C_Pointer.toWord (C_Pointer.- (toWord p, toWord p'))
-fun sub (p, t) = fromWord (C_Pointer.- (toWord p, C_Pointer.fromWord t))
+val add = fn (p, t) => add (p, C_Size.fromWord t)
+val sub = fn (p, t) => sub (p, C_Size.fromWord t)
+val diff = fn (p, p') => C_Size.toWord (diff (p, p'))
 
 local
    fun wrap f (p, i) =
@@ -23,7 +22,7 @@
    val getInt16 = wrap getInt16
    val getInt32 = wrap getInt32
    val getInt64 = wrap getInt64
-   val getPointer = wrap getPointer
+   val getPointer = wrap getCPointer
    val getReal32 = wrap getReal32
    val getReal64 = wrap getReal64
    val getWord8 = wrap getWord8
@@ -40,7 +39,7 @@
    val setInt16 = wrap setInt16
    val setInt32 = wrap setInt32
    val setInt64 = wrap setInt64
-   val setPointer = wrap setPointer
+   val setPointer = wrap setCPointer
    val setReal32 = wrap setReal32
    val setReal64 = wrap setReal64
    val setWord8 = wrap setWord8

Modified: mlton/trunk/basis-library/mlton/thread.sml
===================================================================
--- mlton/trunk/basis-library/mlton/thread.sml	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/mlton/thread.sml	2007-06-19 21:49:40 UTC (rev 5657)
@@ -30,7 +30,7 @@
    val atomicBegin = atomicBegin
    val atomicEnd = atomicEnd
    val atomicState = fn () =>
-      case canHandle () of
+      case atomicState () of
          0wx0 => AtomicState.NonAtomic
        | w => AtomicState.Atomic (Word32.toInt w)
 end

Modified: mlton/trunk/basis-library/mlton/word.sig
===================================================================
--- mlton/trunk/basis-library/mlton/word.sig	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/mlton/word.sig	2007-06-19 21:49:40 UTC (rev 5657)
@@ -10,6 +10,7 @@
    sig
       type t
 
+      val bswap: t -> t
       val rol: t * word -> t
       val ror: t * word -> t
    end

Modified: mlton/trunk/basis-library/posix/error.sml
===================================================================
--- mlton/trunk/basis-library/posix/error.sml	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/posix/error.sml	2007-06-19 21:49:40 UTC (rev 5657)
@@ -273,7 +273,7 @@
                       handlers: (syserror * (unit -> 'b)) list}: 'b =
                      err {default = fn () =>
                           if restart andalso errno = intr andalso !restartFlag
-                             then if Thread.canHandle () = 0w0
+                             then if Thread.atomicState () = 0w0
                                      then call errUnblocked
                                      else let val finish = !blocker ()
                                           in 

Modified: mlton/trunk/basis-library/primitive/basis-ffi.sml
===================================================================
--- mlton/trunk/basis-library/primitive/basis-ffi.sml	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/primitive/basis-ffi.sml	2007-06-19 21:49:40 UTC (rev 5657)
@@ -213,60 +213,6 @@
 val POLLPRI = _const "OS_IO_POLLPRI" : C_Short.t;
 end
 end
-structure PackReal32 = 
-struct
-val subArr = _import "PackReal32_subArr" : (Word8.t) array * C_Ptrdiff.t -> Real32.t;
-val subArrRev = _import "PackReal32_subArrRev" : (Word8.t) array * C_Ptrdiff.t -> Real32.t;
-val subVec = _import "PackReal32_subVec" : (Word8.t) vector * C_Ptrdiff.t -> Real32.t;
-val subVecRev = _import "PackReal32_subVecRev" : (Word8.t) vector * C_Ptrdiff.t -> Real32.t;
-val update = _import "PackReal32_update" : (Word8.t) array * C_Ptrdiff.t * Real32.t -> unit;
-val updateRev = _import "PackReal32_updateRev" : (Word8.t) array * C_Ptrdiff.t * Real32.t -> unit;
-end
-structure PackReal64 = 
-struct
-val subArr = _import "PackReal64_subArr" : (Word8.t) array * C_Ptrdiff.t -> Real64.t;
-val subArrRev = _import "PackReal64_subArrRev" : (Word8.t) array * C_Ptrdiff.t -> Real64.t;
-val subVec = _import "PackReal64_subVec" : (Word8.t) vector * C_Ptrdiff.t -> Real64.t;
-val subVecRev = _import "PackReal64_subVecRev" : (Word8.t) vector * C_Ptrdiff.t -> Real64.t;
-val update = _import "PackReal64_update" : (Word8.t) array * C_Ptrdiff.t * Real64.t -> unit;
-val updateRev = _import "PackReal64_updateRev" : (Word8.t) array * C_Ptrdiff.t * Real64.t -> unit;
-end
-structure PackWord16 = 
-struct
-val subArr = _import "PackWord16_subArr" : (Word8.t) array * C_Ptrdiff.t -> Word16.t;
-val subArrRev = _import "PackWord16_subArrRev" : (Word8.t) array * C_Ptrdiff.t -> Word16.t;
-val subVec = _import "PackWord16_subVec" : (Word8.t) vector * C_Ptrdiff.t -> Word16.t;
-val subVecRev = _import "PackWord16_subVecRev" : (Word8.t) vector * C_Ptrdiff.t -> Word16.t;
-val update = _import "PackWord16_update" : (Word8.t) array * C_Ptrdiff.t * Word16.t -> unit;
-val updateRev = _import "PackWord16_updateRev" : (Word8.t) array * C_Ptrdiff.t * Word16.t -> unit;
-end
-structure PackWord32 = 
-struct
-val subArr = _import "PackWord32_subArr" : (Word8.t) array * C_Ptrdiff.t -> Word32.t;
-val subArrRev = _import "PackWord32_subArrRev" : (Word8.t) array * C_Ptrdiff.t -> Word32.t;
-val subVec = _import "PackWord32_subVec" : (Word8.t) vector * C_Ptrdiff.t -> Word32.t;
-val subVecRev = _import "PackWord32_subVecRev" : (Word8.t) vector * C_Ptrdiff.t -> Word32.t;
-val update = _import "PackWord32_update" : (Word8.t) array * C_Ptrdiff.t * Word32.t -> unit;
-val updateRev = _import "PackWord32_updateRev" : (Word8.t) array * C_Ptrdiff.t * Word32.t -> unit;
-end
-structure PackWord64 = 
-struct
-val subArr = _import "PackWord64_subArr" : (Word8.t) array * C_Ptrdiff.t -> Word64.t;
-val subArrRev = _import "PackWord64_subArrRev" : (Word8.t) array * C_Ptrdiff.t -> Word64.t;
-val subVec = _import "PackWord64_subVec" : (Word8.t) vector * C_Ptrdiff.t -> Word64.t;
-val subVecRev = _import "PackWord64_subVecRev" : (Word8.t) vector * C_Ptrdiff.t -> Word64.t;
-val update = _import "PackWord64_update" : (Word8.t) array * C_Ptrdiff.t * Word64.t -> unit;
-val updateRev = _import "PackWord64_updateRev" : (Word8.t) array * C_Ptrdiff.t * Word64.t -> unit;
-end
-structure PackWord8 = 
-struct
-val subArr = _import "PackWord8_subArr" : (Word8.t) array * C_Ptrdiff.t -> Word8.t;
-val subArrRev = _import "PackWord8_subArrRev" : (Word8.t) array * C_Ptrdiff.t -> Word8.t;
-val subVec = _import "PackWord8_subVec" : (Word8.t) vector * C_Ptrdiff.t -> Word8.t;
-val subVecRev = _import "PackWord8_subVecRev" : (Word8.t) vector * C_Ptrdiff.t -> Word8.t;
-val update = _import "PackWord8_update" : (Word8.t) array * C_Ptrdiff.t * Word8.t -> unit;
-val updateRev = _import "PackWord8_updateRev" : (Word8.t) array * C_Ptrdiff.t * Word8.t -> unit;
-end
 structure Posix = 
 struct
 structure Error = 
@@ -962,6 +908,7 @@
 type t = Real32.t
 val abs = _import "Real32_abs" : Real32.t -> Real32.t;
 val add = _import "Real32_add" : Real32.t * Real32.t -> Real32.t;
+val castToWord32 = _import "Real32_castToWord32" : Real32.t -> Word32.t;
 val class = _import "Real32_class" : Real32.t -> C_Int.t;
 val div = _import "Real32_div" : Real32.t * Real32.t -> Real32.t;
 val equal = _import "Real32_equal" : Real32.t * Real32.t -> Bool.t;
@@ -1000,29 +947,28 @@
 val muladd = _import "Real32_muladd" : Real32.t * Real32.t * Real32.t -> Real32.t;
 val mulsub = _import "Real32_mulsub" : Real32.t * Real32.t * Real32.t -> Real32.t;
 val neg = _import "Real32_neg" : Real32.t -> Real32.t;
-val nextAfterDown = _import "Real32_nextAfterDown" : Real32.t -> Real32.t;
-val nextAfterUp = _import "Real32_nextAfterUp" : Real32.t -> Real32.t;
+val rndToReal32 = _import "Real32_rndToReal32" : Real32.t -> Real32.t;
+val rndToReal64 = _import "Real32_rndToReal64" : Real32.t -> Real64.t;
+val rndToWordS16 = _import "Real32_rndToWordS16" : Real32.t -> Int16.t;
+val rndToWordS32 = _import "Real32_rndToWordS32" : Real32.t -> Int32.t;
+val rndToWordS64 = _import "Real32_rndToWordS64" : Real32.t -> Int64.t;
+val rndToWordS8 = _import "Real32_rndToWordS8" : Real32.t -> Int8.t;
+val rndToWordU16 = _import "Real32_rndToWordU16" : Real32.t -> Word16.t;
+val rndToWordU32 = _import "Real32_rndToWordU32" : Real32.t -> Word32.t;
+val rndToWordU64 = _import "Real32_rndToWordU64" : Real32.t -> Word64.t;
+val rndToWordU8 = _import "Real32_rndToWordU8" : Real32.t -> Word8.t;
 val round = _import "Real32_round" : Real32.t -> Real32.t;
 val signBit = _import "Real32_signBit" : Real32.t -> C_Int.t;
 val store = _import "Real32_store" : (Real32.t) ref * Real32.t -> unit;
 val strto = _import "Real32_strto" : NullString8.t -> Real32.t;
 val sub = _import "Real32_sub" : Real32.t * Real32.t -> Real32.t;
-val toReal32 = _import "Real32_toReal32" : Real32.t -> Real32.t;
-val toReal64 = _import "Real32_toReal64" : Real32.t -> Real64.t;
-val toWordS16 = _import "Real32_toWordS16" : Real32.t -> Int16.t;
-val toWordS32 = _import "Real32_toWordS32" : Real32.t -> Int32.t;
-val toWordS64 = _import "Real32_toWordS64" : Real32.t -> Int64.t;
-val toWordS8 = _import "Real32_toWordS8" : Real32.t -> Int8.t;
-val toWordU16 = _import "Real32_toWordU16" : Real32.t -> Word16.t;
-val toWordU32 = _import "Real32_toWordU32" : Real32.t -> Word32.t;
-val toWordU64 = _import "Real32_toWordU64" : Real32.t -> Word64.t;
-val toWordU8 = _import "Real32_toWordU8" : Real32.t -> Word8.t;
 end
 structure Real64 = 
 struct
 type t = Real64.t
 val abs = _import "Real64_abs" : Real64.t -> Real64.t;
 val add = _import "Real64_add" : Real64.t * Real64.t -> Real64.t;
+val castToWord64 = _import "Real64_castToWord64" : Real64.t -> Word64.t;
 val class = _import "Real64_class" : Real64.t -> C_Int.t;
 val div = _import "Real64_div" : Real64.t * Real64.t -> Real64.t;
 val equal = _import "Real64_equal" : Real64.t * Real64.t -> Bool.t;
@@ -1061,23 +1007,21 @@
 val muladd = _import "Real64_muladd" : Real64.t * Real64.t * Real64.t -> Real64.t;
 val mulsub = _import "Real64_mulsub" : Real64.t * Real64.t * Real64.t -> Real64.t;
 val neg = _import "Real64_neg" : Real64.t -> Real64.t;
-val nextAfterDown = _import "Real64_nextAfterDown" : Real64.t -> Real64.t;
-val nextAfterUp = _import "Real64_nextAfterUp" : Real64.t -> Real64.t;
+val rndToReal32 = _import "Real64_rndToReal32" : Real64.t -> Real32.t;
+val rndToReal64 = _import "Real64_rndToReal64" : Real64.t -> Real64.t;
+val rndToWordS16 = _import "Real64_rndToWordS16" : Real64.t -> Int16.t;
+val rndToWordS32 = _import "Real64_rndToWordS32" : Real64.t -> Int32.t;
+val rndToWordS64 = _import "Real64_rndToWordS64" : Real64.t -> Int64.t;
+val rndToWordS8 = _import "Real64_rndToWordS8" : Real64.t -> Int8.t;
+val rndToWordU16 = _import "Real64_rndToWordU16" : Real64.t -> Word16.t;
+val rndToWordU32 = _import "Real64_rndToWordU32" : Real64.t -> Word32.t;
+val rndToWordU64 = _import "Real64_rndToWordU64" : Real64.t -> Word64.t;
+val rndToWordU8 = _import "Real64_rndToWordU8" : Real64.t -> Word8.t;
 val round = _import "Real64_round" : Real64.t -> Real64.t;
 val signBit = _import "Real64_signBit" : Real64.t -> C_Int.t;
 val store = _import "Real64_store" : (Real64.t) ref * Real64.t -> unit;
 val strto = _import "Real64_strto" : NullString8.t -> Real64.t;
 val sub = _import "Real64_sub" : Real64.t * Real64.t -> Real64.t;
-val toReal32 = _import "Real64_toReal32" : Real64.t -> Real32.t;
-val toReal64 = _import "Real64_toReal64" : Real64.t -> Real64.t;
-val toWordS16 = _import "Real64_toWordS16" : Real64.t -> Int16.t;
-val toWordS32 = _import "Real64_toWordS32" : Real64.t -> Int32.t;
-val toWordS64 = _import "Real64_toWordS64" : Real64.t -> Int64.t;
-val toWordS8 = _import "Real64_toWordS8" : Real64.t -> Int8.t;
-val toWordU16 = _import "Real64_toWordU16" : Real64.t -> Word16.t;
-val toWordU32 = _import "Real64_toWordU32" : Real64.t -> Word32.t;
-val toWordU64 = _import "Real64_toWordU64" : Real64.t -> Word64.t;
-val toWordU8 = _import "Real64_toWordU8" : Real64.t -> Word8.t;
 end
 structure Socket = 
 struct
@@ -1218,6 +1162,7 @@
 type t = Word32.t
 val add = _import "Word32_add" : Word32.t * Word32.t -> Word32.t;
 val andb = _import "Word32_andb" : Word32.t * Word32.t -> Word32.t;
+val castToReal32 = _import "Word32_castToReal32" : Word32.t -> Real32.t;
 val equal = _import "Word32_equal" : Word32.t * Word32.t -> Bool.t;
 val lshift = _import "Word32_lshift" : Word32.t * Word32.t -> Word32.t;
 val neg = _import "Word32_neg" : Word32.t -> Word32.t;
@@ -1233,6 +1178,7 @@
 type t = Word64.t
 val add = _import "Word64_add" : Word64.t * Word64.t -> Word64.t;
 val andb = _import "Word64_andb" : Word64.t * Word64.t -> Word64.t;
+val castToReal64 = _import "Word64_castToReal64" : Word64.t -> Real64.t;
 val equal = _import "Word64_equal" : Word64.t * Word64.t -> Bool.t;
 val fetch = _import "Word64_fetch" : (Word64.t) ref -> Word64.t;
 val lshift = _import "Word64_lshift" : Word64.t * Word32.t -> Word64.t;
@@ -1264,6 +1210,10 @@
 structure WordS16 = 
 struct
 val addCheckOverflows = _import "WordS16_addCheckOverflows" : Int16.t * Int16.t -> Bool.t;
+val extdToWord16 = _import "WordS16_extdToWord16" : Int16.t -> Word16.t;
+val extdToWord32 = _import "WordS16_extdToWord32" : Int16.t -> Word32.t;
+val extdToWord64 = _import "WordS16_extdToWord64" : Int16.t -> Word64.t;
+val extdToWord8 = _import "WordS16_extdToWord8" : Int16.t -> Word8.t;
 val ge = _import "WordS16_ge" : Int16.t * Int16.t -> Bool.t;
 val gt = _import "WordS16_gt" : Int16.t * Int16.t -> Bool.t;
 val le = _import "WordS16_le" : Int16.t * Int16.t -> Bool.t;
@@ -1273,18 +1223,18 @@
 val negCheckOverflows = _import "WordS16_negCheckOverflows" : Int16.t -> Bool.t;
 val quot = _import "WordS16_quot" : Int16.t * Int16.t -> Int16.t;
 val rem = _import "WordS16_rem" : Int16.t * Int16.t -> Int16.t;
+val rndToReal32 = _import "WordS16_rndToReal32" : Int16.t -> Real32.t;
+val rndToReal64 = _import "WordS16_rndToReal64" : Int16.t -> Real64.t;
 val rshift = _import "WordS16_rshift" : Int16.t * Word32.t -> Int16.t;
 val subCheckOverflows = _import "WordS16_subCheckOverflows" : Int16.t * Int16.t -> Bool.t;
-val toReal32 = _import "WordS16_toReal32" : Int16.t -> Real32.t;
-val toReal64 = _import "WordS16_toReal64" : Int16.t -> Real64.t;
-val toWord16 = _import "WordS16_toWord16" : Int16.t -> Word16.t;
-val toWord32 = _import "WordS16_toWord32" : Int16.t -> Word32.t;
-val toWord64 = _import "WordS16_toWord64" : Int16.t -> Word64.t;
-val toWord8 = _import "WordS16_toWord8" : Int16.t -> Word8.t;
 end
 structure WordS32 = 
 struct
 val addCheckOverflows = _import "WordS32_addCheckOverflows" : Int32.t * Int32.t -> Bool.t;
+val extdToWord16 = _import "WordS32_extdToWord16" : Int32.t -> Word16.t;
+val extdToWord32 = _import "WordS32_extdToWord32" : Int32.t -> Word32.t;
+val extdToWord64 = _import "WordS32_extdToWord64" : Int32.t -> Word64.t;
+val extdToWord8 = _import "WordS32_extdToWord8" : Int32.t -> Word8.t;
 val ge = _import "WordS32_ge" : Int32.t * Int32.t -> Bool.t;
 val gt = _import "WordS32_gt" : Int32.t * Int32.t -> Bool.t;
 val le = _import "WordS32_le" : Int32.t * Int32.t -> Bool.t;
@@ -1294,18 +1244,18 @@
 val negCheckOverflows = _import "WordS32_negCheckOverflows" : Int32.t -> Bool.t;
 val quot = _import "WordS32_quot" : Int32.t * Int32.t -> Int32.t;
 val rem = _import "WordS32_rem" : Int32.t * Int32.t -> Int32.t;
+val rndToReal32 = _import "WordS32_rndToReal32" : Int32.t -> Real32.t;
+val rndToReal64 = _import "WordS32_rndToReal64" : Int32.t -> Real64.t;
 val rshift = _import "WordS32_rshift" : Int32.t * Word32.t -> Int32.t;
 val subCheckOverflows = _import "WordS32_subCheckOverflows" : Int32.t * Int32.t -> Bool.t;
-val toReal32 = _import "WordS32_toReal32" : Int32.t -> Real32.t;
-val toReal64 = _import "WordS32_toReal64" : Int32.t -> Real64.t;
-val toWord16 = _import "WordS32_toWord16" : Int32.t -> Word16.t;
-val toWord32 = _import "WordS32_toWord32" : Int32.t -> Word32.t;
-val toWord64 = _import "WordS32_toWord64" : Int32.t -> Word64.t;
-val toWord8 = _import "WordS32_toWord8" : Int32.t -> Word8.t;
 end
 structure WordS64 = 
 struct
 val addCheckOverflows = _import "WordS64_addCheckOverflows" : Int64.t * Int64.t -> Bool.t;
+val extdToWord16 = _import "WordS64_extdToWord16" : Int64.t -> Word16.t;
+val extdToWord32 = _import "WordS64_extdToWord32" : Int64.t -> Word32.t;
+val extdToWord64 = _import "WordS64_extdToWord64" : Int64.t -> Word64.t;
+val extdToWord8 = _import "WordS64_extdToWord8" : Int64.t -> Word8.t;
 val ge = _import "WordS64_ge" : Int64.t * Int64.t -> Bool.t;
 val gt = _import "WordS64_gt" : Int64.t * Int64.t -> Bool.t;
 val le = _import "WordS64_le" : Int64.t * Int64.t -> Bool.t;
@@ -1315,18 +1265,18 @@
 val negCheckOverflows = _import "WordS64_negCheckOverflows" : Int64.t -> Bool.t;
 val quot = _import "WordS64_quot" : Int64.t * Int64.t -> Int64.t;
 val rem = _import "WordS64_rem" : Int64.t * Int64.t -> Int64.t;
+val rndToReal32 = _import "WordS64_rndToReal32" : Int64.t -> Real32.t;
+val rndToReal64 = _import "WordS64_rndToReal64" : Int64.t -> Real64.t;
 val rshift = _import "WordS64_rshift" : Int64.t * Word32.t -> Int64.t;
 val subCheckOverflows = _import "WordS64_subCheckOverflows" : Int64.t * Int64.t -> Bool.t;
-val toReal32 = _import "WordS64_toReal32" : Int64.t -> Real32.t;
-val toReal64 = _import "WordS64_toReal64" : Int64.t -> Real64.t;
-val toWord16 = _import "WordS64_toWord16" : Int64.t -> Word16.t;
-val toWord32 = _import "WordS64_toWord32" : Int64.t -> Word32.t;
-val toWord64 = _import "WordS64_toWord64" : Int64.t -> Word64.t;
-val toWord8 = _import "WordS64_toWord8" : Int64.t -> Word8.t;
 end
 structure WordS8 = 
 struct
 val addCheckOverflows = _import "WordS8_addCheckOverflows" : Int8.t * Int8.t -> Bool.t;
+val extdToWord16 = _import "WordS8_extdToWord16" : Int8.t -> Word16.t;
+val extdToWord32 = _import "WordS8_extdToWord32" : Int8.t -> Word32.t;
+val extdToWord64 = _import "WordS8_extdToWord64" : Int8.t -> Word64.t;
+val extdToWord8 = _import "WordS8_extdToWord8" : Int8.t -> Word8.t;
 val ge = _import "WordS8_ge" : Int8.t * Int8.t -> Bool.t;
 val gt = _import "WordS8_gt" : Int8.t * Int8.t -> Bool.t;
 val le = _import "WordS8_le" : Int8.t * Int8.t -> Bool.t;
@@ -1336,18 +1286,18 @@
 val negCheckOverflows = _import "WordS8_negCheckOverflows" : Int8.t -> Bool.t;
 val quot = _import "WordS8_quot" : Int8.t * Int8.t -> Int8.t;
 val rem = _import "WordS8_rem" : Int8.t * Int8.t -> Int8.t;
+val rndToReal32 = _import "WordS8_rndToReal32" : Int8.t -> Real32.t;
+val rndToReal64 = _import "WordS8_rndToReal64" : Int8.t -> Real64.t;
 val rshift = _import "WordS8_rshift" : Int8.t * Word32.t -> Int8.t;
 val subCheckOverflows = _import "WordS8_subCheckOverflows" : Int8.t * Int8.t -> Bool.t;
-val toReal32 = _import "WordS8_toReal32" : Int8.t -> Real32.t;
-val toReal64 = _import "WordS8_toReal64" : Int8.t -> Real64.t;
-val toWord16 = _import "WordS8_toWord16" : Int8.t -> Word16.t;
-val toWord32 = _import "WordS8_toWord32" : Int8.t -> Word32.t;
-val toWord64 = _import "WordS8_toWord64" : Int8.t -> Word64.t;
-val toWord8 = _import "WordS8_toWord8" : Int8.t -> Word8.t;
 end
 structure WordU16 = 
 struct
 val addCheckOverflows = _import "WordU16_addCheckOverflows" : Word16.t * Word16.t -> Bool.t;
+val extdToWord16 = _import "WordU16_extdToWord16" : Word16.t -> Word16.t;
+val extdToWord32 = _import "WordU16_extdToWord32" : Word16.t -> Word32.t;
+val extdToWord64 = _import "WordU16_extdToWord64" : Word16.t -> Word64.t;
+val extdToWord8 = _import "WordU16_extdToWord8" : Word16.t -> Word8.t;
 val ge = _import "WordU16_ge" : Word16.t * Word16.t -> Bool.t;
 val gt = _import "WordU16_gt" : Word16.t * Word16.t -> Bool.t;
 val le = _import "WordU16_le" : Word16.t * Word16.t -> Bool.t;
@@ -1356,17 +1306,17 @@
 val mulCheckOverflows = _import "WordU16_mulCheckOverflows" : Word16.t * Word16.t -> Bool.t;
 val quot = _import "WordU16_quot" : Word16.t * Word16.t -> Word16.t;
 val rem = _import "WordU16_rem" : Word16.t * Word16.t -> Word16.t;
+val rndToReal32 = _import "WordU16_rndToReal32" : Word16.t -> Real32.t;
+val rndToReal64 = _import "WordU16_rndToReal64" : Word16.t -> Real64.t;
 val rshift = _import "WordU16_rshift" : Word16.t * Word32.t -> Word16.t;
-val toReal32 = _import "WordU16_toReal32" : Word16.t -> Real32.t;
-val toReal64 = _import "WordU16_toReal64" : Word16.t -> Real64.t;
-val toWord16 = _import "WordU16_toWord16" : Word16.t -> Word16.t;
-val toWord32 = _import "WordU16_toWord32" : Word16.t -> Word32.t;
-val toWord64 = _import "WordU16_toWord64" : Word16.t -> Word64.t;
-val toWord8 = _import "WordU16_toWord8" : Word16.t -> Word8.t;
 end
 structure WordU32 = 
 struct
 val addCheckOverflows = _import "WordU32_addCheckOverflows" : Word32.t * Word32.t -> Bool.t;
+val extdToWord16 = _import "WordU32_extdToWord16" : Word32.t -> Word16.t;
+val extdToWord32 = _import "WordU32_extdToWord32" : Word32.t -> Word32.t;
+val extdToWord64 = _import "WordU32_extdToWord64" : Word32.t -> Word64.t;
+val extdToWord8 = _import "WordU32_extdToWord8" : Word32.t -> Word8.t;
 val ge = _import "WordU32_ge" : Word32.t * Word32.t -> Bool.t;
 val gt = _import "WordU32_gt" : Word32.t * Word32.t -> Bool.t;
 val le = _import "WordU32_le" : Word32.t * Word32.t -> Bool.t;
@@ -1375,17 +1325,17 @@
 val mulCheckOverflows = _import "WordU32_mulCheckOverflows" : Word32.t * Word32.t -> Bool.t;
 val quot = _import "WordU32_quot" : Word32.t * Word32.t -> Word32.t;
 val rem = _import "WordU32_rem" : Word32.t * Word32.t -> Word32.t;
+val rndToReal32 = _import "WordU32_rndToReal32" : Word32.t -> Real32.t;
+val rndToReal64 = _import "WordU32_rndToReal64" : Word32.t -> Real64.t;
 val rshift = _import "WordU32_rshift" : Word32.t * Word32.t -> Word32.t;
-val toReal32 = _import "WordU32_toReal32" : Word32.t -> Real32.t;
-val toReal64 = _import "WordU32_toReal64" : Word32.t -> Real64.t;
-val toWord16 = _import "WordU32_toWord16" : Word32.t -> Word16.t;
-val toWord32 = _import "WordU32_toWord32" : Word32.t -> Word32.t;
-val toWord64 = _import "WordU32_toWord64" : Word32.t -> Word64.t;
-val toWord8 = _import "WordU32_toWord8" : Word32.t -> Word8.t;
 end
 structure WordU64 = 
 struct
 val addCheckOverflows = _import "WordU64_addCheckOverflows" : Word64.t * Word64.t -> Bool.t;
+val extdToWord16 = _import "WordU64_extdToWord16" : Word64.t -> Word16.t;
+val extdToWord32 = _import "WordU64_extdToWord32" : Word64.t -> Word32.t;
+val extdToWord64 = _import "WordU64_extdToWord64" : Word64.t -> Word64.t;
+val extdToWord8 = _import "WordU64_extdToWord8" : Word64.t -> Word8.t;
 val ge = _import "WordU64_ge" : Word64.t * Word64.t -> Bool.t;
 val gt = _import "WordU64_gt" : Word64.t * Word64.t -> Bool.t;
 val le = _import "WordU64_le" : Word64.t * Word64.t -> Bool.t;
@@ -1394,17 +1344,17 @@
 val mulCheckOverflows = _import "WordU64_mulCheckOverflows" : Word64.t * Word64.t -> Bool.t;
 val quot = _import "WordU64_quot" : Word64.t * Word64.t -> Word64.t;
 val rem = _import "WordU64_rem" : Word64.t * Word64.t -> Word64.t;
+val rndToReal32 = _import "WordU64_rndToReal32" : Word64.t -> Real32.t;
+val rndToReal64 = _import "WordU64_rndToReal64" : Word64.t -> Real64.t;
 val rshift = _import "WordU64_rshift" : Word64.t * Word32.t -> Word64.t;
-val toReal32 = _import "WordU64_toReal32" : Word64.t -> Real32.t;
-val toReal64 = _import "WordU64_toReal64" : Word64.t -> Real64.t;
-val toWord16 = _import "WordU64_toWord16" : Word64.t -> Word16.t;
-val toWord32 = _import "WordU64_toWord32" : Word64.t -> Word32.t;
-val toWord64 = _import "WordU64_toWord64" : Word64.t -> Word64.t;
-val toWord8 = _import "WordU64_toWord8" : Word64.t -> Word8.t;
 end
 structure WordU8 = 
 struct
 val addCheckOverflows = _import "WordU8_addCheckOverflows" : Word8.t * Word8.t -> Bool.t;
+val extdToWord16 = _import "WordU8_extdToWord16" : Word8.t -> Word16.t;
+val extdToWord32 = _import "WordU8_extdToWord32" : Word8.t -> Word32.t;
+val extdToWord64 = _import "WordU8_extdToWord64" : Word8.t -> Word64.t;
+val extdToWord8 = _import "WordU8_extdToWord8" : Word8.t -> Word8.t;
 val ge = _import "WordU8_ge" : Word8.t * Word8.t -> Bool.t;
 val gt = _import "WordU8_gt" : Word8.t * Word8.t -> Bool.t;
 val le = _import "WordU8_le" : Word8.t * Word8.t -> Bool.t;
@@ -1413,13 +1363,9 @@
 val mulCheckOverflows = _import "WordU8_mulCheckOverflows" : Word8.t * Word8.t -> Bool.t;
 val quot = _import "WordU8_quot" : Word8.t * Word8.t -> Word8.t;
 val rem = _import "WordU8_rem" : Word8.t * Word8.t -> Word8.t;
+val rndToReal32 = _import "WordU8_rndToReal32" : Word8.t -> Real32.t;
+val rndToReal64 = _import "WordU8_rndToReal64" : Word8.t -> Real64.t;
 val rshift = _import "WordU8_rshift" : Word8.t * Word32.t -> Word8.t;
-val toReal32 = _import "WordU8_toReal32" : Word8.t -> Real32.t;
-val toReal64 = _import "WordU8_toReal64" : Word8.t -> Real64.t;
-val toWord16 = _import "WordU8_toWord16" : Word8.t -> Word16.t;
-val toWord32 = _import "WordU8_toWord32" : Word8.t -> Word32.t;
-val toWord64 = _import "WordU8_toWord64" : Word8.t -> Word64.t;
-val toWord8 = _import "WordU8_toWord8" : Word8.t -> Word8.t;
 end
 end
 end

Deleted: mlton/trunk/basis-library/primitive/check-pack-real.sml
===================================================================
--- mlton/trunk/basis-library/primitive/check-pack-real.sml	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/primitive/check-pack-real.sml	2007-06-19 21:49:40 UTC (rev 5657)
@@ -1,37 +0,0 @@
-(* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
- *    Jagannathan, and Stephen Weeks.
- * Copyright (C) 1997-2000 NEC Research Institute.
- *
- * MLton is released under a BSD-style license.
- * See the file MLton-LICENSE for details.
- *)
-
-local
-   fun 'a check (x: 'a, y: 'a) : unit = ()
-
-   local
-      structure PR1 = Primitive.PackReal32
-      structure PR2 = PrimitiveFFI.PackReal32
-   in
-      val () = check (PR1.subArr, PR2.subArr)
-      val () = check (PR1.subArrRev, PR2.subArrRev)
-      val () = check (PR1.subVec, PR2.subVec)
-      val () = check (PR1.subVecRev, PR2.subVecRev)
-      val () = check (PR1.update, PR2.update)
-      val () = check (PR1.updateRev, PR2.updateRev)
-   end
-
-   local
-      structure PR1 = Primitive.PackReal64
-      structure PR2 = PrimitiveFFI.PackReal64
-   in
-      val () = check (PR1.subArr, PR2.subArr)
-      val () = check (PR1.subArrRev, PR2.subArrRev)
-      val () = check (PR1.subVec, PR2.subVec)
-      val () = check (PR1.subVecRev, PR2.subVecRev)
-      val () = check (PR1.update, PR2.update)
-      val () = check (PR1.updateRev, PR2.updateRev)
-   end
-in
-
-end

Deleted: mlton/trunk/basis-library/primitive/check-pack-word.sml
===================================================================
--- mlton/trunk/basis-library/primitive/check-pack-word.sml	2007-06-19 20:21:32 UTC (rev 5656)
+++ mlton/trunk/basis-library/primitive/check-pack-word.sml	2007-06-19 21:49:40 UTC (rev 5657)
@@ -1,61 +0,0 @@
-(* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
- *    Jagannathan, and Stephen Weeks.
- * Copyright (C) 1997-2000 NEC Research Institute.
- *
- * MLton is released under a BSD-style license.
- * See the file MLton-LICENSE for details.
- *)
-
-local
-   fun 'a check (x: 'a, y: 'a) : unit = ()
-
-   local
-      structure PW1 = Primitive.PackWord8
-      structure PW2 = PrimitiveFFI.PackWord8
-   in
-      val () = check (PW1.subArr, PW2.subArr)
-      val () = check (PW1.subArrRev, PW2.subArrRev)
-      val () = check (PW1.subVec, PW2.subVec)
-      val () = check (PW1.subVecRev, PW2.subVecRev)
-      val () = check (PW1.update, PW2.update)
-      val () = check (PW1.updateRev, PW2.updateRev)
-   end
-
-   local
-      structure PW1 = Primitive.PackWord16
-      structure PW2 = PrimitiveFFI.PackWord16
-   in
-      val () = check (PW1.subArr, PW2.subArr)
-      val () = check (PW1.subArrRev, PW2.subArrRev)
-      val () = check (PW1.subVec, PW2.subVec)
-      val () = check (PW1.subVecRev, PW2.subVecRev)
-      val () = check (PW1.update, PW2.update)
-      val () = chec



More information about the MLton-commit mailing list