[MLton-commit] r4187
Matthew Fluet
MLton@mlton.org
Wed, 9 Nov 2005 19:39:09 -0800
Fixed bug in mark-compact
----------------------------------------------------------------------
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/mark-compact.c
----------------------------------------------------------------------
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.h 2005-11-09 20:11:26 UTC (rev 4186)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.h 2005-11-10 03:39:08 UTC (rev 4187)
@@ -23,7 +23,7 @@
#define PRIxARRLEN PRIu32
#define FMTARRLEN "%"PRIxARRLEN
typedef GC_arrayLength GC_arrayCounter;
-#define GC_ARRAY_COUNTER_SIZE GC_ARRAY_LENGTH_SIZE
+#define GC_ARRAY_COUNTER_SIZE sizeof(GC_arrayCounter)
#define PRIxARRCTR PRIu32
#define FMTARRCTR "%"PRIxARRCTR
#define GC_ARRAY_HEADER_SIZE (GC_ARRAY_COUNTER_SIZE + GC_ARRAY_LENGTH_SIZE + GC_HEADER_SIZE)
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 20:11:26 UTC (rev 4186)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/mark-compact.c 2005-11-10 03:39:08 UTC (rev 4187)
@@ -128,6 +128,7 @@
fprintf (stderr, "threading "FMTPTR" of size %zu\n",
(uintptr_t)p, size);
if ((size_t)(front - endOfLastMarked) >= GC_ARRAY_HEADER_SIZE + OBJPTR_SIZE) {
+ pointer newArray = endOfLastMarked;
/* Compress all of the unmarked into one vector. We require
* (GC_ARRAY_HEADER_SIZE + OBJPTR_SIZE) space to be available
* because that is the smallest possible array. You cannot
@@ -141,11 +142,12 @@
fprintf (stderr, "compressing from "FMTPTR" to "FMTPTR" (length = %zu)\n",
(uintptr_t)endOfLastMarked, (uintptr_t)front,
(size_t)(front - endOfLastMarked));
- *((GC_arrayCounter*)(endOfLastMarked)) = 0;
- endOfLastMarked = endOfLastMarked + GC_ARRAY_COUNTER_SIZE;
- *((GC_arrayLength*)(endOfLastMarked)) = ((size_t)(front - endOfLastMarked)) - GC_ARRAY_HEADER_SIZE;
- endOfLastMarked = endOfLastMarked + GC_ARRAY_LENGTH_SIZE;
- *((GC_header*)(endOfLastMarked)) = GC_WORD8_VECTOR_HEADER;
+ *((GC_arrayCounter*)(newArray)) = 0;
+ newArray += GC_ARRAY_COUNTER_SIZE;
+ *((GC_arrayLength*)(newArray)) =
+ ((size_t)(front - endOfLastMarked)) - GC_ARRAY_HEADER_SIZE;
+ newArray += GC_ARRAY_LENGTH_SIZE;
+ *((GC_header*)(newArray)) = GC_WORD8_VECTOR_HEADER;
}
front += size;
endOfLastMarked = front;