[MLton-commit] r5558

Matthew Fluet fluet at mlton.org
Wed May 16 08:26:51 PDT 2007


Change size of exnStack field to size_t.
Since exnStack is added to stackBottom (a pointer), keeping it the
same size as a pointer avoids the need for extension/truncation.

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

U   mlton/branches/on-20050822-x86_64-branch/mlton/ast/word-size.fun
U   mlton/branches/on-20050822-x86_64-branch/mlton/ast/word-size.sig
U   mlton/branches/on-20050822-x86_64-branch/mlton/backend/rep-type.fun
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/thread.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/thread.h

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

Modified: mlton/branches/on-20050822-x86_64-branch/mlton/ast/word-size.fun
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/mlton/ast/word-size.fun	2007-05-16 06:26:07 UTC (rev 5557)
+++ mlton/branches/on-20050822-x86_64-branch/mlton/ast/word-size.fun	2007-05-16 15:26:49 UTC (rev 5558)
@@ -35,7 +35,6 @@
 fun cpointer () = fromBits (Control.Target.Size.cpointer ())
 fun cptrdiff () = fromBits (Control.Target.Size.cptrdiff ())
 fun csize () = fromBits (Control.Target.Size.csize ())
-val exnStack = fromBits (Bits.fromInt 32)
 fun objptr () = fromBits (Control.Target.Size.objptr ())
 fun objptrHeader () = fromBits (Control.Target.Size.header ())
 fun seqIndex () = fromBits (Control.Target.Size.seqIndex ())
@@ -44,6 +43,7 @@
 val compareRes = fromBits (Bits.fromInt 32)
 val shiftArg = fromBits (Bits.fromInt 32)
 val word8 = fromBits (Bits.fromInt 8)
+val word16 = fromBits (Bits.fromInt 16)
 val word32 = fromBits (Bits.fromInt 32)
 val word64 = fromBits (Bits.fromInt 64)
 

Modified: mlton/branches/on-20050822-x86_64-branch/mlton/ast/word-size.sig
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/mlton/ast/word-size.sig	2007-05-16 06:26:07 UTC (rev 5557)
+++ mlton/branches/on-20050822-x86_64-branch/mlton/ast/word-size.sig	2007-05-16 15:26:49 UTC (rev 5558)
@@ -31,7 +31,6 @@
       val cptrdiff: unit -> t
       val csize: unit -> t
       val equals: t * t -> bool
-      val exnStack: t
       val fromBits: Bits.t -> t
       val isInRange: t * IntInf.t * {signed: bool} -> bool
       val max: t * {signed: bool} -> IntInf.t
@@ -48,6 +47,7 @@
       val smallIntInfWord: unit -> t
       val toString: t -> string
       val word8: t      
+      val word16: t
       val word32: t
       val word64: t
    end

Modified: mlton/branches/on-20050822-x86_64-branch/mlton/backend/rep-type.fun
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/mlton/backend/rep-type.fun	2007-05-16 06:26:07 UTC (rev 5557)
+++ mlton/branches/on-20050822-x86_64-branch/mlton/backend/rep-type.fun	2007-05-16 15:26:49 UTC (rev 5558)
@@ -83,7 +83,7 @@
          T {node = CPointer, width = WordSize.bits (WordSize.cpointer ())}
 
       val exnStack: unit -> t = fn () => 
-         T {node = ExnStack, width = WordSize.bits WordSize.exnStack}
+         T {node = ExnStack, width = WordSize.bits (WordSize.csize ())}
 
       val gcState: unit -> t = fn () => 
          T {node = GCState, width = WordSize.bits (WordSize.cpointer ())}

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h	2007-05-16 06:26:07 UTC (rev 5557)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h	2007-05-16 15:26:49 UTC (rev 5558)
@@ -17,7 +17,7 @@
   pointer limit; /* limit = heap.start + heap.size */
   pointer stackTop; /* Top of stack in current thread. */
   pointer stackLimit; /* stackBottom + stackSize - maxFrameSize */
-  uint32_t exnStack;
+  size_t exnStack;
   /* Alphabetized fields follow. */
   size_t alignment; /* */
   bool amInGC;

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/thread.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/thread.c	2007-05-16 06:26:07 UTC (rev 5557)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/thread.c	2007-05-16 15:26:49 UTC (rev 5558)
@@ -10,7 +10,7 @@
                     GC_thread thread, 
                     FILE *stream) {
   fprintf(stream,
-          "\t\texnStack = %"PRIu32"\n"
+          "\t\texnStack = %zu\n"
           "\t\tbytesNeeded = %zu\n"
           "\t\tstack = "FMTOBJPTR"\n",
           thread->exnStack,

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/thread.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/thread.h	2007-05-16 06:26:07 UTC (rev 5557)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/thread.h	2007-05-16 15:26:49 UTC (rev 5558)
@@ -14,7 +14,7 @@
  * header ::
  * padding ::
  * bytesNeeded (size_t) ::
- * exnStack (word32) ::
+ * exnStack (size_t) ::
  * stack (object-pointer)
  *
  * There may be zero or more bytes of padding for alignment purposes.
@@ -22,7 +22,7 @@
  * The bytesNeeded size_t is the number of bytes needed when returning
  * to this thread.
  *
- * The exnStack uint32_t is an offset added to stackBottom that
+ * The exnStack size_t is an offset added to stackBottom that
  * specifies the top of the exnStack.
  *
  * The final component is the stack object-pointer.
@@ -33,17 +33,17 @@
  */
 typedef struct GC_thread {
   size_t bytesNeeded;
-  uint32_t exnStack;
+  size_t exnStack;
   objptr stack;
 } __attribute__ ((packed)) *GC_thread;
 
 COMPILE_TIME_ASSERT(GC_thread__packed,
                     sizeof(struct GC_thread) ==
                     sizeof(size_t)
-                    + sizeof(uint32_t)
+                    + sizeof(size_t)
                     + sizeof(objptr));
 
-#define BOGUS_EXN_STACK 0xFFFFFFFF
+#define BOGUS_EXN_STACK ((size_t)(-1))
 
 #else
 




More information about the MLton-commit mailing list