mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Fixing up occurences of "unsigned long" in the main mps and test code so that we no longer assume that "unsigned long" is large enough for a pointer or size, or that it's the longest available integer type, since these are not true on 64-bit windows.
Copied from Perforce Change: 178021 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
ea4257879f
commit
61890da12b
27 changed files with 162 additions and 98 deletions
|
|
@ -86,7 +86,7 @@ static void report(mps_arena_t arena)
|
|||
nCollsStart += 1;
|
||||
printf("\n{\n Collection %d started. Because:\n", nCollsStart);
|
||||
printf(" %s\n", mps_message_gc_start_why(arena, message));
|
||||
printf(" clock: %lu\n", (unsigned long)mps_message_clock(arena, message));
|
||||
printf(" clock: %"PRIuLONGEST"\n", (ulongest_t)mps_message_clock(arena, message));
|
||||
break;
|
||||
}
|
||||
case mps_message_type_gc(): {
|
||||
|
|
@ -98,10 +98,10 @@ static void report(mps_arena_t arena)
|
|||
not_condemned = mps_message_gc_not_condemned_size(arena, message);
|
||||
|
||||
printf("\n Collection %d finished:\n", nCollsDone);
|
||||
printf(" live %lu\n", (unsigned long)live);
|
||||
printf(" condemned %lu\n", (unsigned long)condemned);
|
||||
printf(" not_condemned %lu\n", (unsigned long)not_condemned);
|
||||
printf(" clock: %lu\n", (unsigned long)mps_message_clock(arena, message));
|
||||
printf(" live %"PRIuLONGEST"\n", (ulongest_t)live);
|
||||
printf(" condemned %"PRIuLONGEST"\n", (ulongest_t)condemned);
|
||||
printf(" not_condemned %"PRIuLONGEST"\n", (ulongest_t)not_condemned);
|
||||
printf(" clock: %"PRIuLONGEST"\n", (ulongest_t)mps_message_clock(arena, message));
|
||||
printf("}\n");
|
||||
|
||||
if(condemned > (gen1SIZE + gen2SIZE + (size_t)128) * 1024) {
|
||||
|
|
|
|||
|
|
@ -88,9 +88,9 @@ static void report(mps_arena_t arena)
|
|||
not_condemned = mps_message_gc_not_condemned_size(arena, message);
|
||||
|
||||
printf("\nCollection %d finished:\n", ++nCollections);
|
||||
printf("live %lu\n", (unsigned long)live);
|
||||
printf("condemned %lu\n", (unsigned long)condemned);
|
||||
printf("not_condemned %lu\n", (unsigned long)not_condemned);
|
||||
printf("live %"PRIuLONGEST"\n", (ulongest_t)live);
|
||||
printf("condemned %"PRIuLONGEST"\n", (ulongest_t)condemned);
|
||||
printf("not_condemned %"PRIuLONGEST"\n", (ulongest_t)not_condemned);
|
||||
|
||||
mps_message_discard(arena, message);
|
||||
|
||||
|
|
|
|||
|
|
@ -67,9 +67,9 @@ static void report(mps_arena_t arena)
|
|||
not_condemned = mps_message_gc_not_condemned_size(arena, message);
|
||||
|
||||
printf("\nCollection %d finished:\n", ++nCollections);
|
||||
printf("live %lu\n", (unsigned long)live);
|
||||
printf("condemned %lu\n", (unsigned long)condemned);
|
||||
printf("not_condemned %lu\n", (unsigned long)not_condemned);
|
||||
printf("live %"PRIuLONGEST"\n", (ulongest_t)live);
|
||||
printf("condemned %"PRIuLONGEST"\n", (ulongest_t)condemned);
|
||||
printf("not_condemned %"PRIuLONGEST"\n", (ulongest_t)not_condemned);
|
||||
|
||||
mps_message_discard(arena, message);
|
||||
|
||||
|
|
|
|||
|
|
@ -73,9 +73,9 @@ static void report(void)
|
|||
not_condemned = mps_message_gc_not_condemned_size(arena, message);
|
||||
|
||||
printf("\nCollection complete %d:\n", ++nComplete);
|
||||
printf("live %lu\n", (unsigned long)live);
|
||||
printf("condemned %lu\n", (unsigned long)condemned);
|
||||
printf("not_condemned %lu\n", (unsigned long)not_condemned);
|
||||
printf("live %"PRIuLONGEST"\n", (ulongest_t)live);
|
||||
printf("condemned %"PRIuLONGEST"\n", (ulongest_t)condemned);
|
||||
printf("not_condemned %"PRIuLONGEST"\n", (ulongest_t)not_condemned);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
@ -153,8 +153,8 @@ static void *test(void *arg, size_t haveAmbigous)
|
|||
while(totalSize < totalSizeMAX) {
|
||||
if (totalSize > lastStep + totalSizeSTEP) {
|
||||
lastStep = totalSize;
|
||||
printf("\nSize %lu bytes, %lu objects.\n",
|
||||
(unsigned long)totalSize, objs);
|
||||
printf("\nSize %"PRIuLONGEST" bytes, %lu objects.\n",
|
||||
(ulongest_t)totalSize, objs);
|
||||
fflush(stdout);
|
||||
for(i = 0; i < exactRootsCOUNT; ++i)
|
||||
cdie(exactRoots[i] == objNULL || dylan_check(exactRoots[i]),
|
||||
|
|
|
|||
|
|
@ -108,8 +108,8 @@ static void *test(void *arg, size_t s)
|
|||
while(totalSize < totalSizeMAX) {
|
||||
if(totalSize > lastStep + totalSizeSTEP) {
|
||||
lastStep = totalSize;
|
||||
printf("\nSize %lu bytes, %lu objects.\n",
|
||||
(unsigned long)totalSize, objs);
|
||||
printf("\nSize %"PRIuLONGEST" bytes, %lu objects.\n",
|
||||
(ulongest_t)totalSize, objs);
|
||||
fflush(stdout);
|
||||
for(i = 0; i < exactRootsCOUNT; ++i)
|
||||
cdie(exactRoots[i] == objNULL || dylan_check(exactRoots[i]),
|
||||
|
|
|
|||
|
|
@ -61,7 +61,8 @@ static void btResRangeSymmetric(BT btlo, BT bthi, Count btSize,
|
|||
}
|
||||
|
||||
|
||||
typedef Bool (*BTFinderFn)(Index *, Index *, BT, Index, Index, unsigned long);
|
||||
typedef Bool (*BTFinderFn)(Index *foundBase_o, Index *foundLimit_o,
|
||||
BT bt, Index base, Index limit, Count length);
|
||||
|
||||
|
||||
/* btTestSingleRange -- Test expectations for calls to BTFind*ResRange*
|
||||
|
|
@ -70,7 +71,7 @@ typedef Bool (*BTFinderFn)(Index *, Index *, BT, Index, Index, unsigned long);
|
|||
|
||||
static void btTestSingleRange(BTFinderFn finder, BT bt,
|
||||
Index base, Index limit,
|
||||
unsigned long length,
|
||||
Count length,
|
||||
Bool expect,
|
||||
Index expectBase, Index expectLimit)
|
||||
{
|
||||
|
|
@ -94,7 +95,7 @@ static void btTestSingleRange(BTFinderFn finder, BT bt,
|
|||
|
||||
static void btTestResRange(BT btlo, BT bthi, Count btSize,
|
||||
Index base, Index limit,
|
||||
unsigned long length,
|
||||
Count length,
|
||||
Bool expect,
|
||||
Index expectBase, Index expectLimit)
|
||||
{
|
||||
|
|
@ -120,7 +121,7 @@ static void btTestResRange(BT btlo, BT bthi, Count btSize,
|
|||
|
||||
static void btTestLongResRange(BT btlo, BT bthi, Count btSize,
|
||||
Index base, Index limit,
|
||||
unsigned long length,
|
||||
Count length,
|
||||
Bool expect,
|
||||
Index expectBase, Index expectLimit)
|
||||
{
|
||||
|
|
@ -145,7 +146,7 @@ static void btTestLongResRange(BT btlo, BT bthi, Count btSize,
|
|||
|
||||
static void btAllResTest(BT btlo, BT bthi, Count btSize,
|
||||
Index base, Index limit,
|
||||
unsigned long length)
|
||||
Count length)
|
||||
{
|
||||
btResRangeSymmetric(btlo, bthi, btSize, 0, btSize);
|
||||
btTestResRange(btlo, bthi, btSize, base, limit, length,
|
||||
|
|
@ -164,7 +165,7 @@ static void btAllResTest(BT btlo, BT bthi, Count btSize,
|
|||
|
||||
static void btNoResTest(BT btlo, BT bthi, Count btSize,
|
||||
Index base, Index limit,
|
||||
unsigned long length)
|
||||
Count length)
|
||||
{
|
||||
btResRangeSymmetric(btlo, bthi, btSize, 0, btSize);
|
||||
btSetRangeSymmetric(btlo, bthi, btSize, base, limit);
|
||||
|
|
@ -185,7 +186,7 @@ static void btNoResTest(BT btlo, BT bthi, Count btSize,
|
|||
static void btResAndFindTest(BT btlo, BT bthi, Count btSize,
|
||||
Index base, Index limit,
|
||||
Index resBase, Index resLimit,
|
||||
unsigned long length)
|
||||
Count length)
|
||||
{
|
||||
btResRangeSymmetric(btlo, bthi, btSize, resBase, resLimit);
|
||||
if ((resLimit - resBase) < length) {
|
||||
|
|
@ -210,9 +211,9 @@ static void btResAndFindTest(BT btlo, BT bthi, Count btSize,
|
|||
|
||||
static void btSingleResTest(BT btlo, BT bthi, Count btSize,
|
||||
Index base, Index limit,
|
||||
unsigned long length)
|
||||
Count length)
|
||||
{
|
||||
unsigned long resLen;
|
||||
Count resLen;
|
||||
/* choose varying range lengths from too short to longer than needed */
|
||||
for (resLen = length - 1; resLen <= length + 1; resLen++) {
|
||||
if ((resLen > 0) && (resLen < (limit - base -2))) {
|
||||
|
|
@ -257,7 +258,7 @@ typedef unsigned Arrangement;
|
|||
/* Choose a limit for reset range 1 */
|
||||
static Index btArrangeRes1(Arrangement arrange,
|
||||
Index base, Index res2Base,
|
||||
unsigned long length)
|
||||
Count length)
|
||||
{
|
||||
switch (arrange) {
|
||||
|
||||
|
|
@ -295,7 +296,7 @@ typedef unsigned Pattern;
|
|||
/* Choose a limit for reset range 1 */
|
||||
static void btResetFirstRange(BT btlo, BT bthi, Count btSize,
|
||||
Index res1Limit,
|
||||
unsigned long length,
|
||||
Count length,
|
||||
Pattern pattern)
|
||||
{
|
||||
switch (pattern) {
|
||||
|
|
@ -329,9 +330,9 @@ static void btResetFirstRange(BT btlo, BT bthi, Count btSize,
|
|||
|
||||
static void btDoubleResTest(BT btlo, BT bthi, Count btSize,
|
||||
Index base, Index limit,
|
||||
unsigned long length)
|
||||
Count length)
|
||||
{
|
||||
unsigned long res2Len;
|
||||
Count res2Len;
|
||||
|
||||
if (length < 2)
|
||||
return; /* no possibility of making the first range too small */
|
||||
|
|
@ -371,7 +372,7 @@ static void btDoubleResTest(BT btlo, BT bthi, Count btSize,
|
|||
|
||||
static void btFindRangeTests(BT btlo, BT bthi, Count btSize,
|
||||
Index base, Index limit,
|
||||
unsigned long length)
|
||||
Count length)
|
||||
{
|
||||
btAllResTest(btlo, bthi, btSize, base, limit, length);
|
||||
btNoResTest(btlo, bthi, btSize, base, limit, length);
|
||||
|
|
|
|||
|
|
@ -174,7 +174,8 @@ static void findShortResRange(void)
|
|||
Bool b = BTFindShortResRange(&base, &limit, bt,
|
||||
args[1], args[2], args[0]);
|
||||
if (b)
|
||||
printf("%lu - %lu\n",base, limit);
|
||||
printf("%"PRIuLONGEST" - %"PRIuLONGEST"\n",
|
||||
(ulongest_t)base, (ulongest_t)limit);
|
||||
else
|
||||
printf("FALSE\n");
|
||||
}
|
||||
|
|
@ -192,7 +193,8 @@ static void findShortResRangeHigh(void)
|
|||
Bool b = BTFindShortResRangeHigh(&base, &limit, bt,
|
||||
args[1], args[2], args[0]);
|
||||
if (b)
|
||||
printf("%lu - %lu\n",base, limit);
|
||||
printf("%"PRIuLONGEST" - %"PRIuLONGEST"\n",
|
||||
(ulongest_t)base, (ulongest_t)limit);
|
||||
else
|
||||
printf("FALSE\n");
|
||||
}
|
||||
|
|
@ -209,7 +211,8 @@ static void findLongResRange(void)
|
|||
Bool b = BTFindLongResRange(&base, &limit, bt,
|
||||
args[1], args[2], args[0]);
|
||||
if (b)
|
||||
printf("%lu - %lu\n",base, limit);
|
||||
printf("%"PRIuLONGEST" - %"PRIuLONGEST"\n",
|
||||
(ulongest_t)base, (ulongest_t)limit);
|
||||
else
|
||||
printf("FALSE\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1380,7 +1380,6 @@ Bool CBSFindFirst(Addr *baseReturn, Addr *limitReturn,
|
|||
AVER(baseReturn != NULL);
|
||||
AVER(limitReturn != NULL);
|
||||
AVER(size > 0);
|
||||
AVER(sizeof(unsigned long) >= sizeof(Size));
|
||||
AVER(SizeIsAligned(size, cbs->alignment));
|
||||
AVER(cbs->fastFind);
|
||||
AVERT(CBSFindDelete, findDelete);
|
||||
|
|
@ -1463,7 +1462,6 @@ Bool CBSFindLast(Addr *baseReturn, Addr *limitReturn,
|
|||
AVER(baseReturn != NULL);
|
||||
AVER(limitReturn != NULL);
|
||||
AVER(size > 0);
|
||||
AVER(sizeof(unsigned long) >= sizeof(Size));
|
||||
AVER(SizeIsAligned(size, cbs->alignment));
|
||||
AVER(cbs->fastFind);
|
||||
AVERT(CBSFindDelete, findDelete);
|
||||
|
|
@ -1551,7 +1549,6 @@ Bool CBSFindLargest(Addr *baseReturn, Addr *limitReturn,
|
|||
|
||||
AVER(baseReturn != NULL);
|
||||
AVER(limitReturn != NULL);
|
||||
AVER(sizeof(unsigned long) >= sizeof(Size));
|
||||
AVER(cbs->fastFind);
|
||||
AVERT(CBSFindDelete, findDelete);
|
||||
|
||||
|
|
|
|||
|
|
@ -501,7 +501,7 @@ static void find(CBS cbs, void *block, BT alloc, Size size, Bool high,
|
|||
|
||||
expected = (high ? BTFindLongResRangeHigh : BTFindLongResRange)
|
||||
(&expectedBase, &expectedLimit, alloc,
|
||||
(Index)0, (Index)ArraySize, (unsigned long)size);
|
||||
(Index)0, (Index)ArraySize, (Count)size);
|
||||
|
||||
if (expected) {
|
||||
oldSize = (expectedLimit - expectedBase) * Alignment;
|
||||
|
|
|
|||
|
|
@ -20,12 +20,23 @@
|
|||
#include "ossu.h"
|
||||
#endif
|
||||
|
||||
typedef unsigned long Word;
|
||||
typedef MPS_T_WORD Word;
|
||||
typedef struct AddrStruct *Addr;
|
||||
|
||||
#include "eventcom.h"
|
||||
|
||||
|
||||
#ifdef MPS_PF_W3I6MV
|
||||
#define PRIuLONGEST "llu"
|
||||
#define PRIXPTR "016llX"
|
||||
typedef unsigned long long ulongest_t;
|
||||
#else
|
||||
#define PRIuLONGEST "lu"
|
||||
#define PRIXPTR "08lX"
|
||||
typedef unsigned long ulongest_t;
|
||||
#endif
|
||||
|
||||
|
||||
#define RELATION(type, code, always, kind, format) \
|
||||
case Event ## type: \
|
||||
readEvent(#type, #format, header[0], header[1], header[2]); \
|
||||
|
|
@ -72,10 +83,10 @@ static void readEvent(char *type, char *format, Word code, Word length,
|
|||
|
||||
for(; *format != '\0'; format++) {
|
||||
switch(*format) {
|
||||
PROCESS('A', Addr, sizeof(Addr), "0x%08lX", unsigned long)
|
||||
PROCESS('P', void *, sizeof(void *), "0x%08lX", unsigned long)
|
||||
PROCESS('A', Addr, sizeof(Addr), "0x%"PRIXPTR, ulongest_t)
|
||||
PROCESS('P', void *, sizeof(void *), "0x%"PRIXPTR, ulongest_t)
|
||||
PROCESS('U', unsigned, sizeof(unsigned),"%u", unsigned)
|
||||
PROCESS('W', Word, sizeof(Word),"%lu", Word)
|
||||
PROCESS('W', Word, sizeof(Word), "%"PRIuLONGEST, ulongest_t)
|
||||
PROCESS('D', double, sizeof(double), "%f", double)
|
||||
case 'S': {
|
||||
size_t n;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,17 @@
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef MPS_PF_W3I6MV
|
||||
#define PRIuLONGEST "llu"
|
||||
#define PRIXPTR "016llX"
|
||||
typedef unsigned long long ulongest_t;
|
||||
#else
|
||||
#define PRIuLONGEST "lu"
|
||||
#define PRIXPTR "08lX"
|
||||
typedef unsigned long ulongest_t;
|
||||
#endif
|
||||
|
||||
|
||||
typedef unsigned long ulong;
|
||||
|
||||
|
||||
|
|
@ -114,7 +125,7 @@ static void error(const char *format, ...)
|
|||
va_list args;
|
||||
|
||||
fflush(stdout); /* sync */
|
||||
fprintf(stderr, "Failed @%lu ", (ulong)eventTime);
|
||||
fprintf(stderr, "Failed @%"PRIuLONGEST" ", (ulongest_t)eventTime);
|
||||
va_start(args, format);
|
||||
vfprintf(stderr, format, args);
|
||||
fprintf(stderr, "\n");
|
||||
|
|
|
|||
|
|
@ -69,9 +69,9 @@ static void report(mps_arena_t arena)
|
|||
not_condemned = mps_message_gc_not_condemned_size(arena, message);
|
||||
|
||||
printf("\nCollection %d finished:\n", ++nCollections);
|
||||
printf("live %lu\n", (unsigned long)live);
|
||||
printf("condemned %lu\n", (unsigned long)condemned);
|
||||
printf("not_condemned %lu\n", (unsigned long)not_condemned);
|
||||
printf("live %"PRIuLONGEST"\n", (ulongest_t)live);
|
||||
printf("condemned %"PRIuLONGEST"\n", (ulongest_t)condemned);
|
||||
printf("not_condemned %"PRIuLONGEST"\n", (ulongest_t)not_condemned);
|
||||
|
||||
mps_message_discard(arena, message);
|
||||
|
||||
|
|
|
|||
|
|
@ -133,8 +133,8 @@ static void reportResults(PoolStat stat, char *name)
|
|||
printf("\nResults for ");
|
||||
fputs(name, stdout);
|
||||
printf("\n");
|
||||
printf(" Allocated %lu objects\n", (unsigned long)stat->aCount);
|
||||
printf(" Freed %lu objects\n", (unsigned long)stat->fCount);
|
||||
printf(" Allocated %"PRIuLONGEST" objects\n", (ulongest_t)stat->aCount);
|
||||
printf(" Freed %"PRIuLONGEST" objects\n", (ulongest_t)stat->fCount);
|
||||
printf(" There were %lu non-contiguous allocations\n",
|
||||
(unsigned long)stat->ncCount);
|
||||
printf(" Address range from %p to %p\n",
|
||||
|
|
|
|||
|
|
@ -137,8 +137,8 @@ static void reportResults(PoolStat stat, char *name)
|
|||
printf("\nResults for ");
|
||||
printf("%s", name);
|
||||
printf("\n");
|
||||
printf(" Allocated %lu objects\n", (unsigned long)stat->aCount);
|
||||
printf(" Freed %lu objects\n", (unsigned long)stat->fCount);
|
||||
printf(" Allocated %"PRIuLONGEST" objects\n", (ulongest_t)stat->aCount);
|
||||
printf(" Freed %"PRIuLONGEST" objects\n", (ulongest_t)stat->fCount);
|
||||
printf(" There were %lu non-contiguous allocations\n",
|
||||
(unsigned long)stat->ncCount);
|
||||
printf(" Address range from %p to %p\n", stat->min, stat->max);
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ typedef Res (*TraceFixMethod)(ScanState ss, Ref *refIO);
|
|||
|
||||
/* This type is used by the PoolClass method Walk */
|
||||
typedef void (*FormattedObjectsStepMethod)(Addr obj, Format fmt, Pool pool,
|
||||
void *v, unsigned long s);
|
||||
void *v, size_t s);
|
||||
|
||||
/* This type is used by the PoolClass method Walk */
|
||||
typedef void (*FreeBlockStepMethod)(Addr base, Addr limit, Pool pool, void *p);
|
||||
|
|
|
|||
|
|
@ -236,7 +236,8 @@ static mps_res_t stress(mps_class_t class, mps_arena_t arena,
|
|||
|
||||
if (verbose) {
|
||||
if(i && i%4==0) putchar('\n');
|
||||
printf("%8lX %6lX ", (unsigned long)ps[i], (unsigned long)ss[i]);
|
||||
printf("%"PRIwLONGEST PRIXLONGEST" %6"PRIXLONGEST" ",
|
||||
(ulongest_t)ps[i], (ulongest_t)ss[i]);
|
||||
}
|
||||
}
|
||||
if (verbose) {
|
||||
|
|
@ -273,7 +274,8 @@ static mps_res_t stress(mps_class_t class, mps_arena_t arena,
|
|||
|
||||
if (verbose) {
|
||||
if(i && i%4==0) putchar('\n');
|
||||
printf("%8lX %6lX ", (unsigned long)ps[i], (unsigned long)ss[i]);
|
||||
printf("%"PRIwLONGEST PRIXLONGEST" %6"PRIXLONGEST" ",
|
||||
(ulongest_t)ps[i], (ulongest_t)ss[i]);
|
||||
}
|
||||
}
|
||||
if (verbose)
|
||||
|
|
|
|||
|
|
@ -2251,7 +2251,7 @@ static void AMCTraceEnd(Pool pool, Trace trace)
|
|||
/* AMCWalk -- Apply function to (black) objects in segment */
|
||||
|
||||
static void AMCWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f,
|
||||
void *p, unsigned long s)
|
||||
void *p, size_t s)
|
||||
{
|
||||
Addr object, nextObject, limit;
|
||||
AMC amc;
|
||||
|
|
@ -2301,7 +2301,7 @@ static void AMCWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f,
|
|||
/* amcWalkAll -- Apply a function to all (black) objects in a pool */
|
||||
|
||||
static void amcWalkAll(Pool pool, FormattedObjectsStepMethod f,
|
||||
void *p, unsigned long s)
|
||||
void *p, size_t s)
|
||||
{
|
||||
Arena arena;
|
||||
Ring ring, next, node;
|
||||
|
|
@ -2466,7 +2466,7 @@ typedef struct mps_amc_apply_closure_s {
|
|||
} mps_amc_apply_closure_s;
|
||||
|
||||
static void mps_amc_apply_iter(Addr addr, Format format, Pool pool,
|
||||
void *p, unsigned long s)
|
||||
void *p, size_t s)
|
||||
{
|
||||
mps_amc_apply_closure_s *closure = p;
|
||||
/* Can't check addr */
|
||||
|
|
|
|||
|
|
@ -1145,7 +1145,7 @@ static Res AWLAccess(Pool pool, Seg seg, Addr addr,
|
|||
/* AWLWalk -- walk all objects */
|
||||
|
||||
static void AWLWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f,
|
||||
void *p, unsigned long s)
|
||||
void *p, size_t s)
|
||||
{
|
||||
AWL awl;
|
||||
AWLSeg awlseg;
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ static Res loSegInit(Seg seg, Pool pool, Addr base, Size size,
|
|||
Size tablebytes; /* # bytes in each control array */
|
||||
Arena arena;
|
||||
/* number of bits needed in each control array */
|
||||
unsigned long bits;
|
||||
Count bits;
|
||||
void *p;
|
||||
|
||||
AVERT(Seg, seg);
|
||||
|
|
@ -165,7 +165,7 @@ static void loSegFinish(Seg seg)
|
|||
Pool pool;
|
||||
Arena arena;
|
||||
Size tablesize;
|
||||
unsigned long bits;
|
||||
Count bits;
|
||||
|
||||
AVERT(Seg, seg);
|
||||
loseg = SegLOSeg(seg);
|
||||
|
|
@ -236,7 +236,7 @@ static Bool loSegFindFree(Addr *bReturn, Addr *lReturn,
|
|||
Seg seg;
|
||||
Arena arena;
|
||||
Count agrains;
|
||||
unsigned long tablesize;
|
||||
Count bits;
|
||||
Addr segBase;
|
||||
|
||||
AVER(bReturn != NULL);
|
||||
|
|
@ -260,9 +260,9 @@ static Bool loSegFindFree(Addr *bReturn, Addr *lReturn,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
tablesize = SegSize(seg) >> lo->alignShift;
|
||||
bits = SegSize(seg) >> lo->alignShift;
|
||||
if(!BTFindLongResRange(&baseIndex, &limitIndex, loseg->alloc,
|
||||
0, tablesize, agrains)) {
|
||||
0, bits, agrains)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -408,7 +408,7 @@ static void loSegReclaim(LOSeg loseg, Trace trace)
|
|||
/* a leaf pool, so there can't be any dangling references */
|
||||
static void LOWalk(Pool pool, Seg seg,
|
||||
FormattedObjectsStepMethod f,
|
||||
void *p, unsigned long s)
|
||||
void *p, size_t s)
|
||||
{
|
||||
Addr base;
|
||||
LO lo;
|
||||
|
|
@ -491,7 +491,7 @@ static Res LOInit(Pool pool, va_list arg)
|
|||
pool->format = format;
|
||||
lo->poolStruct.alignment = format->alignment;
|
||||
lo->alignShift =
|
||||
SizeLog2((unsigned long)PoolAlignment(&lo->poolStruct));
|
||||
SizeLog2((Size)PoolAlignment(&lo->poolStruct));
|
||||
lo->gen = LOGen; /* may be modified in debugger */
|
||||
res = ChainCreate(&lo->chain, arena, 1, &loGenParam);
|
||||
if (res != ResOK)
|
||||
|
|
@ -669,7 +669,7 @@ static void LOBufferEmpty(Pool pool, Buffer buffer, Addr init, Addr limit)
|
|||
static Res LOWhiten(Pool pool, Trace trace, Seg seg)
|
||||
{
|
||||
LO lo;
|
||||
unsigned long bits;
|
||||
Count bits;
|
||||
|
||||
AVERT(Pool, pool);
|
||||
lo = PoolPoolLO(pool);
|
||||
|
|
|
|||
|
|
@ -615,7 +615,7 @@ static void SNCFramePopPending(Pool pool, Buffer buf, AllocFrame frame)
|
|||
|
||||
|
||||
static void SNCWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f,
|
||||
void *p, unsigned long s)
|
||||
void *p, size_t s)
|
||||
{
|
||||
AVERT(Pool, pool);
|
||||
AVERT(Seg, seg);
|
||||
|
|
|
|||
|
|
@ -311,8 +311,8 @@ static void validate(void)
|
|||
cdie(((QSCell)reg[1])->tag == QSInt, "validate int");
|
||||
if(((QSCell)reg[1])->value != list[i]) {
|
||||
fprintf(stdout,
|
||||
"mps_res_t: Element %lu of the two lists do not match.\n",
|
||||
(unsigned long)i);
|
||||
"mps_res_t: Element %"PRIuLONGEST" of the two lists do not match.\n",
|
||||
(ulongest_t)i);
|
||||
return;
|
||||
}
|
||||
reg[1] = (mps_word_t)((QSCell)reg[1])->tail;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,17 @@
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef MPS_PF_W3I6MV
|
||||
#define PRIuLONGEST "llu"
|
||||
#define PRIXPTR "016llX"
|
||||
typedef unsigned long long ulongest_t;
|
||||
#else
|
||||
#define PRIuLONGEST "lu"
|
||||
#define PRIXPTR "08lX"
|
||||
typedef unsigned long ulongest_t;
|
||||
#endif
|
||||
|
||||
|
||||
typedef unsigned long ulong;
|
||||
|
||||
|
||||
|
|
@ -46,7 +57,7 @@ static void error(const char *format, ...)
|
|||
va_list args;
|
||||
|
||||
fflush(stdout); /* sync */
|
||||
fprintf(stderr, "%s: @%lu ", prog, (ulong)eventTime);
|
||||
fprintf(stderr, "%s: @%"PRIuLONGEST" ", prog, (ulongest_t)eventTime);
|
||||
va_start(args, format);
|
||||
vfprintf(stderr, format, args);
|
||||
fprintf(stderr, "\n");
|
||||
|
|
|
|||
|
|
@ -376,13 +376,13 @@ static void AMSTFinish(Pool pool)
|
|||
AVERT(AMST, amst);
|
||||
|
||||
printf("\nDestroying pool, having performed:\n");
|
||||
printf(" %lu splits (S)\n", (unsigned long)amst->splits);
|
||||
printf(" %lu merges (M)\n", (unsigned long)amst->merges);
|
||||
printf(" %lu aborted splits (B)\n", (unsigned long)amst->badSplits);
|
||||
printf(" %lu aborted merges (D)\n", (unsigned long)amst->badMerges);
|
||||
printf(" %"PRIuLONGEST" splits (S)\n", (ulongest_t)amst->splits);
|
||||
printf(" %"PRIuLONGEST" merges (M)\n", (ulongest_t)amst->merges);
|
||||
printf(" %"PRIuLONGEST" aborted splits (B)\n", (ulongest_t)amst->badSplits);
|
||||
printf(" %"PRIuLONGEST" aborted merges (D)\n", (ulongest_t)amst->badMerges);
|
||||
printf(" which included:\n");
|
||||
printf(" %lu buffered splits (C)\n", (unsigned long)amst->bsplits);
|
||||
printf(" %lu buffered merges (J)\n", (unsigned long)amst->bmerges);
|
||||
printf(" %"PRIuLONGEST" buffered splits (C)\n", (ulongest_t)amst->bsplits);
|
||||
printf(" %"PRIuLONGEST" buffered merges (J)\n", (ulongest_t)amst->bmerges);
|
||||
|
||||
AMSFinish(pool);
|
||||
amst->sig = SigInvalid;
|
||||
|
|
@ -799,8 +799,8 @@ static void *test(void *arg, size_t s)
|
|||
while(totalSize < totalSizeMAX) {
|
||||
if (totalSize > lastStep + totalSizeSTEP) {
|
||||
lastStep = totalSize;
|
||||
printf("\nSize %lu bytes, %lu objects.\n",
|
||||
(unsigned long)totalSize, objs);
|
||||
printf("\nSize %"PRIuLONGEST" bytes, %"PRIuLONGEST" objects.\n",
|
||||
(ulongest_t)totalSize, (ulongest_t)objs);
|
||||
printf("%s", indent);
|
||||
fflush(stdout);
|
||||
for(i = 0; i < exactRootsCOUNT; ++i)
|
||||
|
|
|
|||
|
|
@ -801,7 +801,7 @@ typedef struct {
|
|||
SplayTestNodeMethod testNode;
|
||||
SplayTestTreeMethod testTree;
|
||||
void *p;
|
||||
unsigned long s;
|
||||
Size s;
|
||||
SplayTree tree;
|
||||
} SplayFindClosureStruct, *SplayFindClosure;
|
||||
|
||||
|
|
@ -809,7 +809,7 @@ static Compare SplayFindFirstCompare(void *key, SplayNode node)
|
|||
{
|
||||
SplayFindClosure closure;
|
||||
void *closureP;
|
||||
unsigned long closureS;
|
||||
Size closureS;
|
||||
SplayTestNodeMethod testNode;
|
||||
SplayTestTreeMethod testTree;
|
||||
SplayTree tree;
|
||||
|
|
@ -840,7 +840,7 @@ static Compare SplayFindLastCompare(void *key, SplayNode node)
|
|||
{
|
||||
SplayFindClosure closure;
|
||||
void *closureP;
|
||||
unsigned long closureS;
|
||||
Size closureS;
|
||||
SplayTestNodeMethod testNode;
|
||||
SplayTestTreeMethod testTree;
|
||||
SplayTree tree;
|
||||
|
|
|
|||
|
|
@ -50,11 +50,11 @@ static mps_gen_param_s testChain[genCOUNT] = {
|
|||
* during allocation.
|
||||
*/
|
||||
|
||||
static size_t step_frequencies[] = {
|
||||
static unsigned long step_frequencies[] = {
|
||||
1000,
|
||||
5000,
|
||||
10000,
|
||||
1000000000,
|
||||
1000000000, /* one billion */
|
||||
};
|
||||
|
||||
#define TESTS (sizeof(step_frequencies) / sizeof(step_frequencies[0]))
|
||||
|
|
@ -414,11 +414,11 @@ static void *test(void *arg, size_t s)
|
|||
|
||||
total_mps_time = alloc_time + step_time + no_step_time;
|
||||
printf("Collection statistics:\n");
|
||||
printf(" %lu collections\n", (unsigned long)collections);
|
||||
printf(" %lu bytes condemned.\n", (unsigned long)condemned);
|
||||
printf(" %"PRIuLONGEST" collections\n", (ulongest_t)collections);
|
||||
printf(" %"PRIuLONGEST" bytes condemned.\n", (ulongest_t)condemned);
|
||||
printf(" %lu bytes not condemned.\n",
|
||||
(unsigned long)not_condemned);
|
||||
printf(" %lu bytes survived.\n", (unsigned long)live);
|
||||
printf(" %"PRIuLONGEST" bytes survived.\n", (ulongest_t)live);
|
||||
if (condemned) {
|
||||
printf(" Mortality %5.2f%%.\n",
|
||||
(1.0 - ((double)live)/condemned) * 100.0);
|
||||
|
|
@ -471,7 +471,7 @@ static void *test(void *arg, size_t s)
|
|||
print_time(" (adjusted for clock timing: ",
|
||||
total_clock_time,
|
||||
" spent reading the clock;\n");
|
||||
printf(" %lu clock reads; ", (unsigned long)clock_reads);
|
||||
printf(" %"PRIuLONGEST" clock reads; ", (ulongest_t)clock_reads);
|
||||
print_time("", total_clock_time / clock_reads, " per read;");
|
||||
print_time(" recently measured as ", clock_time, ").\n");
|
||||
mps_ap_destroy(ap);
|
||||
|
|
|
|||
|
|
@ -75,6 +75,30 @@
|
|||
#endif /* MPS_BUILD_MV */
|
||||
|
||||
|
||||
/* ulongest_t -- longest unsigned integer type
|
||||
*
|
||||
* Define a longest unsigned integer type for testing and printing. We'd
|
||||
* like to use C99's uintmax_t and PRIuMAX here, but the MPS is in C89
|
||||
* and C99 isn't supported by Microsoft.
|
||||
*
|
||||
* We avoid using the ones defined in mpstd.h because we want the tests to
|
||||
* root out any incompatible assumptions by breaking.
|
||||
*/
|
||||
|
||||
#ifdef MPS_PF_W3I6MV
|
||||
#define PRIuLONGEST "llu"
|
||||
#define PRIXLONGEST "llX"
|
||||
#define PRIwLONGEST "16"
|
||||
typedef unsigned long long ulongest_t;
|
||||
#else
|
||||
#define PRIuLONGEST "lu"
|
||||
#define PRIXLONGEST "lX"
|
||||
#define PRIwLONGEST "8"
|
||||
typedef unsigned long ulongest_t;
|
||||
#endif
|
||||
#define PRIXPTR "0"PRIwLONGEST PRIXLONGEST
|
||||
|
||||
|
||||
/* testlib_unused -- declares that a variable is unused
|
||||
*
|
||||
* It should be used to prevent compiler warnings about unused
|
||||
|
|
|
|||
|
|
@ -92,13 +92,13 @@ static void *stack_start;
|
|||
static mps_thr_t stack_thr;
|
||||
|
||||
|
||||
static unsigned long cols(size_t bytes)
|
||||
static ulongest_t cols(size_t bytes)
|
||||
{
|
||||
double M; /* Mebibytes */
|
||||
unsigned long cM; /* hundredths of a Mebibyte */
|
||||
ulongest_t cM; /* hundredths of a Mebibyte */
|
||||
|
||||
M = (double)bytes / (1UL<<20);
|
||||
cM = (unsigned long)(M * 100 + 0.5); /* round to nearest */
|
||||
cM = (ulongest_t)(M * 100.0 + 0.5); /* round to nearest */
|
||||
return cM;
|
||||
}
|
||||
|
||||
|
|
@ -424,8 +424,8 @@ static void CatalogDo(mps_arena_t arena, mps_ap_t ap)
|
|||
static void* MakeThing(mps_arena_t arena, mps_ap_t ap, size_t size)
|
||||
{
|
||||
mps_word_t v;
|
||||
unsigned long words;
|
||||
unsigned long slots;
|
||||
ulongest_t words;
|
||||
ulongest_t slots;
|
||||
|
||||
words = (size + (sizeof(mps_word_t) - 1) ) / sizeof(mps_word_t);
|
||||
if(words < 2)
|
||||
|
|
@ -440,8 +440,8 @@ static void* MakeThing(mps_arena_t arena, mps_ap_t ap, size_t size)
|
|||
|
||||
static void BigdropSmall(mps_arena_t arena, mps_ap_t ap, size_t big, char small_ref)
|
||||
{
|
||||
static unsigned long keepCount = 0;
|
||||
unsigned long i;
|
||||
static unsigned keepCount = 0;
|
||||
unsigned i;
|
||||
|
||||
mps_arena_park(arena);
|
||||
for(i = 0; i < 100; i++) {
|
||||
|
|
@ -474,7 +474,7 @@ static unsigned long df(unsigned randm, unsigned number)
|
|||
static void Make(mps_arena_t arena, mps_ap_t ap, unsigned randm, unsigned keep1in, unsigned keepTotal, unsigned keepRootspace, unsigned sizemethod)
|
||||
{
|
||||
unsigned keepCount = 0;
|
||||
unsigned long objCount = 0;
|
||||
unsigned objCount = 0;
|
||||
|
||||
Insist(keepRootspace <= myrootExactCOUNT);
|
||||
|
||||
|
|
@ -523,7 +523,7 @@ static void Make(mps_arena_t arena, mps_ap_t ap, unsigned randm, unsigned keep1i
|
|||
}
|
||||
printf(" ...made and kept: %u objects, storing cyclically in "
|
||||
"first %u roots "
|
||||
"(actually created %lu objects, in accord with "
|
||||
"(actually created %u objects, in accord with "
|
||||
"keep-1-in %u).\n",
|
||||
keepCount, keepRootspace, objCount, keep1in);
|
||||
}
|
||||
|
|
@ -531,7 +531,7 @@ static void Make(mps_arena_t arena, mps_ap_t ap, unsigned randm, unsigned keep1i
|
|||
|
||||
static void Rootdrop(char rank_char)
|
||||
{
|
||||
unsigned long i;
|
||||
unsigned i;
|
||||
|
||||
if(rank_char == 'A') {
|
||||
for(i = 0; i < myrootAmbigCOUNT; ++i) {
|
||||
|
|
@ -553,6 +553,10 @@ static void stackwipe(void)
|
|||
unsigned iw;
|
||||
unsigned long aw[stackwipedepth];
|
||||
|
||||
/* Do some pointless work that the compiler won't optimise away, so that
|
||||
this function wipes over the stack by filling stuff into the "aw"
|
||||
array. */
|
||||
|
||||
/* http://xkcd.com/710/ */
|
||||
/* I don't want my friends to stop calling; I just want the */
|
||||
/* compiler to stop optimising away my code. */
|
||||
|
|
@ -808,7 +812,7 @@ static void testscriptA(const char *script)
|
|||
printf(" Create arena, size = %lu.\n", arenasize);
|
||||
|
||||
/* arena */
|
||||
die(mps_arena_create(&arena, mps_arena_class_vm(), arenasize),
|
||||
die(mps_arena_create(&arena, mps_arena_class_vm(), (size_t)arenasize),
|
||||
"arena_create");
|
||||
|
||||
/* thr: used to stop/restart multiple threads */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue