[MLton-commit] r6568

Matthew Fluet fluet at mlton.org
Mon Apr 7 11:56:01 PDT 2008


Refactor active stack condition.

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

U   mlton/trunk/runtime/gc/forward.c

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

Modified: mlton/trunk/runtime/gc/forward.c
===================================================================
--- mlton/trunk/runtime/gc/forward.c	2008-04-07 18:55:59 UTC (rev 6567)
+++ mlton/trunk/runtime/gc/forward.c	2008-04-07 18:56:01 UTC (rev 6568)
@@ -60,15 +60,17 @@
                                          bytesNonObjptrs, numObjptrs);
       skip = 0;
     } else { /* Stack. */
+      bool active;
       GC_stack stack;
 
       assert (STACK_TAG == tag);
       headerBytes = GC_STACK_HEADER_SIZE;
       stack = (GC_stack)p;
+      active = getStackCurrent(s) == stack;
 
       size_t reservedMax, reservedShrink, reservedMin, reservedNew;
 
-      if (getStackCurrent(s) == stack) {
+      if (active) {
         /* Shrink active stacks. */
         reservedMax =
           (size_t)(s->controls.ratios.stackCurrentMaxReserved * stack->used);
@@ -96,8 +98,7 @@
        * grow the stack.  We cannot do any growing here because we may
        * run out of to space.
        */
-      assert (getStackCurrent(s) == stack
-              or reservedNew <= stack->reserved);
+      assert (active or reservedNew <= stack->reserved);
       if (reservedNew < stack->reserved) {
         if (DEBUG_STACKS or s->controls.messages)
           fprintf (stderr,




More information about the MLton-commit mailing list