[MLton-commit] r7443

Matthew Fluet fluet at mlton.org
Fri Mar 19 17:37:17 PST 2010


Ensure that minSize is page aligned.

Avoids assertions with sizeofCardMapAndCrossMap.
----------------------------------------------------------------------

U   mlton/trunk/runtime/gc/heap.c

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

Modified: mlton/trunk/runtime/gc/heap.c
===================================================================
--- mlton/trunk/runtime/gc/heap.c	2010-03-17 20:57:30 UTC (rev 7442)
+++ mlton/trunk/runtime/gc/heap.c	2010-03-20 01:37:16 UTC (rev 7443)
@@ -134,6 +134,7 @@
            uintmaxToCommaString(s->controls.maxHeap));
   }
   resSize = invertSizeofCardMapAndCrossMap (s, resWithMapsSize);
+  assert (isAligned (resSize, s->sysvals.pageSize));
   if (DEBUG_RESIZING)
     fprintf (stderr, "%s = sizeofHeapDesired (%s, %s)\n",
              uintmaxToCommaString(resSize),
@@ -395,6 +396,8 @@
   pointer origStart;
   size_t liveSize;
 
+  assert (isAligned (desiredSize, s->sysvals.pageSize));
+  assert (isAligned (minSize, s->sysvals.pageSize));
   assert (desiredSize >= s->heap.size);
   if (DEBUG_RESIZING or s->controls.messages) {
     fprintf (stderr,
@@ -516,7 +519,9 @@
              uintmaxToCommaString(minSize),
              uintmaxToCommaString(s->heap.size));
   desiredSize = sizeofHeapDesired (s, minSize, s->heap.size);
+  assert (isAligned (desiredSize, s->sysvals.pageSize));
   assert (minSize <= desiredSize);
+  minSize = align (minSize, s->sysvals.pageSize);
   if (desiredSize <= s->heap.size) {
     shrinkHeap (s, &s->heap, desiredSize);
   } else {




More information about the MLton-commit mailing list