[MLton-commit] r4576

Matthew Fluet MLton@mlton.org
Wed, 24 May 2006 06:29:31 -0700


Revert to r4571.

In 4575:

  In r4572:

    Calling translateHeap with s->heap.oldGenSize is incorrect, because
    when heapRemap fails and heapCreate succeeds, s->heap is updated with
    an newly initialized heap with oldGenSize == 0.  Instead, call
    translateHeap with size, which has the original oldGenSize.

  However, it seems that leaving the newly initialized heap with
  oldGenSize == 0 is incorrect, at it makes the heap appear to have no
  data.

These changes were due to a mistaken belief that the corresponding
changes in the x86_64 branch were also relevant in the trunk.  The
trunk revision of gc.c maintains the oldGenSize as a component of the
GC_state; hence, calling translateHeap with s->oldGenSize is correct.

In the x86_64 branch, each GC_heap maintains it's own oldGenSize and
nursery; normally, only the current heap (the heap component of
GC_state) matters at any given time, but in the situation above, the
newly created heap needs to have it's oldGenSize set to reflect the
fact that it gets a copy of the current heap and then becomes the new
current heap (for which the oldGenSize will matter).


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

U   mlton/trunk/runtime/gc.c

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

Modified: mlton/trunk/runtime/gc.c
===================================================================
--- mlton/trunk/runtime/gc.c	2006-05-24 12:28:01 UTC (rev 4575)
+++ mlton/trunk/runtime/gc.c	2006-05-24 13:29:31 UTC (rev 4576)
@@ -2826,7 +2826,6 @@
                 uint remaining;
                 pointer to;
 
-                h2.oldGenSize = size;
                 from = old + size;
                 to = h2.start + size;
                 remaining = size;
@@ -2888,7 +2887,7 @@
         }
 done:
         unless (old == s->heap.start) {
-                translateHeap (s, old, s->heap.start, size);
+                translateHeap (s, old, s->heap.start, s->oldGenSize);
                 setCardMapForMutator (s);
         }
 }