[MLton-commit] r4577

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


In r4571:

  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.

The commit message failed to note that it additionally set the newly
initialized heap's oldGenSize to size.  Leaving the newly initialized
heap with oldGenSize == 0 is incorrect, at it makes the heap appear to
have no data.  Once the newly initialized heap's oldGenSize is set
correctly, then it is acceptable to call translateHeap with
s->heap.oldGenSize.


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

U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c

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

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c	2006-05-24 13:29:31 UTC (rev 4576)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c	2006-05-24 13:36:35 UTC (rev 4577)
@@ -286,7 +286,6 @@
     pointer to;
     size_t remaining;
 
-    newHeap.oldGenSize = size;
     from = curHeapp->start + size;
     to = newHeap.start + size;
     remaining = size;
@@ -305,6 +304,7 @@
       goto copy;
     }
     releaseHeap (s, curHeapp);
+    newHeap.oldGenSize = size;
     *curHeapp = newHeap;
   } else {
     /* Write the heap to a file and try again. */
@@ -348,7 +348,7 @@
   }
 done:
   unless (orig == s->heap.start) {
-    translateHeap (s, orig, s->heap.start, size);
+    translateHeap (s, orig, s->heap.start, s->heap.oldGenSize);
     setCardMapAbsolute (s);
   }
 }