[MLton-commit] r4185

Matthew Fluet MLton@mlton.org
Tue, 8 Nov 2005 19:56:12 -0800


Added DEBUG_DFS_MARK control
----------------------------------------------------------------------

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/mark-compact.c

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

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/debug.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/debug.h	2005-11-09 03:17:04 UTC (rev 4184)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/debug.h	2005-11-09 03:56:08 UTC (rev 4185)
@@ -15,6 +15,7 @@
   DEBUG_CALL_STACK = FALSE,
   DEBUG_CARD_MARKING = FALSE,
   DEBUG_DETAILED = FALSE,
+  DEBUG_DFS_MARK = FALSE,
   DEBUG_ENTER_LEAVE = FALSE,
   DEBUG_GENERATIONAL = FALSE,
   DEBUG_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	2005-11-09 03:17:04 UTC (rev 4184)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/dfs-mark.c	2005-11-09 03:56:08 UTC (rev 4185)
@@ -76,7 +76,7 @@
    * nextHeader is the header of next.
    * todo is a pointer to the pointer inside cur that points to next.
    */
-  if (DEBUG_MARK_COMPACT)
+  if (DEBUG_DFS_MARK)
     fprintf (stderr, 
              "markNext"
              "  cur = "FMTPTR"  next = "FMTPTR
@@ -95,7 +95,7 @@
   prev = cur;
   cur = next;
 mark:
-  if (DEBUG_MARK_COMPACT)
+  if (DEBUG_DFS_MARK)
     fprintf (stderr, "mark  cur = "FMTPTR"  prev = "FMTPTR"  mode = %s\n",
              (uintptr_t)cur, (uintptr_t)prev,
              (mode == MARK_MODE) ? "mark" : "unmark");
@@ -130,7 +130,7 @@
     todo = cur + sizeofNumNonObjptrs (NORMAL_TAG, numNonObjptrs);
     index = 0;
 markInNormal:
-    if (DEBUG_MARK_COMPACT)
+    if (DEBUG_DFS_MARK)
       fprintf (stderr, "markInNormal  index = %"PRIu32"\n", index);
     assert (index < numObjptrs);
     // next = *(pointer*)todo;
@@ -186,7 +186,7 @@
     /* Skip to the first pointer. */
     todo += sizeofNumNonObjptrs (ARRAY_TAG, numNonObjptrs);
 markInArray:
-    if (DEBUG_MARK_COMPACT)
+    if (DEBUG_DFS_MARK)
       fprintf (stderr, "markInArray arrayIndex = %"PRIu32" index = %"PRIu32"\n",
                arrayIndex, index);
     assert (arrayIndex < getArrayLength (cur));
@@ -234,7 +234,7 @@
      * to be marked.
      */
     assert (getStackBottom (s, (GC_stack)cur) <= top);
-    if (DEBUG_MARK_COMPACT)
+    if (DEBUG_DFS_MARK)
       fprintf (stderr, "markInStack  top = %zu\n",
                (size_t)(top - getStackBottom (s, (GC_stack)cur)));
     if (top == getStackBottom (s, (GC_stack)(cur)))
@@ -252,7 +252,7 @@
     todo = top - frameLayout->size + frameOffsets [index + 1];
     // next = *(pointer*)todo;
     next = fetchObjptrToPointer (todo, s->heap.start);
-    if (DEBUG_MARK_COMPACT)
+    if (DEBUG_DFS_MARK)
       fprintf (stderr,
                "    offset %u  todo "FMTPTR"  next = "FMTPTR"\n",
                frameOffsets [index + 1],
@@ -278,7 +278,7 @@
    * Need to set the pointer in the prev object that pointed to cur 
    * to point back to prev, and restore prev.
    */
-  if (DEBUG_MARK_COMPACT)
+  if (DEBUG_DFS_MARK)
     fprintf (stderr, "return  cur = "FMTPTR"  prev = "FMTPTR"\n",
              (uintptr_t)cur, (uintptr_t)prev);
   assert (isPointerMarkedByMode (cur, mode));

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/mark-compact.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/mark-compact.c	2005-11-09 03:17:04 UTC (rev 4184)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/mark-compact.c	2005-11-09 03:56:08 UTC (rev 4185)
@@ -73,7 +73,7 @@
   if (WEAK_TAG == tag and 1 == numObjptrs) {
     GC_header objptrHeader;
     
-    if (DEBUG_WEAK)
+    if (DEBUG_MARK_COMPACT or DEBUG_WEAK)
       fprintf (stderr, "clearIfWeakAndUnmarkedForMarkCompact ("FMTPTR")  header = "FMTHDR"\n",
                (uintptr_t)p, header);
     objptrHeader = getHeader (objptrToPointer(((GC_weak)p)->objptr, s->heap.start));