1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-04 19:10:37 -08:00

Merged from branch/2012-03-27/longest to pick up extra vararg fixes and casts on shift operands.

Copied from Perforce
 Change: 178096
 ServerID: perforce.ravenbrook.com
This commit is contained in:
David Lovemore 2012-05-03 16:43:57 +01:00
commit 8f87261a13
22 changed files with 128 additions and 115 deletions

View file

@ -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; /* <design/arena/#pool.ready> */

View file

@ -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));
}

View file

@ -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 */
};

View file

@ -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 */
};

View file

@ -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 */
};

View file

@ -193,7 +193,7 @@
* design.mps.poolepvm.arch.segment.size.
*/
#define EPVMDefaultSubsequentSegSIZE (64ul * 1024)
#define EPVMDefaultSubsequentSegSIZE ((Size)64 * 1024)
/* Arena Configuration -- see <code/arena.c>

View file

@ -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
}

View file

@ -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))

View file

@ -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 */

View file

@ -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. */

View file

@ -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 */

View file

@ -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)

View file

@ -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 ));
}

View file

@ -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);

View file

@ -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;

View file

@ -27,7 +27,7 @@ Bool RankCheck(Rank rank)
Bool RankSetCheck(RankSet rankSet)
{
CHECKL(rankSet < (1uL << RankLIMIT));
CHECKL(rankSet < ((ULongest)1 << RankLIMIT));
UNUSED(rankSet); /* <code/mpm.c#check.unused> */
return TRUE;
}

View file

@ -19,7 +19,7 @@
#include <stdlib.h>
#include <string.h>
#define testArenaSIZE ((size_t)(64l << 20))
#define testArenaSIZE ((size_t)((size_t)64 << 20))
#define avLEN 3
#define exactRootsCOUNT 200
#define ambigRootsCOUNT 50

View file

@ -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);

View file

@ -123,7 +123,7 @@ Bool TraceIdCheck(TraceId ti)
Bool TraceSetCheck(TraceSet ts)
{
CHECKL(ts < (1uL << TraceLIMIT));
CHECKL(ts < ((ULongest)1 << TraceLIMIT));
UNUSED(ts); /* <code/mpm.c#check.unused> */
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) {

View file

@ -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 */

View file

@ -20,7 +20,7 @@
#include <stdlib.h>
#include <string.h>
#define testArenaSIZE ((size_t)(64l << 20))
#define testArenaSIZE ((size_t)((size_t)64 << 20))
#define avLEN 3
#define exactRootsCOUNT 200
#define objCOUNT 20000

View file

@ -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)
{