[MLton-commit] r4188

Matthew Fluet MLton@mlton.org
Wed, 9 Nov 2005 20:17:48 -0800


Discovered bug in the reinterpretation of crossMap as byte-offset
rather than word-offset.  Since the crossMap entry at s->heap.start is
the only object allowed to have an offset of 0, every other crossMap
entry for which an object falls on the card boundary yields a
CARD_SIZE offset, which conflicts with CROSS_MAP_ENTRY.

Haven't fixed the bug; I guess I'll go back to scaling the offset by
4.


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

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

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

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.c	2005-11-10 03:39:08 UTC (rev 4187)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.c	2005-11-10 04:17:46 UTC (rev 4188)
@@ -28,7 +28,8 @@
     fprintf (stderr, "crossMap trues\n");
     for (i = 0; i < generational->crossMapLength; i++)
       unless (CROSS_MAP_EMPTY == generational->crossMap[i])
-        fprintf (stderr, "\t"FMTCMI"\n", i);
+        fprintf (stderr, "\t"FMTCMI"  "FMTCME"\n", 
+                 i, generational->crossMap[i]);
     fprintf (stderr, "\n");
   }               
 }
@@ -215,6 +216,10 @@
   pointer nextObject, objectStart;
   pointer oldGenEnd;
   
+  if (DEBUG_GENERATIONAL) {
+    fprintf (stderr, "updateCrossMap starting\n");
+    displayGenerationalMaps (s, &s->generationalMaps, stderr);
+  }
   if (s->generationalMaps.crossMapValidSize == s->heap.oldGenSize)
     goto done;
   oldGenEnd = s->heap.start + s->heap.oldGenSize;
@@ -231,6 +236,17 @@
   assert ((objectStart == s->heap.start or cardStart < objectStart)
           and objectStart <= cardEnd);
   nextObject = objectStart + sizeofObject (s, advanceToObjectData (s, objectStart));
+  if (DEBUG_GENERATIONAL) {
+    fprintf (stderr, 
+             "\tloopObjects:\n"
+             "\t  cardIndex = "FMTCMI"\n"
+             "\t  cardStart = "FMTPTR"\n"
+             "\t    cardEnd = "FMTPTR"\n"
+             "\tobjectStart = "FMTPTR"\n"
+             "\t nextObject = "FMTPTR"\n",
+             cardIndex, (uintptr_t)cardStart, (uintptr_t)cardEnd,
+             (uintptr_t)objectStart, (uintptr_t)nextObject);
+  }
   if (nextObject > cardEnd) {
     /* We're about to move to a new card, so we are looking at the
      * last object boundary in the current card.  
@@ -257,4 +273,8 @@
 done:
   assert (s->generationalMaps.crossMapValidSize == s->heap.oldGenSize);
   assert (isCrossMapOk (s));
+  if (DEBUG_GENERATIONAL) {
+    fprintf (stderr, "updateCrossMap finished\n");
+    displayGenerationalMaps (s, &s->generationalMaps, stderr);
+  }
 }

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.h	2005-11-10 03:39:08 UTC (rev 4187)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.h	2005-11-10 04:17:46 UTC (rev 4188)
@@ -18,6 +18,7 @@
 #define CROSS_MAP_ELEM_SIZE sizeof(GC_crossMapElem)
 #define CROSS_MAP_EMPTY ((GC_crossMapElem)255)
 #define FMTCMI "%zu"
+#define FMTCME "%"PRIu8
 
 struct GC_generationalMaps {
   /* cardMap is an array with cardinality equal to the size of the