[MLton-commit] r5887
Ville Laurikari
ville at mlton.org
Fri Aug 17 11:08:47 PDT 2007
Replaced occurrences of %zu in printf format strings with "%"PRIuMAX
and cast the corresponding arguments to uintmax_t. There appear to be
no more uses of %z left.
Also updated copyright years and removed trailing whitespace in the
files I touched.
----------------------------------------------------------------------
U mlton/trunk/runtime/gc/array-allocate.c
U mlton/trunk/runtime/gc/dfs-mark.c
U mlton/trunk/runtime/gc/forward.c
U mlton/trunk/runtime/gc/generational.c
U mlton/trunk/runtime/gc/heap.c
U mlton/trunk/runtime/gc/init-world.c
U mlton/trunk/runtime/gc/int-inf.c
U mlton/trunk/runtime/gc/mark-compact.c
U mlton/trunk/runtime/gc/new-object.c
U mlton/trunk/runtime/gc/profiling.c
U mlton/trunk/runtime/gc/stack.c
U mlton/trunk/runtime/gc/switch-thread.c
U mlton/trunk/runtime/gc/thread.c
U mlton/trunk/runtime/gc/virtual-memory.c
U mlton/trunk/runtime/gc/weak.c
U mlton/trunk/runtime/gc/world.c
U mlton/trunk/runtime/gen/gen-sizes.c
U mlton/trunk/runtime/platform.c
U mlton/trunk/runtime/util/to-string.c
----------------------------------------------------------------------
Modified: mlton/trunk/runtime/gc/array-allocate.c
===================================================================
--- mlton/trunk/runtime/gc/array-allocate.c 2007-08-17 04:00:18 UTC (rev 5886)
+++ mlton/trunk/runtime/gc/array-allocate.c 2007-08-17 18:08:44 UTC (rev 5887)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
+/* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
*
@@ -6,9 +6,9 @@
* See the file MLton-LICENSE for details.
*/
-pointer GC_arrayAllocate (GC_state s,
- size_t ensureBytesFree,
- GC_arrayLength numElements,
+pointer GC_arrayAllocate (GC_state s,
+ size_t ensureBytesFree,
+ GC_arrayLength numElements,
GC_header header) {
uintmax_t arraySizeMax, arraySizeAlignedMax;
size_t arraySize, arraySizeAligned;
@@ -21,8 +21,8 @@
splitHeader(s, header, NULL, NULL, &bytesNonObjptrs, &numObjptrs);
if (DEBUG)
- fprintf (stderr, "GC_arrayAllocate (%zu, "FMTARRLEN", "FMTHDR")\n",
- ensureBytesFree, numElements, header);
+ fprintf (stderr, "GC_arrayAllocate (%"PRIuMAX", "FMTARRLEN", "FMTHDR")\n",
+ (uintmax_t)ensureBytesFree, numElements, header);
bytesPerElement = bytesNonObjptrs + (numObjptrs * OBJPTR_SIZE);
arraySizeMax =
(uintmax_t)bytesPerElement * (uintmax_t)numElements + GC_ARRAY_HEADER_SIZE;
@@ -40,10 +40,10 @@
arraySizeAligned = align(GC_ARRAY_HEADER_SIZE + OBJPTR_SIZE, s->alignment);
}
if (DEBUG_ARRAY)
- fprintf (stderr,
- "Array with "FMTARRLEN" elts of size %zu and total size %s and total aligned size %s. "
+ fprintf (stderr,
+ "Array with "FMTARRLEN" elts of size %"PRIuMAX" and total size %s and total aligned size %s. "
"Ensure %s bytes free.\n",
- numElements, bytesPerElement,
+ numElements, (uintmax_t)bytesPerElement,
uintmaxToCommaString(arraySize),
uintmaxToCommaString(arraySizeAligned),
uintmaxToCommaString(ensureBytesFree));
@@ -116,4 +116,4 @@
* to reflect what the mutator did with stackTop.
*/
return result;
-}
+}
Modified: mlton/trunk/runtime/gc/dfs-mark.c
===================================================================
--- mlton/trunk/runtime/gc/dfs-mark.c 2007-08-17 04:00:18 UTC (rev 5886)
+++ mlton/trunk/runtime/gc/dfs-mark.c 2007-08-17 18:08:44 UTC (rev 5887)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
+/* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
*
@@ -25,9 +25,9 @@
}
}
-/* dfsMarkByMode (s, r, m, shc)
+/* dfsMarkByMode (s, r, m, shc)
*
- * Sets all the mark bits in the object graph pointed to by r.
+ * Sets all the mark bits in the object graph pointed to by r.
*
* If m is MARK_MODE, it sets the bits to 1.
* If m is UNMARK_MODE, it sets the bits to 0.
@@ -54,7 +54,7 @@
GC_header* nextHeaderp;
GC_arrayCounter arrayIndex;
pointer top; /* The top of the next stack frame to mark. */
- GC_returnAddress returnAddress;
+ GC_returnAddress returnAddress;
GC_frameLayout frameLayout;
GC_frameOffsets frameOffsets;
@@ -67,7 +67,7 @@
prev = NULL;
headerp = getHeaderp (cur);
header = *headerp;
- goto mark;
+ goto mark;
markNext:
/* cur is the object that was being marked.
* prev is the mark stack.
@@ -77,11 +77,11 @@
* todo is a pointer to the pointer inside cur that points to next.
*/
if (DEBUG_DFS_MARK)
- fprintf (stderr,
+ fprintf (stderr,
"markNext"
" cur = "FMTPTR" next = "FMTPTR
" prev = "FMTPTR" todo = "FMTPTR"\n",
- (uintptr_t)cur, (uintptr_t)next,
+ (uintptr_t)cur, (uintptr_t)next,
(uintptr_t)prev, (uintptr_t)todo);
assert (not isPointerMarkedByMode (next, mode));
assert (nextHeaderp == getHeaderp (next));
@@ -99,7 +99,7 @@
fprintf (stderr, "mark cur = "FMTPTR" prev = "FMTPTR" mode = %s\n",
(uintptr_t)cur, (uintptr_t)prev,
(mode == MARK_MODE) ? "mark" : "unmark");
- /* cur is the object to mark.
+ /* cur is the object to mark.
* prev is the mark stack.
* headerp points to the header of cur.
* header is the header of cur.
@@ -116,9 +116,9 @@
*headerp = header;
splitHeader (s, header, &tag, NULL, &bytesNonObjptrs, &numObjptrs);
if (NORMAL_TAG == tag) {
- size +=
- GC_NORMAL_HEADER_SIZE
- + bytesNonObjptrs
+ size +=
+ GC_NORMAL_HEADER_SIZE
+ + bytesNonObjptrs
+ (numObjptrs * OBJPTR_SIZE);
if (0 == numObjptrs) {
/* There is nothing to mark. */
@@ -167,7 +167,7 @@
* (i.e. the i'th pointer is at index i).
* todo is the start of the element.
*/
- size +=
+ size +=
GC_ARRAY_HEADER_SIZE
+ sizeofArrayNoHeader (s, getArrayLength (cur), bytesNonObjptrs, numObjptrs);
if (0 == numObjptrs or 0 == getArrayLength (cur)) {
@@ -224,7 +224,7 @@
goto markNext;
} else {
assert (STACK_TAG == tag);
- size +=
+ size +=
GC_STACK_HEADER_SIZE
+ sizeof (struct GC_stack) + ((GC_stack)cur)->reserved;
top = getStackTop (s, (GC_stack)cur);
@@ -235,8 +235,8 @@
*/
assert (getStackBottom (s, (GC_stack)cur) <= top);
if (DEBUG_DFS_MARK)
- fprintf (stderr, "markInStack top = %zu\n",
- (size_t)(top - getStackBottom (s, (GC_stack)cur)));
+ fprintf (stderr, "markInStack top = %"PRIuMAX"\n",
+ (uintmax_t)(top - getStackBottom (s, (GC_stack)cur)));
if (top == getStackBottom (s, (GC_stack)(cur)))
goto ret;
objptrIndex = 0;
@@ -275,7 +275,7 @@
assert (FALSE);
ret:
/* Done marking cur, continue with prev.
- * Need to set the pointer in the prev object that pointed to cur
+ * Need to set the pointer in the prev object that pointed to cur
* to point back to prev, and restore prev.
*/
if (DEBUG_DFS_MARK)
Modified: mlton/trunk/runtime/gc/forward.c
===================================================================
--- mlton/trunk/runtime/gc/forward.c 2007-08-17 04:00:18 UTC (rev 5886)
+++ mlton/trunk/runtime/gc/forward.c 2007-08-17 18:08:44 UTC (rev 5887)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
+/* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
*
@@ -20,9 +20,9 @@
return isPointerInToSpace (s, p);
}
-/* forward (s, opp)
+/* forward (s, opp)
* Forwards the object pointed to by *opp and updates *opp to point to
- * the new object.
+ * the new object.
* It also updates the crossMap.
*/
void forwardObjptr (GC_state s, objptr *opp) {
@@ -55,7 +55,7 @@
skip = 0;
} else if (ARRAY_TAG == tag) {
headerBytes = GC_ARRAY_HEADER_SIZE;
- objectBytes = sizeofArrayNoHeader (s, getArrayLength (p),
+ objectBytes = sizeofArrayNoHeader (s, getArrayLength (p),
bytesNonObjptrs, numObjptrs);
skip = 0;
} else { /* Stack. */
@@ -70,9 +70,9 @@
* but don't violate the stack invariant.
*/
if (stack->used <= stack->reserved / 4) {
- size_t new =
+ size_t new =
alignStackReserved
- (s, max (stack->reserved / 2,
+ (s, max (stack->reserved / 2,
sizeofStackMinimumReserved (s, stack)));
/* It's possible that new > stack->reserved if the stack
* invariant is violated. In that case, we want to leave the
@@ -89,9 +89,9 @@
}
} else {
/* Shrink heap stacks. */
- stack->reserved =
- alignStackReserved
- (s, max((size_t)(s->controls.ratios.threadShrink * stack->reserved),
+ stack->reserved =
+ alignStackReserved
+ (s, max((size_t)(s->controls.ratios.threadShrink * stack->reserved),
stack->used));
if (DEBUG_STACKS)
fprintf (stderr, "Shrinking stack to size %s.\n",
@@ -128,11 +128,11 @@
}
/* Store the forwarding pointer in the old object. */
*((GC_header*)(p - GC_HEADER_SIZE)) = GC_FORWARDED;
- *((objptr*)p) = pointerToObjptr (s->forwardState.back + headerBytes,
+ *((objptr*)p) = pointerToObjptr (s->forwardState.back + headerBytes,
s->forwardState.toStart);
/* Update the back of the queue. */
s->forwardState.back += size + skip;
- assert (isAligned ((size_t)s->forwardState.back + GC_NORMAL_HEADER_SIZE,
+ assert (isAligned ((size_t)s->forwardState.back + GC_NORMAL_HEADER_SIZE,
s->alignment));
}
*opp = *((objptr*)p);
@@ -189,19 +189,19 @@
goto done;
checkCard:
if (DEBUG_GENERATIONAL)
- fprintf (stderr, "checking card %zu objectStart = "FMTPTR"\n",
- cardIndex, (uintptr_t)objectStart);
+ fprintf (stderr, "checking card %"PRIuMAX" objectStart = "FMTPTR"\n",
+ (uintmax_t)cardIndex, (uintptr_t)objectStart);
assert (objectStart < oldGenStart + cardMapIndexToSize (cardIndex + 1));
if (cardMap[cardIndex]) {
pointer lastObject;
s->cumulativeStatistics.markedCards++;
if (DEBUG_GENERATIONAL)
- fprintf (stderr, "card %zu is marked objectStart = "FMTPTR"\n",
- cardIndex, (uintptr_t)objectStart);
+ fprintf (stderr, "card %"PRIuMAX" is marked objectStart = "FMTPTR"\n",
+ (uintmax_t)cardIndex, (uintptr_t)objectStart);
assert (isFrontierAligned (s, objectStart));
cardEnd = cardStart + CARD_SIZE;
- if (oldGenEnd < cardEnd)
+ if (oldGenEnd < cardEnd)
cardEnd = oldGenEnd;
assert (objectStart < cardEnd);
lastObject = objectStart;
@@ -211,7 +211,7 @@
* Weak.set, the foreachObjptrInRange will do the right thing on
* weaks, since the weak pointer will never be into the nursery.
*/
- objectStart = foreachObjptrInRange (s, objectStart, &cardEnd,
+ objectStart = foreachObjptrInRange (s, objectStart, &cardEnd,
forwardObjptrIfInNursery, FALSE);
s->cumulativeStatistics.minorBytesScanned += objectStart - lastObject;
if (objectStart == oldGenEnd)
@@ -223,12 +223,12 @@
unless (CROSS_MAP_EMPTY == crossMap[cardIndex])
objectStart = cardStart + (size_t)(crossMap[cardIndex] * CROSS_MAP_OFFSET_SCALE);
if (DEBUG_GENERATIONAL)
- fprintf (stderr,
- "card %zu is not marked"
- " crossMap[%zu] == %zu"
- " objectStart = "FMTPTR"\n",
- cardIndex, cardIndex,
- (size_t)(crossMap[cardIndex] * CROSS_MAP_OFFSET_SCALE),
+ fprintf (stderr,
+ "card %"PRIuMAX" is not marked"
+ " crossMap[%"PRIuMAX"] == %"PRIuMAX""
+ " objectStart = "FMTPTR"\n",
+ (uintmax_t)cardIndex, (uintmax_t)cardIndex,
+ (uintmax_t)(crossMap[cardIndex] * CROSS_MAP_OFFSET_SCALE),
(uintptr_t)objectStart);
cardIndex++;
cardStart += CARD_SIZE;
Modified: mlton/trunk/runtime/gc/generational.c
===================================================================
--- mlton/trunk/runtime/gc/generational.c 2007-08-17 04:00:18 UTC (rev 5886)
+++ mlton/trunk/runtime/gc/generational.c 2007-08-17 18:08:44 UTC (rev 5887)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
+/* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
*
@@ -12,27 +12,27 @@
fprintf(stream,
"\t\tcardMap = "FMTPTR"\n"
"\t\tcardMapAbsolute = "FMTPTR"\n"
- "\t\tcardMapLength = %zu\n"
+ "\t\tcardMapLength = %"PRIuMAX"\n"
"\t\tcrossMap = "FMTPTR"\n"
- "\t\tcrossMapLength = %zu\n"
- "\t\tcrossMapValidSize = %zu\n",
- (uintptr_t)generational->cardMap,
+ "\t\tcrossMapLength = %"PRIuMAX"\n"
+ "\t\tcrossMapValidSize = %"PRIuMAX"\n",
+ (uintptr_t)generational->cardMap,
(uintptr_t)generational->cardMapAbsolute,
- generational->cardMapLength,
+ (uintmax_t)generational->cardMapLength,
(uintptr_t)generational->crossMap,
- generational->crossMapLength,
- generational->crossMapValidSize);
+ (uintmax_t)generational->crossMapLength,
+ (uintmax_t)generational->crossMapValidSize);
if (DEBUG_GENERATIONAL and DEBUG_DETAILED) {
GC_crossMapIndex i;
fprintf (stderr, "crossMap trues\n");
for (i = 0; i < generational->crossMapLength; i++)
unless (CROSS_MAP_EMPTY == generational->crossMap[i])
- fprintf (stderr, "\t"FMTCMI" "FMTCME" "FMTCME"\n",
+ fprintf (stderr, "\t"FMTCMI" "FMTCME" "FMTCME"\n",
i, generational->crossMap[i],
CROSS_MAP_OFFSET_SCALE * generational->crossMap[i]);
fprintf (stderr, "\n");
- }
+ }
}
GC_cardMapIndex pointerToCardMapIndexAbsolute (pointer p) {
@@ -86,7 +86,7 @@
* subsequent additions to mark the cards will overflow and put us
* in the right place.
*/
- s->generationalMaps.cardMapAbsolute =
+ s->generationalMaps.cardMapAbsolute =
s->generationalMaps.cardMap
- pointerToCardMapIndexAbsolute (s->heap.start);
if (DEBUG_CARD_MARKING)
@@ -98,7 +98,7 @@
/* The p - 1 is so that a pointer to the beginning of a card falls
* into the index for the previous crossMap entry.
*/
- return
+ return
(p == s->heap.start)
? s->heap.start
: (p - 1) - ((uintptr_t)(p - 1) % CARD_SIZE);
@@ -107,7 +107,7 @@
void clearCardMap (GC_state s) {
if (DEBUG_GENERATIONAL and DEBUG_DETAILED)
fprintf (stderr, "clearCardMap ()\n");
- memset (s->generationalMaps.cardMap, 0,
+ memset (s->generationalMaps.cardMap, 0,
s->generationalMaps.cardMapLength * CARD_MAP_ELEM_SIZE);
}
@@ -115,7 +115,7 @@
if (DEBUG_GENERATIONAL and DEBUG_DETAILED)
fprintf (stderr, "clearCrossMap ()\n");
s->generationalMaps.crossMapValidSize = 0;
- memset (s->generationalMaps.crossMap, CROSS_MAP_EMPTY,
+ memset (s->generationalMaps.crossMap, CROSS_MAP_EMPTY,
s->generationalMaps.crossMapLength * CROSS_MAP_ELEM_SIZE);
}
@@ -150,9 +150,9 @@
if (DEBUG_MEM)
fprintf (stderr, "Creating card/cross map of size %s\n",
uintmaxToCommaString(totalMapSize));
- s->generationalMaps.cardMap =
+ s->generationalMaps.cardMap =
GC_mmapAnon_safe (NULL, totalMapSize);
- s->generationalMaps.crossMap =
+ s->generationalMaps.crossMap =
(s->generationalMaps.cardMap + (cardMapSize / CARD_MAP_ELEM_SIZE));
if (DEBUG_CARD_MARKING)
fprintf (stderr, "cardMap = "FMTPTR" crossMap = "FMTPTR"\n",
@@ -178,7 +178,7 @@
oldCrossMapSize = s->generationalMaps.crossMapLength * CROSS_MAP_ELEM_SIZE;
createCardMapAndCrossMap (s);
GC_memcpy ((pointer)oldCrossMap, (pointer)s->generationalMaps.crossMap,
- min (s->generationalMaps.crossMapLength * CROSS_MAP_ELEM_SIZE,
+ min (s->generationalMaps.crossMapLength * CROSS_MAP_ELEM_SIZE,
oldCrossMapSize));
if (DEBUG_MEM)
fprintf (stderr, "Releasing card/cross map.\n");
@@ -255,7 +255,7 @@
and objectStart <= cardEnd);
nextObject = objectStart + sizeofObject (s, advanceToObjectData (s, objectStart));
if (DEBUG_GENERATIONAL) {
- fprintf (stderr,
+ fprintf (stderr,
"\tloopObjects:\n"
"\t cardIndex = "FMTCMI"\n"
"\t cardStart = "FMTPTR"\n"
@@ -267,7 +267,7 @@
}
if (nextObject > cardEnd) {
/* We're about to move to a new card, so we are looking at the
- * last object boundary in the current card.
+ * last object boundary in the current card.
* Store it in the crossMap.
*/
size_t offset;
@@ -275,8 +275,8 @@
offset = (objectStart - cardStart) / CROSS_MAP_OFFSET_SCALE;
assert (offset < CROSS_MAP_EMPTY);
if (DEBUG_GENERATIONAL)
- fprintf (stderr, "crossMap[%zu] = %zu\n",
- cardIndex, offset);
+ fprintf (stderr, "crossMap[%"PRIuMAX"] = %"PRIuMAX"\n",
+ (uintmax_t)cardIndex, (uintmax_t)offset);
s->generationalMaps.crossMap[cardIndex] = (GC_crossMapElem)offset;
cardIndex = sizeToCardMapIndex (nextObject - 1 - s->heap.start);
cardStart = s->heap.start + cardMapIndexToSize (cardIndex);
@@ -286,7 +286,7 @@
if (objectStart < oldGenEnd)
goto loopObjects;
assert (objectStart == oldGenEnd);
- s->generationalMaps.crossMap[cardIndex] =
+ s->generationalMaps.crossMap[cardIndex] =
(GC_crossMapElem)(oldGenEnd - cardStart) / CROSS_MAP_OFFSET_SCALE;
s->generationalMaps.crossMapValidSize = s->heap.oldGenSize;
done:
Modified: mlton/trunk/runtime/gc/heap.c
===================================================================
--- mlton/trunk/runtime/gc/heap.c 2007-08-17 04:00:18 UTC (rev 5886)
+++ mlton/trunk/runtime/gc/heap.c 2007-08-17 18:08:44 UTC (rev 5887)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2005 Henry Cejtin, Matthew Fluet, Suresh
+/* Copyright (C) 2005-2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
*
* MLton is released under a BSD-style license.
@@ -10,12 +10,12 @@
FILE *stream) {
fprintf(stream,
"\t\tnursery = "FMTPTR"\n"
- "\t\toldGenSize = %zu\n"
- "\t\tsize = %zu\n"
+ "\t\toldGenSize = %"PRIuMAX"\n"
+ "\t\tsize = %"PRIuMAX"\n"
"\t\tstart = "FMTPTR"\n",
(uintptr_t)heap->nursery,
- heap->oldGenSize,
- heap->size,
+ (uintmax_t)heap->oldGenSize,
+ (uintmax_t)heap->size,
(uintptr_t)heap->start);
}
@@ -28,7 +28,7 @@
h->start = NULL;
}
-/* sizeofHeapDesired (s, l, cs)
+/* sizeofHeapDesired (s, l, cs)
*
* returns the desired heap size for a heap with l bytes live, given
* that the current heap size is cs.
@@ -62,7 +62,7 @@
* alone. On the other hand, if it is bigger we want to leave res
* as is so that the heap is shrunk, to try to avoid paging.
*/
- if (currentSize <= res
+ if (currentSize <= res
and res <= 1.1 * currentSize)
res = currentSize;
} else if (ratio >= s->controls.ratios.markCompact) {
@@ -80,7 +80,7 @@
* VM keeps around, growing could be very expensive, if it
* involves paging the entire heap. Hopefully the copy loop in
* growHeap will make the right thing happen.
- */
+ */
}
if (s->controls.fixedHeap > 0) {
if (res > s->controls.fixedHeap / 2)
@@ -110,7 +110,7 @@
if (NULL == h->start)
return;
if (DEBUG or s->controls.messages)
- fprintf (stderr,
+ fprintf (stderr,
"[GC: Releasing heap at "FMTPTR" of size %s bytes.]\n",
(uintptr_t)(h->start),
uintmaxToCommaString(h->size));
@@ -137,16 +137,16 @@
}
}
-/* createHeap (s, h, desiredSize, minSize)
- *
+/* createHeap (s, h, desiredSize, minSize)
+ *
* allocates a heap of the size necessary to work with desiredSize
* live data, and ensures that at least minSize is available. It
* returns TRUE if it is able to allocate the space, and returns FALSE
* if it is unable. If a reasonable size to space is already there,
* then heapCreate leaves it.
*/
-bool createHeap (GC_state s, GC_heap h,
- size_t desiredSize,
+bool createHeap (GC_state s, GC_heap h,
+ size_t desiredSize,
size_t minSize) {
size_t backoff;
@@ -191,7 +191,7 @@
if (h->size > s->cumulativeStatistics.maxHeapSizeSeen)
s->cumulativeStatistics.maxHeapSizeSeen = h->size;
if (DEBUG or s->controls.messages)
- fprintf (stderr,
+ fprintf (stderr,
"[GC: Created heap at "FMTPTR" of size %s bytes.]\n",
(uintptr_t)(h->start),
uintmaxToCommaString(h->size));
@@ -200,12 +200,12 @@
}
}
if (s->controls.messages) {
- fprintf (stderr,
+ fprintf (stderr,
"[GC: Creating heap of size %s bytes cannot be satisfied,]\n",
uintmaxToCommaString (h->size));
fprintf (stderr,
"[GC:\tbacking off by %s bytes with minimum size of %s bytes.]\n",
- uintmaxToCommaString (backoff),
+ uintmaxToCommaString (backoff),
uintmaxToCommaString (minSize));
}
}
@@ -216,9 +216,9 @@
/* createHeapSecondary (s, desiredSize)
*/
bool createHeapSecondary (GC_state s, size_t desiredSize) {
- if ((s->controls.fixedHeap > 0
+ if ((s->controls.fixedHeap > 0
and s->heap.size + desiredSize > s->controls.fixedHeap)
- or (s->controls.maxHeap > 0
+ or (s->controls.maxHeap > 0
and s->heap.size + desiredSize > s->controls.maxHeap))
return FALSE;
return createHeap (s, &s->secondaryHeap, desiredSize, s->heap.oldGenSize);
@@ -226,8 +226,8 @@
/* remapHeap (s, h, desiredSize, minSize)
*/
-bool remapHeap (GC_state s, GC_heap h,
- size_t desiredSize,
+bool remapHeap (GC_state s, GC_heap h,
+ size_t desiredSize,
size_t minSize) {
size_t backoff;
size_t size;
@@ -273,7 +273,7 @@
assert (desiredSize >= s->heap.size);
if (DEBUG_RESIZING or s->controls.messages) {
- fprintf (stderr,
+ fprintf (stderr,
"[GC: Growing heap at "FMTPTR" of size %s bytes,]\n",
(uintptr_t)s->heap.start,
uintmaxToCommaString(s->heap.size));
@@ -299,7 +299,7 @@
from = curHeapp->start + size;
to = newHeap.start + size;
remaining = size;
-copy:
+copy:
assert (remaining == (size_t)(from - curHeapp->start)
and from >= curHeapp->start
and to >= newHeap.start);
@@ -321,16 +321,16 @@
void *data;
if (DEBUG or s->controls.messages) {
- fprintf (stderr,
+ fprintf (stderr,
"[GC: Writing heap at "FMTPTR" of size %s bytes to disk.]\n",
- (uintptr_t)orig,
+ (uintptr_t)orig,
uintmaxToCommaString(size));
}
data = GC_diskBack_write (orig, size);
releaseHeap (s, curHeapp);
if (createHeap (s, curHeapp, desiredSize, minSize)) {
if (DEBUG or s->controls.messages) {
- fprintf (stderr,
+ fprintf (stderr,
"[GC: Reading heap at "FMTPTR" of size %s bytes from disk.]\n",
(uintptr_t)orig,
uintmaxToCommaString(size));
@@ -359,7 +359,7 @@
if (DEBUG_RESIZING)
fprintf (stderr, "resizeHeap minSize = %s size = %s\n",
- uintmaxToCommaString(minSize),
+ uintmaxToCommaString(minSize),
uintmaxToCommaString(s->heap.size));
desiredSize = sizeofHeapDesired (s, minSize, s->heap.size);
assert (minSize <= desiredSize);
@@ -393,6 +393,6 @@
releaseHeap (s, &s->secondaryHeap);
} else if (secondarySize > primarySize)
shrinkHeap (s, &s->secondaryHeap, primarySize);
- assert (0 == s->secondaryHeap.size
+ assert (0 == s->secondaryHeap.size
or s->heap.size == s->secondaryHeap.size);
}
Modified: mlton/trunk/runtime/gc/init-world.c
===================================================================
--- mlton/trunk/runtime/gc/init-world.c 2007-08-17 04:00:18 UTC (rev 5886)
+++ mlton/trunk/runtime/gc/init-world.c 2007-08-17 18:08:44 UTC (rev 5887)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
+/* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
*
@@ -16,7 +16,7 @@
/* A slight overestimate. */
double bytesPerChar = 0.415241011861 /* = ((log(10.0) / log(2.0)) / 8.0) */ ;
double bytes = ceil((double)slen * bytesPerChar);
- return align (GC_ARRAY_HEADER_SIZE
+ return align (GC_ARRAY_HEADER_SIZE
+ sizeof(mp_limb_t) // for the sign
+ align((size_t)bytes, sizeof(mp_limb_t)),
s->alignment);
@@ -32,7 +32,7 @@
total += sizeofIntInfFromString (s, s->intInfInits[i].mlstr);
}
for (i = 0; i < s->vectorInitsLength; ++i) {
- dataBytes =
+ dataBytes =
s->vectorInits[i].bytesPerElement
* s->vectorInits[i].numElements;
total += align (GC_ARRAY_HEADER_SIZE
@@ -112,8 +112,8 @@
typeIndex = WORD64_VECTOR_TYPE_INDEX;
break;
default:
- die ("unknown bytes per element in vectorInit: %zu",
- bytesPerElement);
+ die ("unknown bytes per element in vectorInit: %"PRIuMAX"",
+ (uintmax_t)bytesPerElement);
}
*((GC_header*)(frontier)) = buildHeaderFromTypeIndex (typeIndex);
frontier = frontier + GC_HEADER_SIZE;
@@ -141,7 +141,7 @@
for (i = 0; i < s->globalsLength; ++i)
s->globals[i] = BOGUS_OBJPTR;
s->lastMajorStatistics.bytesLive = sizeofInitialBytesLive (s);
- createHeap (s, &s->heap,
+ createHeap (s, &s->heap,
sizeofHeapDesired (s, s->lastMajorStatistics.bytesLive, 0),
s->lastMajorStatistics.bytesLive);
createCardMapAndCrossMap (s);
@@ -157,4 +157,3 @@
thread = newThread (s, sizeofStackInitial (s));
switchToThread (s, pointerToObjptr((pointer)thread - offsetofThread (s), s->heap.start));
}
-
Modified: mlton/trunk/runtime/gc/int-inf.c
===================================================================
--- mlton/trunk/runtime/gc/int-inf.c 2007-08-17 04:00:18 UTC (rev 5886)
+++ mlton/trunk/runtime/gc/int-inf.c 2007-08-17 18:08:44 UTC (rev 5887)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
+/* Copyright (C) 1999-2005, 2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
*
@@ -28,7 +28,7 @@
GC_intInf bp;
assert (not isSmall(arg));
- bp = (GC_intInf)(objptrToPointer(arg, s->heap.start)
+ bp = (GC_intInf)(objptrToPointer(arg, s->heap.start)
- offsetof(struct GC_intInf, obj.body.isneg));
if (DEBUG_INT_INF)
fprintf (stderr, "bp->header = "FMTHDR"\n", bp->header);
@@ -41,7 +41,7 @@
* enough to contain LIMBS_PER_OBJPTR + 1 limbs, fill in the
* __mpz_struct.
*/
-void fillIntInfArg (GC_state s, objptr arg, __mpz_struct *res,
+void fillIntInfArg (GC_state s, objptr arg, __mpz_struct *res,
mp_limb_t space[LIMBS_PER_OBJPTR + 1]) {
GC_intInf bp;
@@ -80,9 +80,9 @@
res->_mp_d = (mp_limb_t*)(bp->obj.body.limbs);
res->_mp_size = bp->obj.body.isneg ? - res->_mp_alloc : res->_mp_alloc;
}
- assert ((res->_mp_size == 0)
- or (res->_mp_d[(res->_mp_size < 0
- ? - res->_mp_size
+ assert ((res->_mp_size == 0)
+ or (res->_mp_d[(res->_mp_size < 0
+ ? - res->_mp_size
: res->_mp_size) - 1] != 0));
if (DEBUG_INT_INF_DETAILED)
fprintf (stderr, "arg --> %s\n",
@@ -92,7 +92,7 @@
/*
* Initialize an __mpz_struct to use the space provided by the heap.
*/
-void initIntInfRes (GC_state s, __mpz_struct *res,
+void initIntInfRes (GC_state s, __mpz_struct *res,
__attribute__ ((unused)) size_t bytes) {
GC_intInf bp;
@@ -118,13 +118,13 @@
GC_intInf bp;
mp_size_t size;
- assert ((res->_mp_size == 0)
- or (res->_mp_d[(res->_mp_size < 0
- ? - res->_mp_size
+ assert ((res->_mp_size == 0)
+ or (res->_mp_d[(res->_mp_size < 0
+ ? - res->_mp_size
: res->_mp_size) - 1] != 0));
if (DEBUG_INT_INF)
- fprintf (stderr, "finiIntInfRes ("FMTPTR", %zu)\n",
- (uintptr_t)res, bytes);
+ fprintf (stderr, "finiIntInfRes ("FMTPTR", %"PRIuMAX")\n",
+ (uintptr_t)res, (uintmax_t)bytes);
if (DEBUG_INT_INF_DETAILED)
fprintf (stderr, "res --> %s\n",
mpz_get_str (NULL, 10, res));
@@ -181,64 +181,64 @@
objptr IntInf_add (objptr lhs, objptr rhs, size_t bytes) {
if (DEBUG_INT_INF)
- fprintf (stderr, "IntInf_add ("FMTOBJPTR", "FMTOBJPTR", %zu)\n",
- lhs, rhs, bytes);
+ fprintf (stderr, "IntInf_add ("FMTOBJPTR", "FMTOBJPTR", %"PRIuMAX")\n",
+ lhs, rhs, (uintmax_t)bytes);
return binary (lhs, rhs, bytes, &mpz_add);
}
objptr IntInf_andb (objptr lhs, objptr rhs, size_t bytes) {
if (DEBUG_INT_INF)
- fprintf (stderr, "IntInf_andb ("FMTOBJPTR", "FMTOBJPTR", %zu)\n",
- lhs, rhs, bytes);
+ fprintf (stderr, "IntInf_andb ("FMTOBJPTR", "FMTOBJPTR", %"PRIuMAX")\n",
+ lhs, rhs, (uintmax_t)bytes);
return binary (lhs, rhs, bytes, &mpz_and);
}
objptr IntInf_gcd (objptr lhs, objptr rhs, size_t bytes) {
if (DEBUG_INT_INF)
- fprintf (stderr, "IntInf_gcd ("FMTOBJPTR", "FMTOBJPTR", %zu)\n",
- lhs, rhs, bytes);
+ fprintf (stderr, "IntInf_gcd ("FMTOBJPTR", "FMTOBJPTR", %"PRIuMAX")\n",
+ lhs, rhs, (uintmax_t)bytes);
return binary (lhs, rhs, bytes, &mpz_gcd);
}
objptr IntInf_mul (objptr lhs, objptr rhs, size_t bytes) {
if (DEBUG_INT_INF)
- fprintf (stderr, "IntInf_mul ("FMTOBJPTR", "FMTOBJPTR", %zu)\n",
- lhs, rhs, bytes);
+ fprintf (stderr, "IntInf_mul ("FMTOBJPTR", "FMTOBJPTR", %"PRIuMAX")\n",
+ lhs, rhs, (uintmax_t)bytes);
return binary (lhs, rhs, bytes, &mpz_mul);
}
objptr IntInf_quot (objptr lhs, objptr rhs, size_t bytes) {
if (DEBUG_INT_INF)
- fprintf (stderr, "IntInf_quot ("FMTOBJPTR", "FMTOBJPTR", %zu)\n",
- lhs, rhs, bytes);
+ fprintf (stderr, "IntInf_quot ("FMTOBJPTR", "FMTOBJPTR", %"PRIuMAX")\n",
+ lhs, rhs, (uintmax_t)bytes);
return binary (lhs, rhs, bytes, &mpz_tdiv_q);
}
objptr IntInf_orb (objptr lhs, objptr rhs, size_t bytes) {
if (DEBUG_INT_INF)
- fprintf (stderr, "IntInf_orb ("FMTOBJPTR", "FMTOBJPTR", %zu)\n",
- lhs, rhs, bytes);
+ fprintf (stderr, "IntInf_orb ("FMTOBJPTR", "FMTOBJPTR", %"PRIuMAX")\n",
+ lhs, rhs, (uintmax_t)bytes);
return binary (lhs, rhs, bytes, &mpz_ior);
}
objptr IntInf_rem (objptr lhs, objptr rhs, size_t bytes) {
if (DEBUG_INT_INF)
- fprintf (stderr, "IntInf_quot ("FMTOBJPTR", "FMTOBJPTR", %zu)\n",
- lhs, rhs, bytes);
+ fprintf (stderr, "IntInf_quot ("FMTOBJPTR", "FMTOBJPTR", %"PRIuMAX")\n",
+ lhs, rhs, (uintmax_t)bytes);
return binary (lhs, rhs, bytes, &mpz_tdiv_r);
}
objptr IntInf_sub (objptr lhs, objptr rhs, size_t bytes) {
if (DEBUG_INT_INF)
- fprintf (stderr, "IntInf_sub ("FMTOBJPTR", "FMTOBJPTR", %zu)\n",
- lhs, rhs, bytes);
+ fprintf (stderr, "IntInf_sub ("FMTOBJPTR", "FMTOBJPTR", %"PRIuMAX")\n",
+ lhs, rhs, (uintmax_t)bytes);
return binary (lhs, rhs, bytes, &mpz_sub);
}
objptr IntInf_xorb (objptr lhs, objptr rhs, size_t bytes) {
if (DEBUG_INT_INF)
- fprintf (stderr, "IntInf_xorb ("FMTOBJPTR", "FMTOBJPTR", %zu)\n",
- lhs, rhs, bytes);
+ fprintf (stderr, "IntInf_xorb ("FMTOBJPTR", "FMTOBJPTR", %"PRIuMAX")\n",
+ lhs, rhs, (uintmax_t)bytes);
return binary (lhs, rhs, bytes, &mpz_xor);
}
@@ -256,15 +256,15 @@
objptr IntInf_neg (objptr arg, size_t bytes) {
if (DEBUG_INT_INF)
- fprintf (stderr, "IntInf_neg ("FMTOBJPTR", %zu)\n",
- arg, bytes);
+ fprintf (stderr, "IntInf_neg ("FMTOBJPTR", %"PRIuMAX")\n",
+ arg, (uintmax_t)bytes);
return unary (arg, bytes, &mpz_neg);
}
objptr IntInf_notb (objptr arg, size_t bytes) {
if (DEBUG_INT_INF)
- fprintf (stderr, "IntInf_notb ("FMTOBJPTR", %zu)\n",
- arg, bytes);
+ fprintf (stderr, "IntInf_notb ("FMTOBJPTR", %"PRIuMAX")\n",
+ arg, (uintmax_t)bytes);
return unary (arg, bytes, &mpz_com);
}
@@ -284,15 +284,15 @@
objptr IntInf_arshift (objptr arg, Word32_t shift, size_t bytes) {
if (DEBUG_INT_INF)
- fprintf (stderr, "IntInf_arshift ("FMTOBJPTR", %"PRIu32", %zu)\n",
- arg, shift, bytes);
+ fprintf (stderr, "IntInf_arshift ("FMTOBJPTR", %"PRIu32", %"PRIuMAX")\n",
+ arg, shift, (uintmax_t)bytes);
return shary (arg, shift, bytes, &mpz_fdiv_q_2exp);
}
objptr IntInf_lshift (objptr arg, Word32_t shift, size_t bytes) {
if (DEBUG_INT_INF)
- fprintf (stderr, "IntInf_lshift ("FMTOBJPTR", %"PRIu32", %zu)\n",
- arg, shift, bytes);
+ fprintf (stderr, "IntInf_lshift ("FMTOBJPTR", %"PRIu32", %"PRIuMAX")\n",
+ arg, shift, (uintmax_t)bytes);
return shary(arg, shift, bytes, &mpz_mul_2exp);
}
@@ -341,8 +341,8 @@
size_t size;
if (DEBUG_INT_INF)
- fprintf (stderr, "IntInf_toString ("FMTOBJPTR", %"PRId32", %zu)\n",
- arg, base, bytes);
+ fprintf (stderr, "IntInf_toString ("FMTOBJPTR", %"PRId32", %"PRIuMAX")\n",
+ arg, base, (uintmax_t)bytes);
assert (base == 2 || base == 8 || base == 10 || base == 16);
fillIntInfArg (&gcState, arg, &argmpz, argspace);
sp = (GC_string8)gcState.frontier;
Modified: mlton/trunk/runtime/gc/mark-compact.c
===================================================================
--- mlton/trunk/runtime/gc/mark-compact.c 2007-08-17 04:00:18 UTC (rev 5886)
+++ mlton/trunk/runtime/gc/mark-compact.c 2007-08-17 18:08:44 UTC (rev 5887)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
+/* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
*
@@ -48,7 +48,7 @@
opop = pointerToObjptr ((pointer)opp, s->heap.start);
p = objptrToPointer (*opp, s->heap.start);
if (FALSE)
- fprintf (stderr,
+ fprintf (stderr,
"threadInternal opp = "FMTPTR" p = "FMTPTR" header = "FMTHDR"\n",
(uintptr_t)opp, (uintptr_t)p, getHeader (p));
headerp = getHeaderp (p);
@@ -125,8 +125,8 @@
clearIfWeakAndUnmarkedForMarkCompact (s, p);
size = sizeofObject (s, p);
if (DEBUG_MARK_COMPACT)
- fprintf (stderr, "threading "FMTPTR" of size %zu\n",
- (uintptr_t)p, size);
+ fprintf (stderr, "threading "FMTPTR" of size %"PRIuMAX"\n",
+ (uintptr_t)p, (uintmax_t)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
@@ -139,12 +139,12 @@
* extra space and be completely busted.
*/
if (DEBUG_MARK_COMPACT)
- fprintf (stderr, "compressing from "FMTPTR" to "FMTPTR" (length = %zu)\n",
+ fprintf (stderr, "compressing from "FMTPTR" to "FMTPTR" (length = %"PRIuMAX")\n",
(uintptr_t)endOfLastMarked, (uintptr_t)front,
- (size_t)(front - endOfLastMarked));
+ (uintmax_t)(front - endOfLastMarked));
*((GC_arrayCounter*)(newArray)) = 0;
newArray += GC_ARRAY_COUNTER_SIZE;
- *((GC_arrayLength*)(newArray)) =
+ *((GC_arrayLength*)(newArray)) =
((size_t)(front - endOfLastMarked)) - GC_ARRAY_HEADER_SIZE;
newArray += GC_ARRAY_LENGTH_SIZE;
*((GC_header*)(newArray)) = GC_WORD8_VECTOR_HEADER;
@@ -223,13 +223,13 @@
size = sizeofObject (s, p);
/* unmark */
if (DEBUG_MARK_COMPACT)
- fprintf (stderr, "unmarking "FMTPTR" of size %zu\n",
- (uintptr_t)p, size);
+ fprintf (stderr, "unmarking "FMTPTR" of size %"PRIuMAX"\n",
+ (uintptr_t)p, (uintmax_t)size);
*headerp = header & ~MARK_MASK;
/* slide */
if (DEBUG_MARK_COMPACT)
- fprintf (stderr, "sliding "FMTPTR" down %zu\n",
- (uintptr_t)front, gap);
+ fprintf (stderr, "sliding "FMTPTR" down %"PRIuMAX"\n",
+ (uintptr_t)front, (uintmax_t)gap);
GC_memcpy (front, front - gap, size);
front += size;
goto updateObject;
@@ -237,8 +237,8 @@
/* It's not marked. */
size = sizeofObject (s, p);
if (DEBUG_MARK_COMPACT)
- fprintf (stderr, "skipping "FMTPTR" of size %zu\n",
- (uintptr_t)p, size);
+ fprintf (stderr, "skipping "FMTPTR" of size %"PRIuMAX"\n",
+ (uintptr_t)p, (uintmax_t)size);
gap += size;
front += size;
goto updateObject;
@@ -272,7 +272,8 @@
done:
s->heap.oldGenSize = front - gap - s->heap.start;
if (DEBUG_MARK_COMPACT)
- fprintf (stderr, "oldGenSize = %zu\n", s->heap.oldGenSize);
+ fprintf (stderr, "oldGenSize = %"PRIuMAX"\n",
+ (uintmax_t)s->heap.oldGenSize);
return;
}
@@ -284,11 +285,11 @@
startTiming (&ru_start);
s->cumulativeStatistics.numMarkCompactGCs++;
if (DEBUG or s->controls.messages) {
- fprintf (stderr,
+ fprintf (stderr,
"[GC: Starting major mark-compact;]\n");
fprintf (stderr,
"[GC:\theap at "FMTPTR" of size %s bytes.]\n",
- (uintptr_t)(s->heap.start),
+ (uintptr_t)(s->heap.start),
uintmaxToCommaString(s->heap.size));
}
if (s->hashConsDuringGC) {
@@ -310,12 +311,12 @@
if (detailedGCTime (s))
stopTiming (&ru_start, &s->cumulativeStatistics.ru_gcMarkCompact);
if (DEBUG or s->controls.messages) {
- fprintf (stderr,
+ fprintf (stderr,
"[GC: Finished major mark-compact; mark compacted %s bytes.]\n",
uintmaxToCommaString(bytesMarkCompacted));
if (s->hashConsDuringGC)
- printBytesHashConsedMessage(s,
- s->lastMajorStatistics.bytesHashConsed
+ printBytesHashConsedMessage(s,
+ s->lastMajorStatistics.bytesHashConsed
+ s->heap.oldGenSize);
}
}
Modified: mlton/trunk/runtime/gc/new-object.c
===================================================================
--- mlton/trunk/runtime/gc/new-object.c 2007-08-17 04:00:18 UTC (rev 5886)
+++ mlton/trunk/runtime/gc/new-object.c 2007-08-17 18:08:44 UTC (rev 5887)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
+/* Copyright (C) 1999-2005, 2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
*
@@ -29,7 +29,7 @@
} else {
if (DEBUG_DETAILED)
fprintf (stderr, "frontier changed from "FMTPTR" to "FMTPTR"\n",
- (uintptr_t)s->frontier,
+ (uintptr_t)s->frontier,
(uintptr_t)(s->frontier + bytesRequested));
frontier = s->frontier;
s->frontier += bytesRequested;
@@ -39,31 +39,31 @@
result = frontier + GC_NORMAL_HEADER_SIZE;
assert (isAligned ((size_t)result, s->alignment));
if (DEBUG)
- fprintf (stderr, FMTPTR " = newObject ("FMTHDR", %zu, %s)\n",
+ fprintf (stderr, FMTPTR " = newObject ("FMTHDR", %"PRIuMAX", %s)\n",
(uintptr_t)result,
- header,
- bytesRequested,
+ header,
+ (uintmax_t)bytesRequested,
boolToString (allocInOldGen));
return result;
}
-GC_stack newStack (GC_state s,
- size_t reserved,
+GC_stack newStack (GC_state s,
+ size_t reserved,
bool allocInOldGen) {
GC_stack stack;
reserved = alignStackReserved (s, reserved);
if (reserved > s->cumulativeStatistics.maxStackSizeSeen)
s->cumulativeStatistics.maxStackSizeSeen = reserved;
- stack = (GC_stack)(newObject (s, GC_STACK_HEADER,
+ stack = (GC_stack)(newObject (s, GC_STACK_HEADER,
sizeofStackWithHeaderAligned (s, reserved),
allocInOldGen));
stack->reserved = reserved;
stack->used = 0;
if (DEBUG_STACKS)
- fprintf (stderr, FMTPTR " = newStack (%zu)\n",
- (uintptr_t)stack,
- reserved);
+ fprintf (stderr, FMTPTR " = newStack (%"PRIuMAX")\n",
+ (uintptr_t)stack,
+ (uintmax_t)reserved);
return stack;
}
@@ -74,20 +74,20 @@
ensureHasHeapBytesFree (s, 0, sizeofStackWithHeaderAligned (s, reserved) + sizeofThread (s));
stack = newStack (s, reserved, FALSE);
- res = newObject (s, GC_THREAD_HEADER,
- sizeofThread (s),
+ res = newObject (s, GC_THREAD_HEADER,
+ sizeofThread (s),
FALSE);
thread = (GC_thread)(res + offsetofThread (s));
thread->bytesNeeded = 0;
thread->exnStack = BOGUS_EXN_STACK;
thread->stack = pointerToObjptr((pointer)stack, s->heap.start);
if (DEBUG_THREADS)
- fprintf (stderr, FMTPTR" = newThreadOfSize (%zu)\n",
- (uintptr_t)thread, reserved);;
+ fprintf (stderr, FMTPTR" = newThreadOfSize (%"PRIuMAX")\n",
+ (uintptr_t)thread, (uintmax_t)reserved);;
return thread;
}
-static inline void setFrontier (GC_state s, pointer p,
+static inline void setFrontier (GC_state s, pointer p,
__attribute__ ((unused)) size_t bytes) {
p = alignFrontier (s, p);
assert ((size_t)(p - s->frontier) <= bytes);
Modified: mlton/trunk/runtime/gc/profiling.c
===================================================================
--- mlton/trunk/runtime/gc/profiling.c 2007-08-17 04:00:18 UTC (rev 5886)
+++ mlton/trunk/runtime/gc/profiling.c 2007-08-17 18:08:44 UTC (rev 5887)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
+/* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
*
@@ -6,7 +6,7 @@
* See the file MLton-LICENSE for details.
*/
-GC_profileMasterIndex sourceIndexToProfileMasterIndex (GC_state s,
+GC_profileMasterIndex sourceIndexToProfileMasterIndex (GC_state s,
GC_sourceIndex i)
{
GC_profileMasterIndex pmi;
@@ -16,7 +16,7 @@
return pmi;
}
-GC_sourceNameIndex profileMasterIndexToSourceNameIndex (GC_state s,
+GC_sourceNameIndex profileMasterIndexToSourceNameIndex (GC_state s,
GC_profileMasterIndex i) {
assert (i >= s->sourceMaps.sourcesLength);
return i - s->sourceMaps.sourcesLength;
@@ -54,9 +54,9 @@
ps = getProfileStackInfo (s, i);
if (DEBUG_PROFILE)
fprintf (stderr, "adding %s to stack lastTotal = %"PRIuMAX" lastTotalGC = %"PRIuMAX"\n",
- getSourceName (s, i),
- p->total,
- p->totalGC);
+ getSourceName (s, i),
+ (uintmax_t)p->total,
+ (uintmax_t)p->totalGC);
ps->lastTotal = p->total;
ps->lastTotalGC = p->totalGC;
}
@@ -115,9 +115,9 @@
ps = getProfileStackInfo (s, i);
if (DEBUG_PROFILE)
fprintf (stderr, "removing %s from stack ticksInc = %"PRIuMAX" ticksGCInc = %"PRIuMAX"\n",
- profileIndexSourceName (s, i),
- p->total - ps->lastTotal,
- p->totalGC - ps->lastTotalGC);
+ profileIndexSourceName (s, i),
+ (uintmax_t)(p->total - ps->lastTotal),
+ (uintmax_t)(p->totalGC - ps->lastTotalGC));
ps->ticks += p->total - ps->lastTotal;
ps->ticksGC += p->totalGC - ps->lastTotalGC;
}
@@ -173,18 +173,18 @@
GC_sourceIndex topSourceIndex;
if (DEBUG_PROFILE)
- fprintf (stderr, "incForProfiling (%zu, "FMTSSI")\n",
- amount, sourceSeqIndex);
+ fprintf (stderr, "incForProfiling (%"PRIuMAX", "FMTSSI")\n",
+ (uintmax_t)amount, sourceSeqIndex);
assert (sourceSeqIndex < s->sourceMaps.sourceSeqsLength);
sourceSeq = s->sourceMaps.sourceSeqs[sourceSeqIndex];
- topSourceIndex =
- sourceSeq[0] > 0
- ? sourceSeq[sourceSeq[0]]
+ topSourceIndex =
+ sourceSeq[0] > 0
+ ? sourceSeq[sourceSeq[0]]
: SOURCES_INDEX_UNKNOWN;
if (DEBUG_PROFILE) {
profileIndent ();
- fprintf (stderr, "bumping %s by %zu\n",
- getSourceName (s, topSourceIndex), amount);
+ fprintf (stderr, "bumping %s by %"PRIuMAX"\n",
+ getSourceName (s, topSourceIndex), (uintmax_t)amount);
}
s->profiling.data->countTop[topSourceIndex] += amount;
s->profiling.data->countTop[sourceIndexToProfileMasterIndex (s, topSourceIndex)] += amount;
@@ -200,7 +200,7 @@
void GC_profileInc (GC_state s, size_t amount) {
if (DEBUG_PROFILE)
- fprintf (stderr, "GC_profileInc (%zu)\n", amount);
+ fprintf (stderr, "GC_profileInc (%"PRIuMAX")\n", (uintmax_t)amount);
incForProfiling (s, amount,
s->amInGC
? SOURCE_SEQ_GC
@@ -210,7 +210,7 @@
void GC_profileAllocInc (GC_state s, size_t amount) {
if (s->profiling.isOn and (PROFILE_ALLOC == s->profiling.kind)) {
if (DEBUG_PROFILE)
- fprintf (stderr, "GC_profileAllocInc (%zu)\n", amount);
+ fprintf (stderr, "GC_profileAllocInc (%"PRIuMAX")\n", (uintmax_t)amount);
GC_profileInc (s, amount);
}
}
@@ -304,12 +304,12 @@
writeUint32U (f, s->sourceMaps.sourcesLength);
writeNewline (f);
for (GC_sourceIndex i = 0; i < s->sourceMaps.sourcesLength; i++)
- writeProfileCount (s, f, p,
+ writeProfileCount (s, f, p,
(GC_profileMasterIndex)i);
writeUint32U (f, s->sourceMaps.sourceNamesLength);
writeNewline (f);
for (GC_sourceNameIndex i = 0; i < s->sourceMaps.sourceNamesLength; i++)
- writeProfileCount (s, f, p,
+ writeProfileCount (s, f, p,
(GC_profileMasterIndex)(i + s->sourceMaps.sourcesLength));
fclose_safe (f);
}
@@ -466,14 +466,14 @@
s->profiling.isOn = FALSE;
p = s->profiling.data;
if (s->profiling.stack) {
- uint32_t profileMasterLength =
+ uint32_t profileMasterLength =
s->sourceMaps.sourcesLength + s->sourceMaps.sourceNamesLength;
for (profileMasterIndex = 0;
profileMasterIndex < profileMasterLength;
profileMasterIndex++) {
if (p->stack[profileMasterIndex].numOccurrences > 0) {
if (DEBUG_PROFILE)
- fprintf (stderr, "done leaving %s\n",
+ fprintf (stderr, "done leaving %s\n",
profileIndexSourceName (s, profileMasterIndex));
removeFromStackForProfiling (s, profileMasterIndex);
}
@@ -488,4 +488,3 @@
void GC_setProfileCurrent (GC_state s, GC_profileData p) {
s->profiling.data = p;
}
-
Modified: mlton/trunk/runtime/gc/stack.c
===================================================================
--- mlton/trunk/runtime/gc/stack.c 2007-08-17 04:00:18 UTC (rev 5886)
+++ mlton/trunk/runtime/gc/stack.c 2007-08-17 18:08:44 UTC (rev 5887)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
+/* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
*
@@ -7,13 +7,13 @@
*/
void displayStack (__attribute__ ((unused)) GC_state s,
- GC_stack stack,
+ GC_stack stack,
FILE *stream) {
fprintf(stream,
- "\t\treserved = %zu\n"
- "\t\tused = %zu\n",
- stack->reserved,
- stack->used);
+ "\t\treserved = %"PRIuMAX"\n"
+ "\t\tused = %"PRIuMAX"\n",
+ (uintmax_t)stack->reserved,
+ (uintmax_t)stack->used);
}
@@ -23,7 +23,7 @@
#if ASSERT
bool isStackReservedAligned (GC_state s, size_t reserved) {
- return isAligned (GC_STACK_HEADER_SIZE + sizeof (struct GC_stack) + reserved,
+ return isAligned (GC_STACK_HEADER_SIZE + sizeof (struct GC_stack) + reserved,
s->alignment);
}
#endif
@@ -79,8 +79,8 @@
GC_frameIndex getCachedStackTopFrameIndex (GC_state s) {
GC_frameIndex res;
- res =
- getFrameIndexFromReturnAddress
+ res =
+ getFrameIndexFromReturnAddress
(s, *((GC_returnAddress*)(s->stackTop - GC_RETURNADDRESS_SIZE)));
return res;
}
@@ -95,8 +95,8 @@
GC_frameIndex getStackTopFrameIndex (GC_state s, GC_stack stack) {
GC_frameIndex res;
- res =
- getFrameIndexFromReturnAddress
+ res =
+ getFrameIndexFromReturnAddress
(s, *((GC_returnAddress*)(getStackTop (s, stack) - GC_RETURNADDRESS_SIZE)));
return res;
}
@@ -120,8 +120,8 @@
size_t res;
res =
- stack->used
- + sizeofStackSlop (s)
+ stack->used
+ + sizeofStackSlop (s)
- getStackTopFrameSize(s, stack);
return res;
}
@@ -131,7 +131,8 @@
res = alignWithExtra (s, reserved, GC_STACK_HEADER_SIZE + sizeof (struct GC_stack));
if (DEBUG_STACKS)
- fprintf (stderr, "%zu = alignStackReserved (%zu)\n", res, reserved);
+ fprintf (stderr, "%"PRIuMAX" = alignStackReserved (%"PRIuMAX")\n",
+ (uintmax_t)res, (uintmax_t)reserved);
assert (isStackReservedAligned (s, res));
return res;
}
@@ -139,13 +140,14 @@
size_t sizeofStackWithHeaderAligned (GC_state s, size_t reserved) {
size_t res;
- res =
- align (GC_STACK_HEADER_SIZE
- + sizeof (struct GC_stack)
+ res =
+ align (GC_STACK_HEADER_SIZE
+ + sizeof (struct GC_stack)
+ reserved,
s->alignment);
if (DEBUG_STACKS)
- fprintf (stderr, "%zu = sizeofStackWithHeaderAligned (%zu)\n", res, reserved);
+ fprintf (stderr, "%"PRIuMAX" = sizeofStackWithHeaderAligned (%"PRIuMAX")\n",
+ (uintmax_t)res, (uintmax_t)reserved);
return res;
}
@@ -164,9 +166,9 @@
assert (from->used <= to->reserved);
to->used = from->used;
if (DEBUG_STACKS)
- fprintf (stderr, "stackCopy from "FMTPTR" to "FMTPTR" of length %zu\n",
- (uintptr_t) fromBottom,
- (uintptr_t) toBottom,
- from->used);
+ fprintf (stderr, "stackCopy from "FMTPTR" to "FMTPTR" of length %"PRIuMAX"\n",
+ (uintptr_t)fromBottom,
+ (uintptr_t)toBottom,
+ (uintmax_t)from->used);
GC_memcpy (fromBottom, toBottom, from->used);
}
Modified: mlton/trunk/runtime/gc/switch-thread.c
===================================================================
--- mlton/trunk/runtime/gc/switch-thread.c 2007-08-17 04:00:18 UTC (rev 5886)
+++ mlton/trunk/runtime/gc/switch-thread.c 2007-08-17 18:08:44 UTC (rev 5887)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
+/* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
*
@@ -15,8 +15,9 @@
+ offsetofThread (s));
stack = (GC_stack)(objptrToPointer (thread->stack, s->heap.start));
- fprintf (stderr, "switchToThread ("FMTOBJPTR") used = %zu reserved = %zu\n",
- op, stack->used, stack->reserved);
+ fprintf (stderr, "switchToThread ("FMTOBJPTR") used = %"PRIuMAX
+ " reserved = %"PRIuMAX"\n",
+ op, (uintmax_t)stack->used, (uintmax_t)stack->reserved);
}
s->currentThread = op;
setGCStateCurrentThreadAndStack (s);
@@ -24,8 +25,8 @@
void GC_switchToThread (GC_state s, pointer p, size_t ensureBytesFree) {
if (DEBUG_THREADS)
- fprintf (stderr, "GC_switchToThread ("FMTPTR", %zu)\n",
- (uintptr_t)p, ensureBytesFree);
+ fprintf (stderr, "GC_switchToThread ("FMTPTR", %"PRIuMAX")\n",
+ (uintptr_t)p, (uintmax_t)ensureBytesFree);
if (FALSE) {
/* This branch is slower than the else branch, especially
* when debugging is turned on, because it does an invariant
Modified: mlton/trunk/runtime/gc/thread.c
===================================================================
--- mlton/trunk/runtime/gc/thread.c 2007-08-17 04:00:18 UTC (rev 5886)
+++ mlton/trunk/runtime/gc/thread.c 2007-08-17 18:08:44 UTC (rev 5887)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
+/* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
*
@@ -7,14 +7,14 @@
*/
void displayThread (GC_state s,
- GC_thread thread,
+ GC_thread thread,
FILE *stream) {
fprintf(stream,
- "\t\texnStack = %zu\n"
- "\t\tbytesNeeded = %zu\n"
+ "\t\texnStack = %"PRIuMAX"\n"
+ "\t\tbytesNeeded = %"PRIuMAX"\n"
"\t\tstack = "FMTOBJPTR"\n",
- thread->exnStack,
- thread->bytesNeeded,
+ (uintmax_t)thread->exnStack,
+ (uintmax_t)thread->bytesNeeded,
thread->stack);
displayStack (s, (GC_stack)(objptrToPointer (thread->stack, s->heap.start)),
stream);
@@ -31,10 +31,10 @@
splitHeader (s, GC_THREAD_HEADER, NULL, NULL, &bytesNonObjptrs, &numObjptrs);
check = GC_NORMAL_HEADER_SIZE + (bytesNonObjptrs + (numObjptrs * OBJPTR_SIZE));
- if (DEBUG_DETAILED)
+ if (DEBUG_DETAILED)
fprintf (stderr,
- "sizeofThread: res = %zu check = %zu\n",
- res, check);
+ "sizeofThread: res = %"PRIuMAX" check = %"PRIuMAX"\n",
+ (uintmax_t)res, (uintmax_t)check);
assert (check == res);
}
assert (isAligned (res, s->alignment));
Modified: mlton/trunk/runtime/gc/virtual-memory.c
===================================================================
--- mlton/trunk/runtime/gc/virtual-memory.c 2007-08-17 04:00:18 UTC (rev 5886)
+++ mlton/trunk/runtime/gc/virtual-memory.c 2007-08-17 18:08:44 UTC (rev 5887)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
+/* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
*
@@ -19,8 +19,8 @@
static inline void GC_memcpy (pointer src, pointer dst, size_t size) {
if (DEBUG_DETAILED)
- fprintf (stderr, "GC_memcpy ("FMTPTR", "FMTPTR", %zu)\n",
- (uintptr_t)src, (uintptr_t)dst, size);
+ fprintf (stderr, "GC_memcpy ("FMTPTR", "FMTPTR", %"PRIuMAX")\n",
+ (uintptr_t)src, (uintptr_t)dst, (uintmax_t)size);
assert (isAligned ((size_t)src, sizeof(unsigned int)));
assert (isAligned ((size_t)dst, sizeof(unsigned int)));
assert (isAligned (size, sizeof(unsigned int)));
Modified: mlton/trunk/runtime/gc/weak.c
===================================================================
--- mlton/trunk/runtime/gc/weak.c 2007-08-17 04:00:18 UTC (rev 5886)
+++ mlton/trunk/runtime/gc/weak.c 2007-08-17 18:08:44 UTC (rev 5887)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
+/* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
*
@@ -17,10 +17,10 @@
splitHeader (s, GC_WEAK_GONE_HEADER, NULL, NULL, &bytesNonObjptrs, &numObjptrs);
check = GC_NORMAL_HEADER_SIZE + (bytesNonObjptrs + (numObjptrs * OBJPTR_SIZE));
- if (DEBUG_DETAILED)
+ if (DEBUG_DETAILED)
fprintf (stderr,
- "sizeofWeak: res = %zu check = %zu\n",
- res, check);
+ "sizeofWeak: res = %"PRIuMAX" check = %"PRIuMAX"\n",
+ (uintmax_t)res, (uintmax_t)check);
assert (check == res);
}
assert (isAligned (res, s->alignment));
@@ -57,7 +57,7 @@
GC_weak weak;
pointer res;
- res = newObject (s, header,
+ res = newObject (s, header,
sizeofWeak (s),
FALSE);
weak = (GC_weak)(res + offsetofWeak (s));
Modified: mlton/trunk/runtime/gc/world.c
===================================================================
--- mlton/trunk/runtime/gc/world.c 2007-08-17 04:00:18 UTC (rev 5886)
+++ mlton/trunk/runtime/gc/world.c 2007-08-17 18:08:44 UTC (rev 5887)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
+/* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
*
@@ -19,13 +19,13 @@
start = readPointer (f);
s->heap.oldGenSize = readSize (f);
s->atomicState = readUint32 (f);
- s->callFromCHandlerThread = readObjptr (f);
- s->currentThread = readObjptr (f);
- s->signalHandlerThread = readObjptr (f);
- createHeap (s, &s->heap,
- sizeofHeapDesired (s, s->heap.oldGenSize, 0),
+ s->callFromCHandlerThread = readObjptr (f);
+ s->currentThread = readObjptr (f);
+ s->signalHandlerThread = readObjptr (f);
+ createHeap (s, &s->heap,
+ sizeofHeapDesired (s, s->heap.oldGenSize, 0),
s->heap.oldGenSize);
- createCardMapAndCrossMap (s);
+ createCardMapAndCrossMap (s);
fread_safe (s->heap.start, 1, s->heap.oldGenSize, f);
if ((*(s->loadGlobals)) (f) != 0) diee("couldn't load globals");
// unless (EOF == fgetc (file))
@@ -34,8 +34,8 @@
* since it changes pointers in all of them.
*/
translateHeap (s, start, s->heap.start, s->heap.oldGenSize);
- setGCStateCurrentHeap (s, 0, 0);
- setGCStateCurrentThreadAndStack (s);
+ setGCStateCurrentHeap (s, 0, 0);
+ setGCStateCurrentThreadAndStack (s);
}
void loadWorldFromFileName (GC_state s, const char *fileName) {
@@ -45,7 +45,7 @@
fprintf (stderr, "loadWorldFromFileName (%s)\n", fileName);
f = fopen_safe (fileName, "rb");
loadWorldFromFILE (s, f);
- fclose_safe (f);
+ fclose_safe (f);
}
/* Don't use 'safe' functions, because we don't want the ML program to die.
@@ -60,9 +60,9 @@
/* Compact the heap. */
performGC (s, 0, 0, TRUE, TRUE);
snprintf (buf, cardof(buf),
- "Heap file created by MLton.\nheap.start = "FMTPTR"\nbytesLive = %zu\n",
- (uintptr_t)s->heap.start,
- s->lastMajorStatistics.bytesLive);
+ "Heap file created by MLton.\nheap.start = "FMTPTR"\nbytesLive = %"PRIuMAX"\n",
+ (uintptr_t)s->heap.start,
+ (uintmax_t)s->lastMajorStatistics.bytesLive);
len = strlen(buf) + 1; /* +1 to get the '\000' */
if (fwrite (buf, 1, len, f) != len) return -1;
Modified: mlton/trunk/runtime/gen/gen-sizes.c
===================================================================
--- mlton/trunk/runtime/gen/gen-sizes.c 2007-08-17 04:00:18 UTC (rev 5886)
+++ mlton/trunk/runtime/gen/gen-sizes.c 2007-08-17 18:08:44 UTC (rev 5887)
@@ -2,20 +2,20 @@
#include "platform.h"
struct GC_state gcState;
-int main (__attribute__ ((unused)) int argc,
+int main (__attribute__ ((unused)) int argc,
__attribute__ ((unused)) char* argv[]) {
FILE *sizesFd;
sizesFd = fopen_safe ("sizes", "w");
- fprintf (sizesFd, "cint = %zu\n", sizeof(C_Int_t));
- fprintf (sizesFd, "cpointer = %zu\n", sizeof(C_Pointer_t));
- fprintf (sizesFd, "cptrdiff = %zu\n", sizeof(C_Ptrdiff_t));
- fprintf (sizesFd, "csize = %zu\n", sizeof(C_Size_t));
- fprintf (sizesFd, "header = %zu\n", sizeof(GC_header));
- fprintf (sizesFd, "mplimb = %zu\n", sizeof(C_MPLimb_t));
- fprintf (sizesFd, "objptr = %zu\n", sizeof(objptr));
- fprintf (sizesFd, "seqIndex = %zu\n", sizeof(GC_arrayLength));
+ fprintf (sizesFd, "cint = %"PRIuMAX"\n", (uintmax_t)sizeof(C_Int_t));
+ fprintf (sizesFd, "cpointer = %"PRIuMAX"\n", (uintmax_t)sizeof(C_Pointer_t));
+ fprintf (sizesFd, "cptrdiff = %"PRIuMAX"\n", (uintmax_t)sizeof(C_Ptrdiff_t));
+ fprintf (sizesFd, "csize = %"PRIuMAX"\n", (uintmax_t)sizeof(C_Size_t));
+ fprintf (sizesFd, "header = %"PRIuMAX"\n", (uintmax_t)sizeof(GC_header));
+ fprintf (sizesFd, "mplimb = %"PRIuMAX"\n", (uintmax_t)sizeof(C_MPLimb_t));
+ fprintf (sizesFd, "objptr = %"PRIuMAX"\n", (uintmax_t)sizeof(objptr));
+ fprintf (sizesFd, "seqIndex = %"PRIuMAX"\n", (uintmax_t)sizeof(GC_arrayLength));
fclose_safe(sizesFd);
Modified: mlton/trunk/runtime/platform.c
===================================================================
--- mlton/trunk/runtime/platform.c 2007-08-17 04:00:18 UTC (rev 5886)
+++ mlton/trunk/runtime/platform.c 2007-08-17 18:08:44 UTC (rev 5887)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2005 Henry Cejtin, Matthew Fluet, Suresh
+/* Copyright (C) 2004-2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
*
* MLton is released under a BSD-style license.
@@ -31,7 +31,7 @@
}
void MLton_allocTooLarge (void) {
- fprintf (stderr, "Out of memory: attempt to allocate more than %zu bytes.\n",
- (size_t)0x7FFFFFFF);
+ fprintf (stderr, "Out of memory: attempt to allocate more than %"PRIuMAX" bytes.\n",
+ (uintmax_t)0x7FFFFFFF);
exit (2);
}
Modified: mlton/trunk/runtime/util/to-string.c
===================================================================
--- mlton/trunk/runtime/util/to-string.c 2007-08-17 04:00:18 UTC (rev 5886)
+++ mlton/trunk/runtime/util/to-string.c 2007-08-17 18:08:44 UTC (rev 5887)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2005 Henry Cejtin, Matthew Fluet, Suresh
+/* Copyright (C) 2004-2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
*
* MLton is released under a BSD-style license.
@@ -51,7 +51,8 @@
s = "-170,141,183,460,469,231,731,687,303,715,884,105,728";
break;
default:
- die ("intmaxToCommaString: sizeof(intmax_t) = %zu", sizeof(intmax_t));
+ die ("intmaxToCommaString: sizeof(intmax_t) = %"PRIuMAX"",
+ (uintmax_t)sizeof(intmax_t));
break;
}
strncpy (buf + 1, s, strlen(s) + 1);
@@ -59,9 +60,9 @@
} else {
intmax_t m;
- if (n > 0)
- m = n;
- else
+ if (n > 0)
+ m = n;
+ else
m = -n;
while (m > 0) {
@@ -124,7 +125,8 @@
amount /= factor;
suffixIndex++;
}
- snprintf (buf, BUF_SIZE, "%zu%s", amount, suffixs[suffixIndex]);
+ snprintf (buf, BUF_SIZE, "%"PRIuMAX"%s",
+ (uintmax_t)amount, suffixs[suffixIndex]);
return buf;
}
#undef BUF_SIZE
More information about the MLton-commit
mailing list