diff --git a/mps/code/arena.c b/mps/code/arena.c index 4436e10ccf5..704d13f60db 100644 --- a/mps/code/arena.c +++ b/mps/code/arena.c @@ -172,7 +172,7 @@ Res ArenaInit(Arena arena, ArenaClass class) arena->spareCommitted = (Size)0; arena->spareCommitLimit = ARENA_INIT_SPARE_COMMIT_LIMIT; /* alignment is usually overridden by init */ - arena->alignment = 1 << ARENA_ZONESHIFT; + arena->alignment = (Align)1 << ARENA_ZONESHIFT; /* zoneShift is usually overridden by init */ arena->zoneShift = ARENA_ZONESHIFT; arena->poolReady = FALSE; /* */ diff --git a/mps/code/arenavm.c b/mps/code/arenavm.c index 40a4d28a9b7..2b8a473d6bd 100644 --- a/mps/code/arenavm.c +++ b/mps/code/arenavm.c @@ -1086,9 +1086,10 @@ static Res vmArenaExtend(VMArena vmArena, Size size) DIAG_SINGLEF(( "vmArenaExtend_Start", - "to accommodate size $W, try chunkSize $W", size, chunkSize, + "to accommodate size $W, try chunkSize $W", (WriteFW)size, (WriteFW)chunkSize, " (VMArenaReserved currently $W bytes)\n", - VMArenaReserved(VMArena2Arena(vmArena)), NULL )); + (WriteFW)VMArenaReserved(VMArena2Arena(vmArena)), + NULL )); /* .chunk-create.fail: If we fail, try again with a smaller size */ { @@ -1111,9 +1112,10 @@ static Res vmArenaExtend(VMArena vmArena, Size size) for(; chunkSize > chunkHalf; chunkSize -= sliceSize) { if(chunkSize < chunkMin) { DIAG_SINGLEF(( "vmArenaExtend_FailMin", - "no remaining address-space chunk >= min($W)", chunkMin, + "no remaining address-space chunk >= min($W)", (WriteFW)chunkMin, " (so VMArenaReserved remains $W bytes)\n", - VMArenaReserved(VMArena2Arena(vmArena)), NULL )); + (WriteFW)VMArenaReserved(VMArena2Arena(vmArena)), + NULL )); return ResRESOURCE; } res = VMChunkCreate(&newChunk, vmArena, chunkSize); @@ -1126,9 +1128,10 @@ static Res vmArenaExtend(VMArena vmArena, Size size) vmArenaExtend_Done: DIAG_SINGLEF(( "vmArenaExtend_Done", - "Request for new chunk of VM $W bytes succeeded", chunkSize, + "Request for new chunk of VM $W bytes succeeded", (WriteFW)chunkSize, " (VMArenaReserved now $W bytes)\n", - VMArenaReserved(VMArena2Arena(vmArena)), NULL )); + (WriteFW)VMArenaReserved(VMArena2Arena(vmArena)), + NULL )); return res; } @@ -1628,16 +1631,16 @@ static void VMFree(Addr base, Size size, Pool pool) * Input: 208896 * Output: (Megabytes) 0m209 */ -#define bPerM (1000000UL) /* Megabytes */ -#define bThou (1000UL) +#define bPerM ((Size)1000000) /* Megabytes */ +#define bThou ((Size)1000) DIAG_DECL( -static Count M_whole(size_t bytes) +static Count M_whole(Size bytes) { - size_t M; /* MBs */ + Count M; /* MBs */ M = (bytes + (bThou / 2)) / bPerM; return M; } -static Count M_frac(size_t bytes) +static Count M_frac(Size bytes) { Count Mthou; /* thousandths of a MB */ Mthou = (bytes + (bThou / 2)) / bThou; @@ -1689,16 +1692,22 @@ static void VMCompact(Arena arena, Trace trace) || vmem0 != vmem1 || vmem1 != vmem2) { DIAG_SINGLEF(( "VMCompact", - "pre-collection vmem was $Um$3, ", M_whole(vmem0), M_frac(vmem0), - "peaked at $Um$3, ", M_whole(vmem1), M_frac(vmem1), - "released $Um$3, ", M_whole(vmemD), M_frac(vmemD), - "now $Um$3", M_whole(vmem2), M_frac(vmem2), - " (why $U", trace->why, - ": $Um$3", M_whole(trace->condemned), M_frac(trace->condemned), - "[->$Um$3", M_whole(live), M_frac(live), - " $U%-live", livePerc, - " $Um$3-stuck]", M_whole(trace->preservedInPlaceSize), M_frac(trace->preservedInPlaceSize), - " ($Um$3-not)", M_whole(trace->notCondemned), M_frac(trace->notCondemned), + "pre-collection vmem was $Um$3, ", + (WriteFU)M_whole(vmem0), (WriteFU)M_frac(vmem0), + "peaked at $Um$3, ", (WriteFU)M_whole(vmem1), (WriteFU)M_frac(vmem1), + "released $Um$3, ", (WriteFU)M_whole(vmemD), (WriteFU)M_frac(vmemD), + "now $Um$3", (WriteFU)M_whole(vmem2), (WriteFU)M_frac(vmem2), + " (why $U", (WriteFU)trace->why, + ": $Um$3", + (WriteFU)M_whole(trace->condemned), (WriteFU)M_frac(trace->condemned), + "[->$Um$3", (WriteFU)M_whole(live), (WriteFU)M_frac(live), + " $U%-live", (WriteFU)livePerc, + " $Um$3-stuck]", + (WriteFU)M_whole(trace->preservedInPlaceSize), + (WriteFU)M_frac(trace->preservedInPlaceSize), + " ($Um$3-not)", + (WriteFU)M_whole(trace->notCondemned), + (WriteFU)M_frac(trace->notCondemned), " )", NULL)); } diff --git a/mps/code/awlut.c b/mps/code/awlut.c index ddcd1c7ab5d..d52abae9030 100644 --- a/mps/code/awlut.c +++ b/mps/code/awlut.c @@ -43,9 +43,9 @@ static mps_word_t wrapper_wrapper[] = { UNINIT, /* wrapper */ UNINIT, /* class */ 0, /* Extra word */ - 4uL<<2|2, /* F */ - 2uL<<(MPS_WORD_WIDTH - 8), /* V */ - 1uL<<2|1, /* VL */ + (mps_word_t)4<<2|2, /* F */ + (mps_word_t)2<<(MPS_WORD_WIDTH - 8), /* V */ + (mps_word_t)1<<2|1, /* VL */ 1 /* patterns */ }; @@ -55,7 +55,7 @@ static mps_word_t string_wrapper[] = { UNINIT, /* class */ 0, /* extra word */ 0, /* F */ - 2uL<<(MPS_WORD_WIDTH - 8)|3uL<<3|4, /* V */ + (mps_word_t)2<<(MPS_WORD_WIDTH - 8)|(mps_word_t)3<<3|4, /* V */ 1 /* VL */ }; @@ -63,8 +63,8 @@ static mps_word_t table_wrapper[] = { UNINIT, /* wrapper */ UNINIT, /* class */ 0, /* extra word */ - 1uL<<2|1, /* F */ - 2uL<<(MPS_WORD_WIDTH - 8)|2, /* V */ + (mps_word_t)1<<2|1, /* F */ + (mps_word_t)2<<(MPS_WORD_WIDTH - 8)|2, /* V */ 1 /* VL */ }; diff --git a/mps/code/awluthe.c b/mps/code/awluthe.c index be40f115b38..d70d12cb342 100644 --- a/mps/code/awluthe.c +++ b/mps/code/awluthe.c @@ -44,9 +44,9 @@ static mps_word_t wrapper_wrapper[] = { UNINIT, /* wrapper */ UNINIT, /* class */ 0, /* Extra word */ - 4uL<<2|2, /* F */ - 2uL<<(MPS_WORD_WIDTH - 8), /* V */ - 1uL<<2|1, /* VL */ + (mps_word_t)4<<2|2, /* F */ + (mps_word_t)2<<(MPS_WORD_WIDTH - 8), /* V */ + (mps_word_t)1<<2|1, /* VL */ 1 /* patterns */ }; @@ -56,7 +56,7 @@ static mps_word_t string_wrapper[] = { UNINIT, /* class */ 0, /* extra word */ 0, /* F */ - 2uL<<(MPS_WORD_WIDTH - 8)|3uL<<3|4, /* V */ + (mps_word_t)2<<(MPS_WORD_WIDTH - 8)|(mps_word_t)3<<3|4, /* V */ 1 /* VL */ }; @@ -64,8 +64,8 @@ static mps_word_t table_wrapper[] = { UNINIT, /* wrapper */ UNINIT, /* class */ 0, /* extra word */ - 1uL<<2|1, /* F */ - 2uL<<(MPS_WORD_WIDTH - 8)|2, /* V */ + (mps_word_t)1<<2|1, /* F */ + (mps_word_t)2<<(MPS_WORD_WIDTH - 8)|2, /* V */ 1 /* VL */ }; diff --git a/mps/code/awlutth.c b/mps/code/awlutth.c index 37a27fc0125..26ef8c2c70d 100644 --- a/mps/code/awlutth.c +++ b/mps/code/awlutth.c @@ -45,9 +45,9 @@ static mps_word_t wrapper_wrapper[] = { UNINIT, /* wrapper */ UNINIT, /* class */ 0, /* Extra word */ - 4uL<<2|2, /* F */ - 2uL<<(MPS_WORD_WIDTH - 8), /* V */ - 1uL<<2|1, /* VL */ + (mps_word_t)4<<2|2, /* F */ + (mps_word_t)2<<(MPS_WORD_WIDTH - 8), /* V */ + (mps_word_t)1<<2|1, /* VL */ 1 /* patterns */ }; @@ -57,7 +57,7 @@ static mps_word_t string_wrapper[] = { UNINIT, /* class */ 0, /* extra word */ 0, /* F */ - 2uL<<(MPS_WORD_WIDTH - 8)|3uL<<3|4, /* V */ + (mps_word_t)2<<(MPS_WORD_WIDTH - 8)|(mps_word_t)3<<3|4, /* V */ 1 /* VL */ }; @@ -65,8 +65,8 @@ static mps_word_t table_wrapper[] = { UNINIT, /* wrapper */ UNINIT, /* class */ 0, /* extra word */ - 1uL<<2|1, /* F */ - 2uL<<(MPS_WORD_WIDTH - 8)|2, /* V */ + (mps_word_t)1<<2|1, /* F */ + (mps_word_t)2<<(MPS_WORD_WIDTH - 8)|2, /* V */ 1 /* VL */ }; diff --git a/mps/code/config.h b/mps/code/config.h index ca6e796e48c..025e775ea88 100644 --- a/mps/code/config.h +++ b/mps/code/config.h @@ -193,7 +193,7 @@ * design.mps.poolepvm.arch.segment.size. */ -#define EPVMDefaultSubsequentSegSIZE (64ul * 1024) +#define EPVMDefaultSubsequentSegSIZE ((Size)64 * 1024) /* Arena Configuration -- see diff --git a/mps/code/diag.c b/mps/code/diag.c index 03d95492c90..1cca976da03 100644 --- a/mps/code/diag.c +++ b/mps/code/diag.c @@ -194,7 +194,7 @@ enum { static void version_diag(void) { DIAG_SINGLEF(( "MPSVersion", - "$S", MPSVersion(), NULL )); + "$S", (WriteFS)MPSVersion(), NULL )); } static void rules_diag(Rule rules) @@ -207,8 +207,8 @@ static void rules_diag(Rule rules) " rules:\n", NULL )); for(ir = 0; rules[ir].action != NULL; ir++) { DIAG_DECL( Rule rule = &rules[ir]; ) - DIAG_MOREF(( "$S$S/$S/$S\n", rule->action, rule->tag, - rule->para, rule->line, + DIAG_MOREF(( "$S$S/$S/$S\n", (WriteFS)rule->action, (WriteFS)rule->tag, + (WriteFS)rule->para, (WriteFS)rule->line, NULL )); } DIAG_END("DiagFilter_Rules"); @@ -378,7 +378,7 @@ static void filterStream_Output(Diag diag, Rule rules) if(rules[ir].action[0] == '+' || diag->overflow) { if(nolinesyet) { res = WriteF(filterStream_under(), - DIAG_PREFIX_TAGSTART "$S {", diag->tag, NULL); + DIAG_PREFIX_TAGSTART "$S {", (WriteFS)diag->tag, NULL); AVER(res == ResOK); nolinesyet = FALSE; } @@ -452,7 +452,7 @@ static void filterStream_TagEnd(mps_lib_FILE *stream, const char *tag) (void) WriteF(filterStream_under(), "\nWARNING: diag tag \"$S\" is current, " "but got DIAG_END(\"$S\"). (They must match).", - diag->tag, tag, NULL); + (WriteFS)diag->tag, (WriteFS)tag, NULL); } AVER(StringEqual(diag->tag, tag)); @@ -551,7 +551,7 @@ static void diagTagBegin(mps_lib_FILE *stream, const char *tag) filterStream_TagBegin(stream, tag); } else { Res res; - res = WriteF(stream, DIAG_PREFIX_TAGSTART "$S {\n", tag, NULL); + res = WriteF(stream, DIAG_PREFIX_TAGSTART "$S {\n", (WriteFS)tag, NULL); AVER(res == ResOK); } } @@ -672,7 +672,7 @@ static void patternOccurs_test(Bool expect, const char *patt, static void diag_test(void) { - DIAG_SINGLEF(( "DIAGTEST_Tag1", "text $U.\n", 42, NULL )); + DIAG_SINGLEF(( "DIAGTEST_Tag1", "text $U.\n", (WriteFU)42, NULL )); DIAG_SINGLEF(( "DIAGTEST_EmptyDiag", NULL )); @@ -682,12 +682,12 @@ static void diag_test(void) StringEqual("Fred", "Fred"), NULL )); - DIAG_MOREF(("Fred = Tom: $U.\n", StringEqual("Fred", "Tom"), NULL)); - DIAG_MOREF(("Tom = Fred: $U.\n", StringEqual("Tom", "Fred"), NULL)); - DIAG_MOREF(("0 = Fred: $U.\n", StringEqual("", "Fred"), NULL)); - DIAG_MOREF(("Fred = 0: $U.\n", StringEqual("Fred", ""), NULL)); - DIAG_MOREF(("0 = 0: $U.\n", StringEqual("", ""), NULL)); - DIAG_MOREF(("0 = 000: $U.\n", StringEqual("", "\0\0"), NULL)); + DIAG_MOREF(("Fred = Tom: $U.\n", (WriteFU)StringEqual("Fred", "Tom"), NULL)); + DIAG_MOREF(("Tom = Fred: $U.\n", (WriteFU)StringEqual("Tom", "Fred"), NULL)); + DIAG_MOREF(("0 = Fred: $U.\n", (WriteFU)StringEqual("", "Fred"), NULL)); + DIAG_MOREF(("Fred = 0: $U.\n", (WriteFU)StringEqual("Fred", ""), NULL)); + DIAG_MOREF(("0 = 0: $U.\n", (WriteFU)StringEqual("", ""), NULL)); + DIAG_MOREF(("0 = 000: $U.\n", (WriteFU)StringEqual("", "\0\0"), NULL)); DIAG_END("DIAGTEST_StringEqual"); DIAG_FIRSTF(( "DIAGTEST_patternOccurs", NULL )); @@ -718,11 +718,11 @@ static void diag_test(void) DIAG_END("DIAGTEST_patternOccurs"); #if 0 - DIAG_FIRSTF(( "TestTag2", "text $U.\n", 42, NULL )); + DIAG_FIRSTF(( "TestTag2", "text $U.\n", (WriteFU)42, NULL )); DIAG_MOREF(( NULL )); - DIAG_MOREF(( "string $S.\n", "fooey!", NULL )); + DIAG_MOREF(( "string $S.\n", (WriteFS)"fooey!", NULL )); DIAG_MOREF(( NULL )); - DIAG_MOREF(( "Another string $S.\n", "baloney!", NULL )); + DIAG_MOREF(( "Another string $S.\n", (WriteFS)"baloney!", NULL )); DIAG_END( "TestTag2" ); #endif } diff --git a/mps/code/fmtdy.c b/mps/code/fmtdy.c index 1485476394f..ec87c1fa001 100644 --- a/mps/code/fmtdy.c +++ b/mps/code/fmtdy.c @@ -247,7 +247,7 @@ extern mps_addr_t dylan_weak_dependent(mps_addr_t parent) ff = fword & 3; /* traceable fixed part */ assert(ff == 1); - fl = fword & ~3uL; + fl = fword & ~(mps_word_t)3; /* at least one fixed field */ assert(fl >= 1); return (mps_addr_t) object[1]; @@ -354,7 +354,7 @@ static mps_res_t dylan_scan_pat(mps_ss_t mps_ss, #define NONWORD_LENGTH(_vt, _es) \ ((_es) < MPS_WORD_SHIFT ? \ - ((_vt) + (1 << (MPS_WORD_SHIFT - (_es))) - 1) >> \ + ((_vt) + ((mps_word_t)1 << (MPS_WORD_SHIFT - (_es))) - 1) >> \ (MPS_WORD_SHIFT - (_es)) : \ (_vt) << ((_es) - MPS_WORD_SHIFT)) diff --git a/mps/code/fmthe.h b/mps/code/fmthe.h index 391ead0ef55..369a6b4a926 100644 --- a/mps/code/fmthe.h +++ b/mps/code/fmthe.h @@ -21,9 +21,9 @@ extern mps_res_t HeaderWeakFormatCheck(mps_addr_t addr); #define realTYPE 0x33 #define realHeader (realTYPE + 0x12345600) #define padTYPE 0xaa -#define headerType(header) ((header) & ((1 << headerTypeBits) - 1)) +#define headerType(header) ((header) & (((mps_word_t)1 << headerTypeBits) - 1)) #define headerPadSize(header) ((header) >> headerTypeBits) -#define padHeader(size) ((size << headerTypeBits) | padTYPE) +#define padHeader(size) (((mps_word_t)size << headerTypeBits) | padTYPE) #endif /* fmthe_h */ diff --git a/mps/code/locus.c b/mps/code/locus.c index 2c94d0f71b3..56e7a1208c6 100644 --- a/mps/code/locus.c +++ b/mps/code/locus.c @@ -296,9 +296,9 @@ Res ChainCondemnAuto(double *mortalityReturn, Chain chain, Trace trace) } while (genNewSize >= gen->capacity * (Size)1024); DIAG_SINGLEF(( "ChainCondemnAuto", - "condemn gens [0..$U]", topCondemnedGenSerial, - " (of $U)", chain->genCount, - " of this chain $P.", (void*)chain, + "condemn gens [0..$U]", (WriteFU)topCondemnedGenSerial, + " (of $U)", (WriteFU)chain->genCount, + " of this chain $P.", (WriteFP)chain, NULL )); /* Condemn everything in these zones. */ diff --git a/mps/code/mpm.c b/mps/code/mpm.c index 8af2ffff7ee..4f9af3f888c 100644 --- a/mps/code/mpm.c +++ b/mps/code/mpm.c @@ -34,7 +34,7 @@ unsigned CheckLevel = CHECKLEVEL_INITIAL; Bool MPMCheck(void) { CHECKL(sizeof(Word) * CHAR_BIT == MPS_WORD_WIDTH); - CHECKL(1uL << MPS_WORD_SHIFT == MPS_WORD_WIDTH); + CHECKL((Word)1 << MPS_WORD_SHIFT == MPS_WORD_WIDTH); CHECKL(AlignCheck(MPS_PF_ALIGN)); /* Check that trace ids will fit in the TraceId type. */ CHECKL(TraceLIMIT <= UINT_MAX); @@ -52,10 +52,10 @@ Bool MPMCheck(void) CHECKL(!SizeIsAligned(31051, 1024)); CHECKL(!SizeIsP2(0)); CHECKL(SizeIsP2(128)); - CHECKL(SizeLog2(1L) == 0); - CHECKL(SizeLog2(256L) == 8); - CHECKL(SizeLog2(65536L) == 16); - CHECKL(SizeLog2(131072L) == 17); + CHECKL(SizeLog2((Size)1) == 0); + CHECKL(SizeLog2((Size)256) == 8); + CHECKL(SizeLog2((Size)65536) == 16); + CHECKL(SizeLog2((Size)131072) == 17); /* .check.writef: We check that various types will fit in a Word; */ /* See .writef.check. Don't need to check WriteFS or WriteFF as they */ diff --git a/mps/code/mps.h b/mps/code/mps.h index af718b7ce5d..fd2c850ccf0 100644 --- a/mps/code/mps.h +++ b/mps/code/mps.h @@ -631,7 +631,7 @@ extern mps_res_t mps_fix(mps_ss_t, mps_addr_t *); { #define MPS_FIX1(ss, ref) \ - (_mps_wt = 1uL << ((mps_word_t)(ref) >> _mps_w0 \ + (_mps_wt = (mps_word_t)1 << ((mps_word_t)(ref) >> _mps_w0 \ & (sizeof(mps_word_t) * CHAR_BIT - 1)), \ _mps_w2 |= _mps_wt, \ _mps_w1 & _mps_wt) diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c index fc33cbbe548..3614590c8a8 100644 --- a/mps/code/poolamc.c +++ b/mps/code/poolamc.c @@ -536,7 +536,7 @@ static Bool amcNailboardCheck(amcNailboard board) /* We know that shift corresponds to pool->align. */ CHECKL(BoolCheck(board->newMarks)); CHECKL(board->distinctNails <= board->nails); - CHECKL(1uL << board->markShift + CHECKL((Align)1 << board->markShift == PoolAlignment(amcGenPool(board->gen))); /* weak check for BTs @@@@ */ CHECKL(board->mark != NULL); @@ -2219,28 +2219,28 @@ static void AMCTraceEnd(Pool pool, Trace trace) if(amc->pageretstruct[ti].pRet >= pRetMin) { DIAG_SINGLEF(( "AMCTraceEnd_pageret", - " $U", ArenaEpoch(pool->arena), - " $U", trace->why, - " $S", trace->emergency ? "Emergency" : "-", - " $U", amc->pageretstruct[ti].pCond, - " $U", amc->pageretstruct[ti].pRet, ",", - " $U", amc->pageretstruct[ti].pCS, - " $U", amc->pageretstruct[ti].pRS, ",", - " $U", amc->pageretstruct[ti].sCM, - " $U", amc->pageretstruct[ti].pCM, - " $U", amc->pageretstruct[ti].sRM, - " $U", amc->pageretstruct[ti].pRM, - " $U", amc->pageretstruct[ti].pRM1, - " $U", amc->pageretstruct[ti].pRMrr, - " $U", amc->pageretstruct[ti].pRMr1, ",", - " $U", amc->pageretstruct[ti].sCL, - " $U", amc->pageretstruct[ti].pCL, - " $U", amc->pageretstruct[ti].sRL, - " $U", amc->pageretstruct[ti].pRL, - " $U", amc->pageretstruct[ti].pRLr, - " (page = $Ub,", ArenaAlign(pool->arena), - " Large >= $Up,", AMCLargeSegPAGES, - " pRetMin $U)", pRetMin, + " $U", (WriteFU)ArenaEpoch(pool->arena), + " $U", (WriteFU)trace->why, + " $S", (WriteFS)(trace->emergency ? "Emergency" : "-"), + " $U", (WriteFU)amc->pageretstruct[ti].pCond, + " $U", (WriteFU)amc->pageretstruct[ti].pRet, ",", + " $U", (WriteFU)amc->pageretstruct[ti].pCS, + " $U", (WriteFU)amc->pageretstruct[ti].pRS, ",", + " $U", (WriteFU)amc->pageretstruct[ti].sCM, + " $U", (WriteFU)amc->pageretstruct[ti].pCM, + " $U", (WriteFU)amc->pageretstruct[ti].sRM, + " $U", (WriteFU)amc->pageretstruct[ti].pRM, + " $U", (WriteFU)amc->pageretstruct[ti].pRM1, + " $U", (WriteFU)amc->pageretstruct[ti].pRMrr, + " $U", (WriteFU)amc->pageretstruct[ti].pRMr1, ",", + " $U", (WriteFU)amc->pageretstruct[ti].sCL, + " $U", (WriteFU)amc->pageretstruct[ti].pCL, + " $U", (WriteFU)amc->pageretstruct[ti].sRL, + " $U", (WriteFU)amc->pageretstruct[ti].pRL, + " $U", (WriteFU)amc->pageretstruct[ti].pRLr, + " (page = $Ub,", (WriteFU)ArenaAlign(pool->arena), + " Large >= $Up,", (WriteFU)AMCLargeSegPAGES, + " pRetMin $U)", (WriteFU)pRetMin, NULL )); } diff --git a/mps/code/poolawl.c b/mps/code/poolawl.c index 38673219495..bb010854a6a 100644 --- a/mps/code/poolawl.c +++ b/mps/code/poolawl.c @@ -1242,7 +1242,7 @@ static Bool AWLCheck(AWL awl) CHECKS(AWL, awl); CHECKD(Pool, &awl->poolStruct); CHECKL(awl->poolStruct.class == AWLPoolClassGet()); - CHECKL(1uL << awl->alignShift == awl->poolStruct.alignment); + CHECKL((Align)1 << awl->alignShift == awl->poolStruct.alignment); CHECKD(Chain, awl->chain); /* 30 is just a sanity check really, not a constraint. */ CHECKL(0 <= awl->gen); diff --git a/mps/code/poollo.c b/mps/code/poollo.c index c6f22a595cf..49346f4cb56 100644 --- a/mps/code/poollo.c +++ b/mps/code/poollo.c @@ -817,7 +817,7 @@ static Bool LOCheck(LO lo) CHECKD(Pool, &lo->poolStruct); CHECKL(lo->poolStruct.class == EnsureLOPoolClass()); CHECKL(ShiftCheck(lo->alignShift)); - CHECKL(1uL << lo->alignShift == PoolAlignment(&lo->poolStruct)); + CHECKL((Align)1 << lo->alignShift == PoolAlignment(&lo->poolStruct)); CHECKD(Chain, lo->chain); CHECKD(PoolGen, &lo->pgen); return TRUE; diff --git a/mps/code/ref.c b/mps/code/ref.c index a52fd60064b..fd11743cb1e 100644 --- a/mps/code/ref.c +++ b/mps/code/ref.c @@ -27,7 +27,7 @@ Bool RankCheck(Rank rank) Bool RankSetCheck(RankSet rankSet) { - CHECKL(rankSet < (1uL << RankLIMIT)); + CHECKL(rankSet < ((ULongest)1 << RankLIMIT)); UNUSED(rankSet); /* */ return TRUE; } diff --git a/mps/code/steptest.c b/mps/code/steptest.c index 821a0d5c95a..16477d10f8e 100644 --- a/mps/code/steptest.c +++ b/mps/code/steptest.c @@ -19,7 +19,7 @@ #include #include -#define testArenaSIZE ((size_t)(64l << 20)) +#define testArenaSIZE ((size_t)((size_t)64 << 20)) #define avLEN 3 #define exactRootsCOUNT 200 #define ambigRootsCOUNT 50 diff --git a/mps/code/table.c b/mps/code/table.c index e1db04202b3..772e45d9d30 100644 --- a/mps/code/table.c +++ b/mps/code/table.c @@ -157,7 +157,7 @@ extern Res TableCreate(Table *tableReturn, size_t length) if(table == NULL) goto failMallocTable; if (length < 2) length = 2; /* Table size is length rounded up to the next power of 2. */ - table->length = 1 << (sizeFloorLog2(length-1) + 1); + table->length = (size_t)1 << (sizeFloorLog2(length-1) + 1); table->count = 0; table->limit = (size_t)(.5 * length); table->array = malloc(sizeof(TableEntryStruct) * length); diff --git a/mps/code/trace.c b/mps/code/trace.c index e553d160318..0a7b73efa70 100644 --- a/mps/code/trace.c +++ b/mps/code/trace.c @@ -123,7 +123,7 @@ Bool TraceIdCheck(TraceId ti) Bool TraceSetCheck(TraceSet ts) { - CHECKL(ts < (1uL << TraceLIMIT)); + CHECKL(ts < ((ULongest)1 << TraceLIMIT)); UNUSED(ts); /* */ return TRUE; } @@ -309,7 +309,7 @@ static void traceSetSignalEmergency(TraceSet ts, Arena arena) Trace trace; DIAG_SINGLEF(( "traceSetSignalEmergency", - "traceSet: $B", ts, NULL )); + "traceSet: $B", (WriteFB)ts, NULL )); TRACE_SET_ITER(ti, trace, ts, arena) trace->emergency = TRUE; @@ -1527,20 +1527,20 @@ static void TraceStartGenDesc_diag(GenDesc desc, int i) NULL )); } else { DIAG_WRITEF(( DIAG_STREAM, - " GenDesc [$U]", i, + " GenDesc [$U]", (WriteFU)i, NULL )); } DIAG_WRITEF(( DIAG_STREAM, " $P capacity: $U KiB, mortality $D\n", - (void *)desc, desc->capacity, desc->mortality, - " ZoneSet:$B\n", desc->zones, + (WriteFP)desc, (WriteFU)desc->capacity, (WriteFD)desc->mortality, + " ZoneSet:$B\n", (WriteFB)desc->zones, NULL )); RING_FOR(n, &desc->locusRing, nn) { DIAG_DECL( PoolGen gen = RING_ELT(PoolGen, genRing, n); ) DIAG_WRITEF(( DIAG_STREAM, - " PoolGen $U ($S)", gen->nr, gen->pool->class->name, - " totalSize $U", gen->totalSize, - " newSize $U\n", gen->newSizeAtCreate, + " PoolGen $U ($S)", (WriteFU)gen->nr, (WriteFS)gen->pool->class->name, + " totalSize $U", (WriteFU)gen->totalSize, + " newSize $U\n", (WriteFU)gen->newSizeAtCreate, NULL )); } } @@ -1606,14 +1606,14 @@ void TraceStart(Trace trace, double mortality, double finishingTime) DIAG_FIRSTF(( "TraceStart", "because code $U: $S\n", - trace->why, TraceStartWhyToString(trace->why), + (WriteFU)trace->why, (WriteFS)TraceStartWhyToString(trace->why), NULL )); DIAG( ArenaDescribe(arena, DIAG_STREAM); ); DIAG_MOREF(( " white set:$B\n", - trace->white, + (WriteFB)trace->white, NULL )); { @@ -1626,7 +1626,7 @@ void TraceStart(Trace trace, double mortality, double finishingTime) RING_FOR(node, &arena->chainRing, nextNode) { Chain chain = RING_ELT(Chain, chainRing, node); DIAG_WRITEF(( DIAG_STREAM, - " Chain $P\n", (void *)chain, + " Chain $P\n", (WriteFP)chain, NULL )); for(i = 0; i < chain->genCount; ++i) { diff --git a/mps/code/vmix.c b/mps/code/vmix.c index 71f6354a32c..f5ba622f7c9 100644 --- a/mps/code/vmix.c +++ b/mps/code/vmix.c @@ -164,7 +164,9 @@ Res VMCreate(VM *vmReturn, Size size) DIAG_SINGLEF(( "VM_ix_Create_ok", "[$W..<$W>..$W)", - vm->base, (char*)vm->limit - (char*)vm->base, vm->limit, + (WriteFW)vm->base, + (WriteFW)AddrOffset(vm->base, vm->limit), + (WriteFW)vm->limit, NULL )); *vmReturn = vm; @@ -188,7 +190,9 @@ void VMDestroy(VM vm) DIAG_SINGLEF(( "VM_ix_Destroy", "[$W..<$W>..$W)", - vm->base, (char*)vm->limit - (char*)vm->base, vm->limit, + (WriteFW)vm->base, + (WriteFW)AddrOffset(vm->base, vm->limit), + (WriteFW)vm->limit, NULL )); /* This appears to be pretty pointless, since the descriptor */ diff --git a/mps/code/walkt0.c b/mps/code/walkt0.c index 44b7a38d1f4..1764b3f9f10 100644 --- a/mps/code/walkt0.c +++ b/mps/code/walkt0.c @@ -20,7 +20,7 @@ #include #include -#define testArenaSIZE ((size_t)(64l << 20)) +#define testArenaSIZE ((size_t)((size_t)64 << 20)) #define avLEN 3 #define exactRootsCOUNT 200 #define objCOUNT 20000 diff --git a/mps/code/zcoll.c b/mps/code/zcoll.c index 546e6b50def..21b1ffbd07d 100644 --- a/mps/code/zcoll.c +++ b/mps/code/zcoll.c @@ -97,7 +97,7 @@ static ulongest_t cols(size_t bytes) double M; /* Mebibytes */ ulongest_t cM; /* hundredths of a Mebibyte */ - M = (double)bytes / (1UL<<20); + M = (double)bytes / ((ulongest_t)1<<20); cM = (ulongest_t)(M * 100.0 + 0.5); /* round to nearest */ return cM; } @@ -139,9 +139,9 @@ static void showStatsAscii(size_t notcon, size_t con, size_t live, size_t alimit * Output: (Megabytes) 0m209 */ #if 0 -#define bPerM (1UL << 20) /* Mebibytes */ +#define bPerM ((size_t)1 << 20) /* Mebibytes */ #else -#define bPerM (1000000UL) /* Megabytes */ +#define bPerM ((size_t)1000000) /* Megabytes */ #endif static void print_M(size_t bytes) {