Commit c38794d4 authored by Ian Lynagh's avatar Ian Lynagh

More OS X build fixes

parent f4d0e628
......@@ -80,7 +80,7 @@ disInstr ( StgBCO *bco, int pc )
pc += 1; break;
case bci_STKCHECK: {
StgWord stk_words_reqd = BCO_GET_LARGE_ARG + 1;
debugBelch("STKCHECK %" FMT_SizeT "\n", (W_)stk_words_reqd );
debugBelch("STKCHECK %" FMT_Word "\n", (W_)stk_words_reqd );
break;
}
case bci_PUSH_L:
......
......@@ -25,7 +25,7 @@ void getProcessTimes (Time *user, Time *elapsed);
void getUnixEpochTime (StgWord64 *sec, StgWord32 *nsec);
// Not strictly timing, but related
nat getPageFaults (void);
W_ getPageFaults (void);
#include "EndPrivate.h"
......
......@@ -1900,7 +1900,7 @@ mmap_again:
MAP_PRIVATE|TRY_MAP_32BIT|fixed|flags, fd, 0);
if (result == MAP_FAILED) {
sysErrorBelch("mmap %" FMT_SizeT " bytes at %p",(W_)size,map_addr);
sysErrorBelch("mmap %" FMT_Word " bytes at %p",(W_)size,map_addr);
errorBelch("Try specifying an address with +RTS -xm<addr> -RTS");
stg_exit(EXIT_FAILURE);
}
......@@ -1943,7 +1943,7 @@ mmap_again:
}
#endif
IF_DEBUG(linker, debugBelch("mmapForLinker: mapped %" FMT_SizeT " bytes starting at %p\n", (W_)size, result));
IF_DEBUG(linker, debugBelch("mmapForLinker: mapped %" FMT_Word " bytes starting at %p\n", (W_)size, result));
IF_DEBUG(linker, debugBelch("mmapForLinker: done\n"));
return result;
}
......
......@@ -300,21 +300,21 @@ printClosure( StgClosure *obj )
StgWord i;
debugBelch("ARR_WORDS(\"");
for (i=0; i<arr_words_words((StgArrWords *)obj); i++)
debugBelch("%" FMT_SizeT, (W_)((StgArrWords *)obj)->payload[i]);
debugBelch("%" FMT_Word, (W_)((StgArrWords *)obj)->payload[i]);
debugBelch("\")\n");
break;
}
case MUT_ARR_PTRS_CLEAN:
debugBelch("MUT_ARR_PTRS_CLEAN(size=%" FMT_SizeT ")\n", (W_)((StgMutArrPtrs *)obj)->ptrs);
debugBelch("MUT_ARR_PTRS_CLEAN(size=%" FMT_Word ")\n", (W_)((StgMutArrPtrs *)obj)->ptrs);
break;
case MUT_ARR_PTRS_DIRTY:
debugBelch("MUT_ARR_PTRS_DIRTY(size=%" FMT_SizeT ")\n", (W_)((StgMutArrPtrs *)obj)->ptrs);
debugBelch("MUT_ARR_PTRS_DIRTY(size=%" FMT_Word ")\n", (W_)((StgMutArrPtrs *)obj)->ptrs);
break;
case MUT_ARR_PTRS_FROZEN:
debugBelch("MUT_ARR_PTRS_FROZEN(size=%" FMT_SizeT ")\n", (W_)((StgMutArrPtrs *)obj)->ptrs);
debugBelch("MUT_ARR_PTRS_FROZEN(size=%" FMT_Word ")\n", (W_)((StgMutArrPtrs *)obj)->ptrs);
break;
case MVAR_CLEAN:
......@@ -431,7 +431,7 @@ printSmallBitmap( StgPtr spBottom, StgPtr payload, StgWord bitmap, nat size )
printPtr((P_)payload[i]);
debugBelch("\n");
} else {
debugBelch("Word# %" FMT_SizeT "\n", (W_)payload[i]);
debugBelch("Word# %" FMT_Word "\n", (W_)payload[i]);
}
}
}
......@@ -447,12 +447,12 @@ printLargeBitmap( StgPtr spBottom, StgPtr payload, StgLargeBitmap* large_bitmap,
StgWord bitmap = large_bitmap->bitmap[bmp];
j = 0;
for(; i < size && j < BITS_IN(W_); j++, i++, bitmap >>= 1 ) {
debugBelch(" stk[%" FMT_SizeT "] (%p) = ", (W_)(spBottom-(payload+i)), payload+i);
debugBelch(" stk[%" FMT_Word "] (%p) = ", (W_)(spBottom-(payload+i)), payload+i);
if ((bitmap & 1) == 0) {
printPtr((P_)payload[i]);
debugBelch("\n");
} else {
debugBelch("Word# %" FMT_SizeT "\n", (W_)payload[i]);
debugBelch("Word# %" FMT_Word "\n", (W_)payload[i]);
}
}
}
......
......@@ -1542,7 +1542,7 @@ decodeSize(const char *flag, nat offset, StgWord64 min, StgWord64 max)
if (m < 0 || val < min || val > max) {
// printf doesn't like 64-bit format specs on Windows
// apparently, so fall back to unsigned long.
errorBelch("error in RTS option %s: size outside allowed range (%" FMT_SizeT " - %" FMT_SizeT ")", flag, (W_)min, (W_)max);
errorBelch("error in RTS option %s: size outside allowed range (%" FMT_Word " - %" FMT_Word ")", flag, (W_)min, (W_)max);
stg_exit(EXIT_FAILURE);
}
......
......@@ -381,12 +381,12 @@ stat_endGC (Capability *cap, gc_thread *gct,
gc_cpu = cpu - gct->gc_start_cpu;
if (RtsFlags.GcFlags.giveStats == VERBOSE_GC_STATS) {
nat faults = getPageFaults();
W_ faults = getPageFaults();
statsPrintf("%9" FMT_SizeT " %9" FMT_SizeT " %9" FMT_SizeT,
alloc*sizeof(W_), copied*sizeof(W_),
live*sizeof(W_));
statsPrintf(" %5.2f %5.2f %7.2f %7.2f %4" FMT_SizeT " %4" FMT_SizeT " (Gen: %2d)\n",
statsPrintf(" %5.2f %5.2f %7.2f %7.2f %4" FMT_Word " %4" FMT_Word " (Gen: %2d)\n",
TimeToSecondsDbl(gc_cpu),
TimeToSecondsDbl(gc_elapsed),
TimeToSecondsDbl(cpu),
......@@ -666,7 +666,7 @@ stat_exit(int alloc)
if ( residency_samples > 0 ) {
showStgWord64(max_residency*sizeof(W_),
temp, rtsTrue/*commas*/);
statsPrintf("%16s bytes maximum residency (%" FMT_SizeT " sample(s))\n",
statsPrintf("%16s bytes maximum residency (%" FMT_Word " sample(s))\n",
temp, residency_samples);
}
......@@ -896,12 +896,12 @@ statDescribeGens(void)
gen_blocks += gcThreadLiveBlocks(i,g);
}
debugBelch("%5d %7" FMT_SizeT " %9d", g, (W_)gen->max_blocks, mut);
debugBelch("%5d %7" FMT_Word " %9d", g, (W_)gen->max_blocks, mut);
gen_slop = gen_blocks * BLOCK_SIZE_W - gen_live;
debugBelch("%8" FMT_SizeT " %8d %8" FMT_SizeT " %8" FMT_SizeT "\n", gen_blocks, lge,
gen_live*sizeof(W_), gen_slop*sizeof(W_));
debugBelch("%8" FMT_Word " %8d %8" FMT_Word " %8" FMT_Word "\n", gen_blocks, lge,
gen_live*(W_)sizeof(W_), gen_slop*(W_)sizeof(W_));
tot_live += gen_live;
tot_slop += gen_slop;
}
......
......@@ -203,37 +203,37 @@ static void traceSchedEvent_stderr (Capability *cap, EventTypeNum tag,
tracePreface();
switch (tag) {
case EVENT_CREATE_THREAD: // (cap, thread)
debugBelch("cap %d: created thread %" FMT_SizeT "\n",
debugBelch("cap %d: created thread %" FMT_Word "\n",
cap->no, (W_)tso->id);
break;
case EVENT_RUN_THREAD: // (cap, thread)
debugBelch("cap %d: running thread %" FMT_SizeT " (%s)\n",
debugBelch("cap %d: running thread %" FMT_Word " (%s)\n",
cap->no, (W_)tso->id, what_next_strs[tso->what_next]);
break;
case EVENT_THREAD_RUNNABLE: // (cap, thread)
debugBelch("cap %d: thread %" FMT_SizeT " appended to run queue\n",
debugBelch("cap %d: thread %" FMT_Word " appended to run queue\n",
cap->no, (W_)tso->id);
break;
case EVENT_MIGRATE_THREAD: // (cap, thread, new_cap)
debugBelch("cap %d: thread %" FMT_SizeT " migrating to cap %d\n",
debugBelch("cap %d: thread %" FMT_Word " migrating to cap %d\n",
cap->no, (W_)tso->id, (int)info1);
break;
case EVENT_THREAD_WAKEUP: // (cap, thread, info1_cap)
debugBelch("cap %d: waking up thread %" FMT_SizeT " on cap %d\n",
debugBelch("cap %d: waking up thread %" FMT_Word " on cap %d\n",
cap->no, (W_)tso->id, (int)info1);
break;
case EVENT_STOP_THREAD: // (cap, thread, status)
if (info1 == 6 + BlockedOnBlackHole) {
debugBelch("cap %d: thread %" FMT_SizeT " stopped (blocked on black hole owned by thread %lu)\n",
debugBelch("cap %d: thread %" FMT_Word " stopped (blocked on black hole owned by thread %lu)\n",
cap->no, (W_)tso->id, (long)info2);
} else {
debugBelch("cap %d: thread %" FMT_SizeT " stopped (%s)\n",
debugBelch("cap %d: thread %" FMT_Word " stopped (%s)\n",
cap->no, (W_)tso->id, thread_stop_reasons[info1]);
}
break;
default:
debugBelch("cap %d: thread %" FMT_SizeT ": event %d\n\n",
debugBelch("cap %d: thread %" FMT_Word ": event %d\n\n",
cap->no, (W_)tso->id, tag);
break;
}
......@@ -423,17 +423,17 @@ void traceCapsetEvent (EventTypeNum tag,
tracePreface();
switch (tag) {
case EVENT_CAPSET_CREATE: // (capset, capset_type)
debugBelch("created capset %" FMT_SizeT " of type %d\n", (W_)capset, (int)info);
debugBelch("created capset %" FMT_Word " of type %d\n", (W_)capset, (int)info);
break;
case EVENT_CAPSET_DELETE: // (capset)
debugBelch("deleted capset %" FMT_SizeT "\n", (W_)capset);
debugBelch("deleted capset %" FMT_Word "\n", (W_)capset);
break;
case EVENT_CAPSET_ASSIGN_CAP: // (capset, capno)
debugBelch("assigned cap %" FMT_SizeT " to capset %" FMT_SizeT "\n",
debugBelch("assigned cap %" FMT_Word " to capset %" FMT_Word "\n",
(W_)info, (W_)capset);
break;
case EVENT_CAPSET_REMOVE_CAP: // (capset, capno)
debugBelch("removed cap %" FMT_SizeT " from capset %" FMT_SizeT "\n",
debugBelch("removed cap %" FMT_Word " from capset %" FMT_Word "\n",
(W_)info, (W_)capset);
break;
}
......@@ -716,7 +716,7 @@ void traceThreadLabel_(Capability *cap,
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
ACQUIRE_LOCK(&trace_utx);
tracePreface();
debugBelch("cap %d: thread %" FMT_SizeT " has label %s\n",
debugBelch("cap %d: thread %" FMT_Word " has label %s\n",
cap->no, (W_)tso->id, label);
RELEASE_LOCK(&trace_utx);
} else
......
......@@ -12,6 +12,6 @@
void
MallocFailHook (W_ request_size /* in bytes */, char *msg)
{
fprintf(stderr, "malloc: failed on request for %" FMT_SizeT " bytes; message: %s\n", request_size, msg);
fprintf(stderr, "malloc: failed on request for %" FMT_Word " bytes; message: %s\n", request_size, msg);
}
......@@ -15,7 +15,7 @@ OutOfHeapHook (W_ request_size, W_ heap_size) /* both sizes in bytes */
(void)request_size; /* keep gcc -Wall happy */
if (heap_size > 0) {
errorBelch("Heap exhausted;\nCurrent maximum heap size is %" FMT_SizeT " bytes (%" FMT_SizeT " MB);\nuse `+RTS -M<size>' to increase it.",
errorBelch("Heap exhausted;\nCurrent maximum heap size is %" FMT_Word " bytes (%" FMT_Word " MB);\nuse `+RTS -M<size>' to increase it.",
heap_size, heap_size / (1024*1024));
} else {
errorBelch("out of memory");
......
......@@ -12,6 +12,6 @@
void
StackOverflowHook (W_ stack_size) /* in bytes */
{
fprintf(stderr, "Stack space overflow: current size %" FMT_SizeT " bytes.\nUse `+RTS -Ksize -RTS' to increase it.\n", stack_size);
fprintf(stderr, "Stack space overflow: current size %" FMT_Word " bytes.\nUse `+RTS -Ksize -RTS' to increase it.\n", stack_size);
}
......@@ -218,7 +218,7 @@ void getUnixEpochTime(StgWord64 *sec, StgWord32 *nsec)
#endif
}
nat
W_
getPageFaults(void)
{
#if !defined(HAVE_GETRUSAGE) || irix_HOST_OS || haiku_HOST_OS
......
......@@ -107,7 +107,7 @@ my_mmap (void *addr, W_ size)
if(err) {
// don't know what the error codes mean exactly, assume it's
// not our problem though.
errorBelch("memory allocation failed (requested %lu bytes)", size);
errorBelch("memory allocation failed (requested %" FMT_Word " bytes)", size);
stg_exit(EXIT_FAILURE);
} else {
vm_protect(mach_task_self(),(vm_address_t)ret,size,FALSE,VM_PROT_READ|VM_PROT_WRITE);
......@@ -122,7 +122,7 @@ my_mmap (void *addr, W_ size)
(errno == EINVAL && sizeof(void*)==4 && size >= 0xc0000000)) {
// If we request more than 3Gig, then we get EINVAL
// instead of ENOMEM (at least on Linux).
errorBelch("out of memory (requested %" FMT_SizeT " bytes)", size);
errorBelch("out of memory (requested %" FMT_Word " bytes)", size);
stg_exit(EXIT_FAILURE);
} else {
barf("getMBlock: mmap: %s", strerror(errno));
......
......@@ -918,23 +918,23 @@ memInventory (rtsBool show)
debugBelch("Memory inventory:\n");
}
for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
debugBelch(" gen %d blocks : %5" FMT_SizeT " blocks (%6.1lf MB)\n", g,
debugBelch(" gen %d blocks : %5" FMT_Word " blocks (%6.1lf MB)\n", g,
gen_blocks[g], MB(gen_blocks[g]));
}
debugBelch(" nursery : %5" FMT_SizeT " blocks (%6.1lf MB)\n",
debugBelch(" nursery : %5" FMT_Word " blocks (%6.1lf MB)\n",
nursery_blocks, MB(nursery_blocks));
debugBelch(" retainer : %5" FMT_SizeT " blocks (%6.1lf MB)\n",
debugBelch(" retainer : %5" FMT_Word " blocks (%6.1lf MB)\n",
retainer_blocks, MB(retainer_blocks));
debugBelch(" arena blocks : %5" FMT_SizeT " blocks (%6.1lf MB)\n",
debugBelch(" arena blocks : %5" FMT_Word " blocks (%6.1lf MB)\n",
arena_blocks, MB(arena_blocks));
debugBelch(" exec : %5" FMT_SizeT " blocks (%6.1lf MB)\n",
debugBelch(" exec : %5" FMT_Word " blocks (%6.1lf MB)\n",
exec_blocks, MB(exec_blocks));
debugBelch(" free : %5" FMT_SizeT " blocks (%6.1lf MB)\n",
debugBelch(" free : %5" FMT_Word " blocks (%6.1lf MB)\n",
free_blocks, MB(free_blocks));
debugBelch(" total : %5" FMT_SizeT " blocks (%6.1lf MB)\n",
debugBelch(" total : %5" FMT_Word " blocks (%6.1lf MB)\n",
live_blocks + free_blocks, MB(live_blocks+free_blocks));
if (leak) {
debugBelch("\n in system : %5" FMT_SizeT " blocks (%" FMT_SizeT " MB)\n",
debugBelch("\n in system : %5" FMT_Word " blocks (%" FMT_Word " MB)\n",
mblocks_allocated * BLOCKS_PER_MBLOCK, mblocks_allocated);
}
}
......
......@@ -153,7 +153,7 @@ getUnixEpochTime(StgWord64 *sec, StgWord32 *nsec)
*nsec = ((unsigned long)(unixtime.QuadPart % 10000000ull)) * 100ul;
}
nat
W_
getPageFaults(void)
{
/* ToDo (on NT): better, get this via the performance data
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment