[MLton-commit] r4402

Matthew Fluet MLton@mlton.org
Sun, 23 Apr 2006 20:37:45 -0700


Merge trunk revisions r4397:4400 into x86_64 branch
----------------------------------------------------------------------

U   mlton/branches/on-20050822-x86_64-branch/doc/changelog
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/debug.h
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/dfs-mark.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.h
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/hash-cons.c

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

Modified: mlton/branches/on-20050822-x86_64-branch/doc/changelog
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/doc/changelog	2006-04-24 03:15:53 UTC (rev 4401)
+++ mlton/branches/on-20050822-x86_64-branch/doc/changelog	2006-04-24 03:37:43 UTC (rev 4402)
@@ -1,3 +1,10 @@
+Here are the changes since version 20051202.
+
+* 2006-04-19
+  - Fixed a bug in MLton.share that could cause a segfault.
+
+--------------------------------------------------------------------------------
+
 Here are the changes from version 20041109 to version 20051202.
 
 Summary:

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/debug.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/debug.h	2006-04-24 03:15:53 UTC (rev 4401)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/debug.h	2006-04-24 03:37:43 UTC (rev 4402)
@@ -32,6 +32,6 @@
   DEBUG_THREADS = FALSE,
   DEBUG_WEAK = FALSE,
   DEBUG_WORLD = FALSE,
-  FORCE_GENERATIONAL = FALSE,
+  FORCE_GENERATIONAL = TRUE,
   FORCE_MARK_COMPACT = FALSE,
 };

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/dfs-mark.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/dfs-mark.c	2006-04-24 03:15:53 UTC (rev 4401)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/dfs-mark.c	2006-04-24 03:37:43 UTC (rev 4402)
@@ -301,6 +301,8 @@
     prev = fetchObjptrToPointer (todo, s->heap.start);
     // *(pointer*)todo = next;
     storeObjptrFromPointer (todo, next, s->heap.start);
+    if (shouldHashCons)
+      markIntergenerationalPointer (s, (pointer*)todo);
     goto markNextInNormal;
   } else if (ARRAY_TAG == tag) {
     arrayIndex = getArrayCounter (cur);
@@ -311,6 +313,8 @@
     prev = fetchObjptrToPointer (todo, s->heap.start);
     // *(pointer*)todo = next;
     storeObjptrFromPointer (todo, next, s->heap.start);
+    if (shouldHashCons)
+      markIntergenerationalPointer (s, (pointer*)todo);
     goto markNextInArray;
   } else {
     assert (STACK_TAG == tag);
@@ -325,6 +329,8 @@
     prev = fetchObjptrToPointer (todo, s->heap.start);
     // *(pointer*)todo = next;
     storeObjptrFromPointer (todo, next, s->heap.start);
+    if (shouldHashCons)
+      markIntergenerationalPointer (s, (pointer*)todo);
     index++;
     goto markInFrame;
   }

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.c	2006-04-24 03:15:53 UTC (rev 4401)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.c	2006-04-24 03:37:43 UTC (rev 4402)
@@ -65,6 +65,20 @@
     *(pointerToCardMapAddr (s, p)) = 0x1;
 }
 
+void markIntergenerationalPointer (GC_state s, pointer *pp) {
+  if (s->mutatorMarksCards
+      and isPointerInOldGen (s, (pointer)pp)
+      and isPointerInNursery (s, *pp))
+    markCard (s, (pointer)pp);
+}
+
+void markIntergenerationalObjptr (GC_state s, objptr *opp) {
+  if (s->mutatorMarksCards
+      and isPointerInOldGen (s, (pointer)opp)
+      and isObjptrInNursery (s, *opp))
+    markCard (s, (pointer)opp);
+}
+
 void setCardMapAbsolute (GC_state s) {
   unless (s->mutatorMarksCards)
     return;

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.h	2006-04-24 03:15:53 UTC (rev 4401)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.h	2006-04-24 03:37:43 UTC (rev 4402)
@@ -63,6 +63,8 @@
 
 static inline bool isCardMarked (GC_state s, pointer p);
 static inline void markCard (GC_state s, pointer p);
+static inline void markIntergenerationalPointer (GC_state s, pointer *pp);
+static inline void markIntergenerationalObjptr (GC_state s, objptr *opp);
 
 static inline void setCardMapAbsolute (GC_state s);
 static inline pointer getCrossMapCardStart (GC_state s, pointer p);

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/hash-cons.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/hash-cons.c	2006-04-24 03:15:53 UTC (rev 4401)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/hash-cons.c	2006-04-24 03:37:43 UTC (rev 4402)
@@ -236,7 +236,7 @@
   pointer res;
 
   if (DEBUG_SHARE)
-    fprintf (stderr, "hashCons ("FMTPTR")\n", (uintptr_t)object);
+    fprintf (stderr, "hashConsPointer ("FMTPTR")\n", (uintptr_t)object);
   t = s->objectHashTable;
   header = getHeader (object);
   splitHeader(s, header, &tag, &hasIdentity, &bytesNonObjptrs, &numObjptrs);
@@ -281,10 +281,11 @@
   
   p = objptrToPointer (*opp, s->heap.start);
   if (DEBUG_SHARE)
-    fprintf (stderr, "shareObjptrMaybe  opp = "FMTPTR"  *opp = "FMTOBJPTR"\n",
+    fprintf (stderr, "shareObjptr  opp = "FMTPTR"  *opp = "FMTOBJPTR"\n",
              (uintptr_t)opp, *opp);
   p = hashConsPointer (s, p, FALSE);
   *opp = pointerToObjptr (p, s->heap.start);
+  markIntergenerationalObjptr (s, opp);
 }
 
 void printBytesHashConsedMessage (GC_state s, uintmax_t total) {