[MLton-commit] r4212

Matthew Fluet MLton@mlton.org
Sat, 12 Nov 2005 12:28:26 -0800


Use uintmaxToCommaString
----------------------------------------------------------------------

U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/array-allocate.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/cheney-copy.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/forward.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/garbage-collection.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/hash-cons.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap_predicates.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/init.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/mark-compact.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/pack.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/translate.c

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

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/array-allocate.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/array-allocate.c	2005-11-12 20:11:58 UTC (rev 4211)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/array-allocate.c	2005-11-12 20:28:15 UTC (rev 4212)
@@ -28,17 +28,17 @@
     alignMax ((uintmax_t)bytesPerElement * (uintmax_t)numElements + GC_ARRAY_HEADER_SIZE,
               s->alignment);
   if (arraySizeMax >= (uintmax_t)SIZE_MAX)
-    die ("Out of memory: cannot allocate array with %"PRIuMAX" bytes.",
-         /*ullongToCommaString*/(arraySizeMax));
+    die ("Out of memory: cannot allocate array with %s bytes.",
+         uintmaxToCommaString(arraySizeMax));
   arraySize = (size_t)arraySizeMax;
   if (arraySize < GC_ARRAY_HEADER_SIZE + OBJPTR_SIZE)
     /* Create space for forwarding pointer. */
     arraySize = GC_ARRAY_HEADER_SIZE + OBJPTR_SIZE;
   if (DEBUG_ARRAY)
-    fprintf (stderr, "array with "FMTARRLEN" elts of size %zu and total size %zu.  Ensure %zu bytes free.\n",
+    fprintf (stderr, "array with "FMTARRLEN" elts of size %zu and total size %s.  Ensure %s bytes free.\n",
              numElements, bytesPerElement, 
-             /*uintToCommaString*/(arraySize),
-             /*uintToCommaString*/(ensureBytesFree));
+             uintmaxToCommaString(arraySize),
+             uintmaxToCommaString(ensureBytesFree));
   if (arraySize >= s->controls.oldGenArraySize) {
     if (not hasHeapBytesFree (s, arraySize, ensureBytesFree)) {
       enter (s);

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/cheney-copy.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/cheney-copy.c	2005-11-12 20:11:58 UTC (rev 4211)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/cheney-copy.c	2005-11-12 20:28:15 UTC (rev 4212)
@@ -58,12 +58,12 @@
   s->forwardState.toLimit = s->secondaryHeap.start + s->secondaryHeap.size;
   if (DEBUG or s->controls.messages) {
     fprintf (stderr, "Major copying GC.\n");
-    fprintf (stderr, "fromSpace = "FMTPTR" of size %zu\n",
+    fprintf (stderr, "fromSpace = "FMTPTR" of size %s\n",
              (uintptr_t) s->heap.start, 
-             /*uintToCommaString*/(s->heap.size));
-    fprintf (stderr, "toSpace = "FMTPTR" of size %zu\n",
+             uintmaxToCommaString(s->heap.size));
+    fprintf (stderr, "toSpace = "FMTPTR" of size %s\n",
              (uintptr_t) s->secondaryHeap.start, 
-             /*uintToCommaString*/(s->secondaryHeap.size));
+             uintmaxToCommaString(s->secondaryHeap.size));
   }
   assert (s->secondaryHeap.start != (pointer)NULL);
   /* The next assert ensures there is enough space for the copy to
@@ -80,8 +80,8 @@
   s->secondaryHeap.oldGenSize = s->forwardState.back - s->secondaryHeap.start;
   s->cumulativeStatistics.bytesCopied += s->secondaryHeap.oldGenSize;
   if (DEBUG)
-    fprintf (stderr, "%zu bytes live.\n",
-             /*uintToCommaString*/(s->secondaryHeap.oldGenSize));
+    fprintf (stderr, "%s bytes live.\n",
+             uintmaxToCommaString(s->secondaryHeap.oldGenSize));
   swapHeapsForCheneyCopy (s);
   clearCrossMap (s);
   s->lastMajorStatistics.kind = GC_COPYING;
@@ -140,7 +140,7 @@
     if (detailedGCTime (s))
       stopTiming (&ru_start, &s->cumulativeStatistics.ru_gcMinor);
     if (DEBUG_GENERATIONAL or s->controls.messages)
-      fprintf (stderr, "Minor GC done.  %zu bytes copied.\n",
-               /*uintToCommaString*/(bytesCopied));
+      fprintf (stderr, "Minor GC done.  %s bytes copied.\n",
+               uintmaxToCommaString(bytesCopied));
   }
 }

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/forward.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/forward.c	2005-11-12 20:11:58 UTC (rev 4211)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/forward.c	2005-11-12 20:28:15 UTC (rev 4212)
@@ -83,8 +83,8 @@
           if (new <= stack->reserved) {
             stack->reserved = new;
             if (DEBUG_STACKS)
-              fprintf (stderr, "Shrinking stack to size %zu.\n",
-                       /*uintToCommaString*/(stack->reserved));
+              fprintf (stderr, "Shrinking stack to size %s.\n",
+                       uintmaxToCommaString(stack->reserved));
           }
         }
       } else {
@@ -94,8 +94,8 @@
           (s, max((size_t)(s->controls.ratios.threadShrink * stack->reserved), 
                   stack->used));
         if (DEBUG_STACKS)
-          fprintf (stderr, "Shrinking stack to size %zu.\n",
-                   /*uintToCommaString*/(stack->reserved));
+          fprintf (stderr, "Shrinking stack to size %s.\n",
+                   uintmaxToCommaString(stack->reserved));
       }
       objectBytes = sizeof (struct GC_stack) + stack->used;
       skip = stack->reserved - stack->used;

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/garbage-collection.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/garbage-collection.c	2005-11-12 20:11:58 UTC (rev 4211)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/garbage-collection.c	2005-11-12 20:28:15 UTC (rev 4212)
@@ -53,8 +53,8 @@
 
   size = sizeofStackGrow (s, getStackCurrent(s));
   if (DEBUG_STACKS or s->controls.messages)
-    fprintf (stderr, "Growing stack to size %zu.\n",
-             /*uintToCommaString*/(sizeofStackWithHeaderAligned (s, size)));
+    fprintf (stderr, "Growing stack to size %s.\n",
+             uintmaxToCommaString(sizeofStackWithHeaderAligned (s, size)));
   assert (hasHeapBytesFree (s, sizeofStackWithHeaderAligned (s, size), 0));
   stack = newStack (s, size, TRUE);
   copyStack (s, getStackCurrent(s), stack);
@@ -97,9 +97,9 @@
         
   enterGC (s);
   if (DEBUG or s->controls.messages)
-    fprintf (stderr, "Starting gc.  Request %zu nursery bytes and %zu old gen bytes.\n",
-             /*uintToCommaString*/(nurseryBytesRequested),
-             /*uintToCommaString*/(oldGenBytesRequested));
+    fprintf (stderr, "Starting gc.  Request %s nursery bytes and %s old-gen bytes.\n",
+             uintmaxToCommaString(nurseryBytesRequested),
+             uintmaxToCommaString(oldGenBytesRequested));
   assert (invariantForGC (s));
   if (needGCTime (s))
     startTiming (&ru_start);
@@ -131,9 +131,9 @@
     gcTime = 0;  /* Assign gcTime to quell gcc warning. */
   if (DEBUG or s->controls.messages) {
     fprintf (stderr, "Finished gc.\n");
-    fprintf (stderr, "time: %"PRIuMAX" ms\n", /*intToCommaString*/(gcTime));
-    fprintf (stderr, "old gen size: %zu bytes (%.1f%%)\n", 
-             /*intToCommaString*/(s->heap.oldGenSize),
+    fprintf (stderr, "time: %s ms\n", uintmaxToCommaString(gcTime));
+    fprintf (stderr, "old gen size: %s bytes (%.1f%%)\n", 
+             uintmaxToCommaString(s->heap.oldGenSize),
              100.0 * ((double)(s->heap.oldGenSize) 
                       / (double)(s->heap.size)));
   }

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.c	2005-11-12 20:11:58 UTC (rev 4211)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.c	2005-11-12 20:28:15 UTC (rev 4212)
@@ -51,9 +51,9 @@
   size_t nurserySize;
 
   if (DEBUG_DETAILED)
-    fprintf (stderr, "setGCStateCurrentHeap(%zu, %zu)\n",
-             /*uintToCommaString*/(oldGenBytesRequested),
-             /*uintToCommaString*/(nurseryBytesRequested));
+    fprintf (stderr, "setGCStateCurrentHeap(%s, %s)\n",
+             uintmaxToCommaString(oldGenBytesRequested),
+             uintmaxToCommaString(nurseryBytesRequested));
   h = &s->heap;
   assert (isFrontierAligned (s, h->start + h->oldGenSize + oldGenBytesRequested));
   nurserySize = h->size - h->oldGenSize - oldGenBytesRequested;

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-12 20:11:58 UTC (rev 4211)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.c	2005-11-12 20:28:15 UTC (rev 4212)
@@ -134,8 +134,8 @@
 
   totalMapSize = cardMapSize + crossMapSize;
   if (DEBUG_MEM)
-    fprintf (stderr, "Creating card/cross map of size %zu\n",
-             /*uintToCommaString*/(totalMapSize));
+    fprintf (stderr, "Creating card/cross map of size %s\n",
+             uintmaxToCommaString(totalMapSize));
   s->generationalMaps.cardMap = 
     GC_mmapAnon_safe (NULL, totalMapSize);
   s->generationalMaps.crossMap = 

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	2005-11-12 20:11:58 UTC (rev 4211)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/hash-cons.c	2005-11-12 20:28:15 UTC (rev 4212)
@@ -288,8 +288,8 @@
 }
 
 void printBytesHashConsedMessage (GC_state s, uintmax_t total) {
-  fprintf (stderr, "%"PRIuMAX" bytes hash-consed (%.1f%%).\n",
-           /*ullongToCommaString*/(s->lastMajorStatistics.bytesHashConsed),
+  fprintf (stderr, "%s bytes hash-consed (%.1f%%).\n",
+           uintmaxToCommaString(s->lastMajorStatistics.bytesHashConsed),
            (100.0 
             * ((double)s->lastMajorStatistics.bytesHashConsed 
                / (double)total)));

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c	2005-11-12 20:11:58 UTC (rev 4211)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c	2005-11-12 20:28:15 UTC (rev 4212)
@@ -88,20 +88,20 @@
     else
       res = s->controls.fixedHeap / 2;
     if (res < live)
-      die ("Out of memory with fixed heap size %zu.",
-           /*uintToCommaString*/(s->controls.fixedHeap));
+      die ("Out of memory with fixed heap size %s.",
+           uintmaxToCommaString(s->controls.fixedHeap));
   } else if (s->controls.maxHeap > 0) {
     if (res > s->controls.maxHeap)
       res = s->controls.maxHeap;
     if (res < live)
-      die ("Out of memory with max heap size %zu.",
-           /*uintToCommaString*/(s->controls.maxHeap));
+      die ("Out of memory with max heap size %s.",
+           uintmaxToCommaString(s->controls.maxHeap));
   }
   if (DEBUG_RESIZING)
-    fprintf (stderr, "%zu = sizeofHeapDesired (%zu, %zu)\n",
-             /*uintToCommaString*/(res),
-             /*uintToCommaString*/(live),
-             /*uintToCommaString*/(currentSize));
+    fprintf (stderr, "%s = sizeofHeapDesired (%s, %s)\n",
+             uintmaxToCommaString(res),
+             uintmaxToCommaString(live),
+             uintmaxToCommaString(currentSize));
   assert (res >= live);
   return res;
 }
@@ -110,9 +110,9 @@
   if (NULL == h->start)
     return;
   if (DEBUG or s->controls.messages)
-    fprintf (stderr, "Releasing heap at "FMTPTR" of size %zu.\n",
+    fprintf (stderr, "Releasing heap at "FMTPTR" of size %s.\n",
              (uintptr_t)h->start,
-             /*uintToCommaString*/(h->size));
+             uintmaxToCommaString(h->size));
   GC_release (h->start, h->size);
   initHeap (s, h);
 }
@@ -127,10 +127,10 @@
   if (keep < h->size) {
     if (DEBUG or s->controls.messages)
       fprintf (stderr,
-               "Shrinking heap at "FMTPTR" of size %zu to %zu bytes.\n",
+               "Shrinking heap at "FMTPTR" of size %s to %s bytes.\n",
                (uintptr_t)h->start,
-               /*uintToCommaString*/(h->size),
-               /*uintToCommaString*/(keep));
+               uintmaxToCommaString(h->size),
+               uintmaxToCommaString(keep));
     GC_decommit (h->start + keep, h->size - keep);
     h->size = keep;
   }
@@ -150,9 +150,9 @@
   size_t backoff;
 
   if (DEBUG_MEM)
-    fprintf (stderr, "createHeap  desired size = %zu  min size = %zu\n",
-             /*uintToCommaString*/(desiredSize),
-             /*uintToCommaString*/(minSize));
+    fprintf (stderr, "createHeap  desired size = %s  min size = %s\n",
+             uintmaxToCommaString(desiredSize),
+             uintmaxToCommaString(minSize));
   assert (isHeapInit (h));
   if (desiredSize < minSize)
     desiredSize = minSize;
@@ -189,8 +189,8 @@
         if (h->size > s->cumulativeStatistics.maxHeapSizeSeen)
           s->cumulativeStatistics.maxHeapSizeSeen = h->size;
         if (DEBUG or s->controls.messages)
-          fprintf (stderr, "Created heap of size %zu at "FMTPTR".\n",
-                   /*uintToCommaString*/(h->size),
+          fprintf (stderr, "Created heap of size %s at "FMTPTR".\n",
+                   uintmaxToCommaString(h->size),
                    (uintptr_t)h->start);
         assert (h->size >= minSize);
         return TRUE;
@@ -269,10 +269,10 @@
   curHeapp = &s->heap;
   assert (desiredSize >= s->heap.size);
   if (DEBUG_RESIZING)
-    fprintf (stderr, "Growing heap at "FMTPTR" of size %zu to %zu bytes.\n",
+    fprintf (stderr, "Growing heap at "FMTPTR" of size %s to %s bytes.\n",
              (uintptr_t)s->heap.start,
-             /*uintToCommaString*/(s->heap.size),
-             /*uintToCommaString*/(desiredSize));
+             uintmaxToCommaString(s->heap.size),
+             uintmaxToCommaString(desiredSize));
   orig = curHeapp->start;
   size = curHeapp->oldGenSize;
   assert (size <= s->heap.size);
@@ -341,8 +341,8 @@
       unlink_safe (template);
       if (s->controls.messages)
         GC_displayMem ();
-      die ("Out of memory.  Unable to allocate %zu bytes.\n",
-           /*uintToCommaString*/(minSize));
+      die ("Out of memory.  Unable to allocate %s bytes.\n",
+           uintmaxToCommaString(minSize));
     }
   }
 done:
@@ -358,9 +358,9 @@
   size_t desiredSize;
 
   if (DEBUG_RESIZING)
-    fprintf (stderr, "resizeHeap  minSize = %zu  size = %zu\n",
-             /*ullongToCommaString*/(minSize), 
-             /*uintToCommaString*/(s->heap.size));
+    fprintf (stderr, "resizeHeap  minSize = %s  size = %s\n",
+             uintmaxToCommaString(minSize), 
+             uintmaxToCommaString(s->heap.size));
   desiredSize = sizeofHeapDesired (s, minSize, s->heap.size);
   assert (minSize <= desiredSize);
   if (desiredSize <= s->heap.size)

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap_predicates.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap_predicates.c	2005-11-12 20:11:58 UTC (rev 4211)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap_predicates.c	2005-11-12 20:28:15 UTC (rev 4212)
@@ -67,10 +67,10 @@
     (total <= s->heap.size) 
     and (nursery <= (size_t)(s->limitPlusSlop - s->frontier));
   if (DEBUG_DETAILED)
-    fprintf (stderr, "%s = hasBytesFree (%zu, %zu)\n",
+    fprintf (stderr, "%s = hasBytesFree (%s, %s)\n",
              boolToString (res),
-             /*uintToCommaString*/(oldGen),
-             /*uintToCommaString*/(nursery));
+             uintmaxToCommaString(oldGen),
+             uintmaxToCommaString(nursery));
   return res;
 }
 

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/init.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/init.c	2005-11-12 20:11:58 UTC (rev 4211)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/init.c	2005-11-12 20:28:15 UTC (rev 4212)
@@ -303,9 +303,9 @@
   s->sysvals.ram = align ((size_t)(s->controls.ratios.ramSlop * s->sysvals.totalRam), 
                           s->sysvals.pageSize);
   if (DEBUG or DEBUG_RESIZING or s->controls.messages)
-    fprintf (stderr, "total RAM = %zu  RAM = %zu\n",
-             /*uintToCommaString*/(s->sysvals.totalRam),
-             /*uintToCommaString*/(s->sysvals.ram));
+    fprintf (stderr, "total RAM = %s  RAM = %s\n",
+             uintmaxToCommaString(s->sysvals.totalRam),
+             uintmaxToCommaString(s->sysvals.ram));
   if (DEBUG_SOURCES or DEBUG_PROFILE) {
     uint32_t i;
     for (i = 0; i < s->sourceMaps.frameSourcesLength; i++) {

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-12 20:11:58 UTC (rev 4211)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/mark-compact.c	2005-11-12 20:28:15 UTC (rev 4212)
@@ -286,9 +286,9 @@
   s->cumulativeStatistics.numMarkCompactGCs++;
   if (DEBUG or s->controls.messages) {
     fprintf (stderr, "Major mark-compact GC.\n");
-    fprintf (stderr, "heap = "FMTPTR" of size %zu\n",
+    fprintf (stderr, "heap = "FMTPTR" of size %s\n",
              (uintptr_t) s->heap.start, 
-             /*uintToCommaString*/(s->heap.size));
+             uintmaxToCommaString(s->heap.size));
   }
   if (s->hashConsDuringGC) {
     s->lastMajorStatistics.bytesHashConsed = 0;

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/pack.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/pack.c	2005-11-12 20:11:58 UTC (rev 4211)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/pack.c	2005-11-12 20:28:15 UTC (rev 4212)
@@ -11,8 +11,8 @@
 
   enter (s);
   if (DEBUG or s->controls.messages)
-    fprintf (stderr, "Packing heap of size %zu.\n",
-             /*uintToCommaString*/(s->heap.size));
+    fprintf (stderr, "Packing heap of size %s.\n",
+             uintmaxToCommaString(s->heap.size));
   /* Could put some code here to skip the GC if there hasn't been much
    * allocated since the last collection.  But you would still need to
    * do a minor GC to make all objects contiguous.
@@ -26,16 +26,16 @@
   }
   releaseHeap (s, &s->secondaryHeap);
   if (DEBUG or s->controls.messages)
-    fprintf (stderr, "Packed heap to size %zu.\n",
-             /*uintToCommaString*/(s->heap.size));
+    fprintf (stderr, "Packed heap to size %s.\n",
+             uintmaxToCommaString(s->heap.size));
   leave (s);
 }
 
 void GC_unpack (GC_state s) {
   enter (s);
   if (DEBUG or s->controls.messages)
-    fprintf (stderr, "Unpacking heap of size %zu.\n",
-             /*uintToCommaString*/(s->heap.size));
+    fprintf (stderr, "Unpacking heap of size %s.\n",
+             uintmaxToCommaString(s->heap.size));
   /* The enterGC is needed here because minorGC and resizeHeap might
    * move the stack, and the SIGPROF catcher would then see a bogus
    * stack.  The leaveGC has to happen after the setStack.
@@ -48,7 +48,7 @@
   setGCStateCurrentThreadAndStack (s);
   leaveGC (s);
   if (DEBUG or s->controls.messages)
-    fprintf (stderr, "Unpacked heap to size %zu.\n",
-             /*uintToCommaString*/(s->heap.size));
+    fprintf (stderr, "Unpacked heap to size %s.\n",
+             uintmaxToCommaString(s->heap.size));
   leave (s);
 }

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/translate.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/translate.c	2005-11-12 20:11:58 UTC (rev 4211)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/translate.c	2005-11-12 20:28:15 UTC (rev 4212)
@@ -31,8 +31,8 @@
   pointer limit;
 
   if (DEBUG or s->controls.messages)
-    fprintf (stderr, "Translating heap of size %zu from "FMTPTR" to "FMTPTR".\n",
-             /*uintToCommaString*/(size),
+    fprintf (stderr, "Translating heap of size %s from "FMTPTR" to "FMTPTR".\n",
+             uintmaxToCommaString(size),
              (uintptr_t)from, (uintptr_t)to);
   if (from == to)
     return;