aboutsummaryrefslogtreecommitdiffstats
path: root/mps/code
diff options
context:
space:
mode:
authorRichard Brooksby2012-04-23 16:20:40 +0100
committerRichard Brooksby2012-04-23 16:20:40 +0100
commit61890da12b3d0150f25b6edd783f320d957b223f (patch)
tree1f8cf8bb503f9a33616c1a783a8497ada33f6ed7 /mps/code
parentea4257879f044d79b0fbb0701acdda6268322a87 (diff)
downloademacs-61890da12b3d0150f25b6edd783f320d957b223f.tar.gz
emacs-61890da12b3d0150f25b6edd783f320d957b223f.zip
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
Diffstat (limited to 'mps/code')
-rw-r--r--mps/code/amcss.c10
-rw-r--r--mps/code/amcsshe.c6
-rw-r--r--mps/code/amcssth.c6
-rw-r--r--mps/code/amsss.c10
-rw-r--r--mps/code/amssshe.c4
-rw-r--r--mps/code/btcv.c29
-rw-r--r--mps/code/bttest.c9
-rw-r--r--mps/code/cbs.c3
-rw-r--r--mps/code/cbstest.c2
-rw-r--r--mps/code/dumper.c19
-rw-r--r--mps/code/eventrep.c13
-rw-r--r--mps/code/exposet0.c6
-rw-r--r--mps/code/locbwcss.c4
-rw-r--r--mps/code/locusss.c4
-rw-r--r--mps/code/mpmtypes.h2
-rw-r--r--mps/code/mv2test.c6
-rw-r--r--mps/code/poolamc.c6
-rw-r--r--mps/code/poolawl.c2
-rw-r--r--mps/code/poollo.c16
-rw-r--r--mps/code/poolsnc.c2
-rw-r--r--mps/code/qs.c4
-rw-r--r--mps/code/replay.c13
-rw-r--r--mps/code/segsmss.c16
-rw-r--r--mps/code/splay.c6
-rw-r--r--mps/code/steptest.c12
-rw-r--r--mps/code/testlib.h24
-rw-r--r--mps/code/zcoll.c26
27 files changed, 162 insertions, 98 deletions
diff --git a/mps/code/amcss.c b/mps/code/amcss.c
index 0590f81c0c7..7055bf94b70 100644
--- a/mps/code/amcss.c
+++ b/mps/code/amcss.c
@@ -86,7 +86,7 @@ static void report(mps_arena_t arena)
86 nCollsStart += 1; 86 nCollsStart += 1;
87 printf("\n{\n Collection %d started. Because:\n", nCollsStart); 87 printf("\n{\n Collection %d started. Because:\n", nCollsStart);
88 printf(" %s\n", mps_message_gc_start_why(arena, message)); 88 printf(" %s\n", mps_message_gc_start_why(arena, message));
89 printf(" clock: %lu\n", (unsigned long)mps_message_clock(arena, message)); 89 printf(" clock: %"PRIuLONGEST"\n", (ulongest_t)mps_message_clock(arena, message));
90 break; 90 break;
91 } 91 }
92 case mps_message_type_gc(): { 92 case mps_message_type_gc(): {
@@ -98,10 +98,10 @@ static void report(mps_arena_t arena)
98 not_condemned = mps_message_gc_not_condemned_size(arena, message); 98 not_condemned = mps_message_gc_not_condemned_size(arena, message);
99 99
100 printf("\n Collection %d finished:\n", nCollsDone); 100 printf("\n Collection %d finished:\n", nCollsDone);
101 printf(" live %lu\n", (unsigned long)live); 101 printf(" live %"PRIuLONGEST"\n", (ulongest_t)live);
102 printf(" condemned %lu\n", (unsigned long)condemned); 102 printf(" condemned %"PRIuLONGEST"\n", (ulongest_t)condemned);
103 printf(" not_condemned %lu\n", (unsigned long)not_condemned); 103 printf(" not_condemned %"PRIuLONGEST"\n", (ulongest_t)not_condemned);
104 printf(" clock: %lu\n", (unsigned long)mps_message_clock(arena, message)); 104 printf(" clock: %"PRIuLONGEST"\n", (ulongest_t)mps_message_clock(arena, message));
105 printf("}\n"); 105 printf("}\n");
106 106
107 if(condemned > (gen1SIZE + gen2SIZE + (size_t)128) * 1024) { 107 if(condemned > (gen1SIZE + gen2SIZE + (size_t)128) * 1024) {
diff --git a/mps/code/amcsshe.c b/mps/code/amcsshe.c
index 90013f32671..edc76a16deb 100644
--- a/mps/code/amcsshe.c
+++ b/mps/code/amcsshe.c
@@ -88,9 +88,9 @@ static void report(mps_arena_t arena)
88 not_condemned = mps_message_gc_not_condemned_size(arena, message); 88 not_condemned = mps_message_gc_not_condemned_size(arena, message);
89 89
90 printf("\nCollection %d finished:\n", ++nCollections); 90 printf("\nCollection %d finished:\n", ++nCollections);
91 printf("live %lu\n", (unsigned long)live); 91 printf("live %"PRIuLONGEST"\n", (ulongest_t)live);
92 printf("condemned %lu\n", (unsigned long)condemned); 92 printf("condemned %"PRIuLONGEST"\n", (ulongest_t)condemned);
93 printf("not_condemned %lu\n", (unsigned long)not_condemned); 93 printf("not_condemned %"PRIuLONGEST"\n", (ulongest_t)not_condemned);
94 94
95 mps_message_discard(arena, message); 95 mps_message_discard(arena, message);
96 96
diff --git a/mps/code/amcssth.c b/mps/code/amcssth.c
index 76ef6800c58..e71849d72fa 100644
--- a/mps/code/amcssth.c
+++ b/mps/code/amcssth.c
@@ -67,9 +67,9 @@ static void report(mps_arena_t arena)
67 not_condemned = mps_message_gc_not_condemned_size(arena, message); 67 not_condemned = mps_message_gc_not_condemned_size(arena, message);
68 68
69 printf("\nCollection %d finished:\n", ++nCollections); 69 printf("\nCollection %d finished:\n", ++nCollections);
70 printf("live %lu\n", (unsigned long)live); 70 printf("live %"PRIuLONGEST"\n", (ulongest_t)live);
71 printf("condemned %lu\n", (unsigned long)condemned); 71 printf("condemned %"PRIuLONGEST"\n", (ulongest_t)condemned);
72 printf("not_condemned %lu\n", (unsigned long)not_condemned); 72 printf("not_condemned %"PRIuLONGEST"\n", (ulongest_t)not_condemned);
73 73
74 mps_message_discard(arena, message); 74 mps_message_discard(arena, message);
75 75
diff --git a/mps/code/amsss.c b/mps/code/amsss.c
index 16b5fef3c91..efe8c173731 100644
--- a/mps/code/amsss.c
+++ b/mps/code/amsss.c
@@ -73,9 +73,9 @@ static void report(void)
73 not_condemned = mps_message_gc_not_condemned_size(arena, message); 73 not_condemned = mps_message_gc_not_condemned_size(arena, message);
74 74
75 printf("\nCollection complete %d:\n", ++nComplete); 75 printf("\nCollection complete %d:\n", ++nComplete);
76 printf("live %lu\n", (unsigned long)live); 76 printf("live %"PRIuLONGEST"\n", (ulongest_t)live);
77 printf("condemned %lu\n", (unsigned long)condemned); 77 printf("condemned %"PRIuLONGEST"\n", (ulongest_t)condemned);
78 printf("not_condemned %lu\n", (unsigned long)not_condemned); 78 printf("not_condemned %"PRIuLONGEST"\n", (ulongest_t)not_condemned);
79 } 79 }
80 break; 80 break;
81 default: 81 default:
@@ -153,8 +153,8 @@ static void *test(void *arg, size_t haveAmbigous)
153 while(totalSize < totalSizeMAX) { 153 while(totalSize < totalSizeMAX) {
154 if (totalSize > lastStep + totalSizeSTEP) { 154 if (totalSize > lastStep + totalSizeSTEP) {
155 lastStep = totalSize; 155 lastStep = totalSize;
156 printf("\nSize %lu bytes, %lu objects.\n", 156 printf("\nSize %"PRIuLONGEST" bytes, %lu objects.\n",
157 (unsigned long)totalSize, objs); 157 (ulongest_t)totalSize, objs);
158 fflush(stdout); 158 fflush(stdout);
159 for(i = 0; i < exactRootsCOUNT; ++i) 159 for(i = 0; i < exactRootsCOUNT; ++i)
160 cdie(exactRoots[i] == objNULL || dylan_check(exactRoots[i]), 160 cdie(exactRoots[i] == objNULL || dylan_check(exactRoots[i]),
diff --git a/mps/code/amssshe.c b/mps/code/amssshe.c
index 256246e0696..a042a06d3ed 100644
--- a/mps/code/amssshe.c
+++ b/mps/code/amssshe.c
@@ -108,8 +108,8 @@ static void *test(void *arg, size_t s)
108 while(totalSize < totalSizeMAX) { 108 while(totalSize < totalSizeMAX) {
109 if(totalSize > lastStep + totalSizeSTEP) { 109 if(totalSize > lastStep + totalSizeSTEP) {
110 lastStep = totalSize; 110 lastStep = totalSize;
111 printf("\nSize %lu bytes, %lu objects.\n", 111 printf("\nSize %"PRIuLONGEST" bytes, %lu objects.\n",
112 (unsigned long)totalSize, objs); 112 (ulongest_t)totalSize, objs);
113 fflush(stdout); 113 fflush(stdout);
114 for(i = 0; i < exactRootsCOUNT; ++i) 114 for(i = 0; i < exactRootsCOUNT; ++i)
115 cdie(exactRoots[i] == objNULL || dylan_check(exactRoots[i]), 115 cdie(exactRoots[i] == objNULL || dylan_check(exactRoots[i]),
diff --git a/mps/code/btcv.c b/mps/code/btcv.c
index efd9d14425b..fd411ee461b 100644
--- a/mps/code/btcv.c
+++ b/mps/code/btcv.c
@@ -61,7 +61,8 @@ static void btResRangeSymmetric(BT btlo, BT bthi, Count btSize,
61} 61}
62 62
63 63
64typedef Bool (*BTFinderFn)(Index *, Index *, BT, Index, Index, unsigned long); 64typedef Bool (*BTFinderFn)(Index *foundBase_o, Index *foundLimit_o,
65 BT bt, Index base, Index limit, Count length);
65 66
66 67
67/* btTestSingleRange -- Test expectations for calls to BTFind*ResRange* 68/* btTestSingleRange -- Test expectations for calls to BTFind*ResRange*
@@ -70,7 +71,7 @@ typedef Bool (*BTFinderFn)(Index *, Index *, BT, Index, Index, unsigned long);
70 71
71static void btTestSingleRange(BTFinderFn finder, BT bt, 72static void btTestSingleRange(BTFinderFn finder, BT bt,
72 Index base, Index limit, 73 Index base, Index limit,
73 unsigned long length, 74 Count length,
74 Bool expect, 75 Bool expect,
75 Index expectBase, Index expectLimit) 76 Index expectBase, Index expectLimit)
76{ 77{
@@ -94,7 +95,7 @@ static void btTestSingleRange(BTFinderFn finder, BT bt,
94 95
95static void btTestResRange(BT btlo, BT bthi, Count btSize, 96static void btTestResRange(BT btlo, BT bthi, Count btSize,
96 Index base, Index limit, 97 Index base, Index limit,
97 unsigned long length, 98 Count length,
98 Bool expect, 99 Bool expect,
99 Index expectBase, Index expectLimit) 100 Index expectBase, Index expectLimit)
100{ 101{
@@ -120,7 +121,7 @@ static void btTestResRange(BT btlo, BT bthi, Count btSize,
120 121
121static void btTestLongResRange(BT btlo, BT bthi, Count btSize, 122static void btTestLongResRange(BT btlo, BT bthi, Count btSize,
122 Index base, Index limit, 123 Index base, Index limit,
123 unsigned long length, 124 Count length,
124 Bool expect, 125 Bool expect,
125 Index expectBase, Index expectLimit) 126 Index expectBase, Index expectLimit)
126{ 127{
@@ -145,7 +146,7 @@ static void btTestLongResRange(BT btlo, BT bthi, Count btSize,
145 146
146static void btAllResTest(BT btlo, BT bthi, Count btSize, 147static void btAllResTest(BT btlo, BT bthi, Count btSize,
147 Index base, Index limit, 148 Index base, Index limit,
148 unsigned long length) 149 Count length)
149{ 150{
150 btResRangeSymmetric(btlo, bthi, btSize, 0, btSize); 151 btResRangeSymmetric(btlo, bthi, btSize, 0, btSize);
151 btTestResRange(btlo, bthi, btSize, base, limit, length, 152 btTestResRange(btlo, bthi, btSize, base, limit, length,
@@ -164,7 +165,7 @@ static void btAllResTest(BT btlo, BT bthi, Count btSize,
164 165
165static void btNoResTest(BT btlo, BT bthi, Count btSize, 166static void btNoResTest(BT btlo, BT bthi, Count btSize,
166 Index base, Index limit, 167 Index base, Index limit,
167 unsigned long length) 168 Count length)
168{ 169{
169 btResRangeSymmetric(btlo, bthi, btSize, 0, btSize); 170 btResRangeSymmetric(btlo, bthi, btSize, 0, btSize);
170 btSetRangeSymmetric(btlo, bthi, btSize, base, limit); 171 btSetRangeSymmetric(btlo, bthi, btSize, base, limit);
@@ -185,7 +186,7 @@ static void btNoResTest(BT btlo, BT bthi, Count btSize,
185static void btResAndFindTest(BT btlo, BT bthi, Count btSize, 186static void btResAndFindTest(BT btlo, BT bthi, Count btSize,
186 Index base, Index limit, 187 Index base, Index limit,
187 Index resBase, Index resLimit, 188 Index resBase, Index resLimit,
188 unsigned long length) 189 Count length)
189{ 190{
190 btResRangeSymmetric(btlo, bthi, btSize, resBase, resLimit); 191 btResRangeSymmetric(btlo, bthi, btSize, resBase, resLimit);
191 if ((resLimit - resBase) < length) { 192 if ((resLimit - resBase) < length) {
@@ -210,9 +211,9 @@ static void btResAndFindTest(BT btlo, BT bthi, Count btSize,
210 211
211static void btSingleResTest(BT btlo, BT bthi, Count btSize, 212static void btSingleResTest(BT btlo, BT bthi, Count btSize,
212 Index base, Index limit, 213 Index base, Index limit,
213 unsigned long length) 214 Count length)
214{ 215{
215 unsigned long resLen; 216 Count resLen;
216 /* choose varying range lengths from too short to longer than needed */ 217 /* choose varying range lengths from too short to longer than needed */
217 for (resLen = length - 1; resLen <= length + 1; resLen++) { 218 for (resLen = length - 1; resLen <= length + 1; resLen++) {
218 if ((resLen > 0) && (resLen < (limit - base -2))) { 219 if ((resLen > 0) && (resLen < (limit - base -2))) {
@@ -257,7 +258,7 @@ typedef unsigned Arrangement;
257/* Choose a limit for reset range 1 */ 258/* Choose a limit for reset range 1 */
258static Index btArrangeRes1(Arrangement arrange, 259static Index btArrangeRes1(Arrangement arrange,
259 Index base, Index res2Base, 260 Index base, Index res2Base,
260 unsigned long length) 261 Count length)
261{ 262{
262 switch (arrange) { 263 switch (arrange) {
263 264
@@ -295,7 +296,7 @@ typedef unsigned Pattern;
295/* Choose a limit for reset range 1 */ 296/* Choose a limit for reset range 1 */
296static void btResetFirstRange(BT btlo, BT bthi, Count btSize, 297static void btResetFirstRange(BT btlo, BT bthi, Count btSize,
297 Index res1Limit, 298 Index res1Limit,
298 unsigned long length, 299 Count length,
299 Pattern pattern) 300 Pattern pattern)
300{ 301{
301 switch (pattern) { 302 switch (pattern) {
@@ -329,9 +330,9 @@ static void btResetFirstRange(BT btlo, BT bthi, Count btSize,
329 330
330static void btDoubleResTest(BT btlo, BT bthi, Count btSize, 331static void btDoubleResTest(BT btlo, BT bthi, Count btSize,
331 Index base, Index limit, 332 Index base, Index limit,
332 unsigned long length) 333 Count length)
333{ 334{
334 unsigned long res2Len; 335 Count res2Len;
335 336
336 if (length < 2) 337 if (length < 2)
337 return; /* no possibility of making the first range too small */ 338 return; /* no possibility of making the first range too small */
@@ -371,7 +372,7 @@ static void btDoubleResTest(BT btlo, BT bthi, Count btSize,
371 372
372static void btFindRangeTests(BT btlo, BT bthi, Count btSize, 373static void btFindRangeTests(BT btlo, BT bthi, Count btSize,
373 Index base, Index limit, 374 Index base, Index limit,
374 unsigned long length) 375 Count length)
375{ 376{
376 btAllResTest(btlo, bthi, btSize, base, limit, length); 377 btAllResTest(btlo, bthi, btSize, base, limit, length);
377 btNoResTest(btlo, bthi, btSize, base, limit, length); 378 btNoResTest(btlo, bthi, btSize, base, limit, length);
diff --git a/mps/code/bttest.c b/mps/code/bttest.c
index 3c5e44833c6..1b3514c839a 100644
--- a/mps/code/bttest.c
+++ b/mps/code/bttest.c
@@ -174,7 +174,8 @@ static void findShortResRange(void)
174 Bool b = BTFindShortResRange(&base, &limit, bt, 174 Bool b = BTFindShortResRange(&base, &limit, bt,
175 args[1], args[2], args[0]); 175 args[1], args[2], args[0]);
176 if (b) 176 if (b)
177 printf("%lu - %lu\n",base, limit); 177 printf("%"PRIuLONGEST" - %"PRIuLONGEST"\n",
178 (ulongest_t)base, (ulongest_t)limit);
178 else 179 else
179 printf("FALSE\n"); 180 printf("FALSE\n");
180 } 181 }
@@ -192,7 +193,8 @@ static void findShortResRangeHigh(void)
192 Bool b = BTFindShortResRangeHigh(&base, &limit, bt, 193 Bool b = BTFindShortResRangeHigh(&base, &limit, bt,
193 args[1], args[2], args[0]); 194 args[1], args[2], args[0]);
194 if (b) 195 if (b)
195 printf("%lu - %lu\n",base, limit); 196 printf("%"PRIuLONGEST" - %"PRIuLONGEST"\n",
197 (ulongest_t)base, (ulongest_t)limit);
196 else 198 else
197 printf("FALSE\n"); 199 printf("FALSE\n");
198 } 200 }
@@ -209,7 +211,8 @@ static void findLongResRange(void)
209 Bool b = BTFindLongResRange(&base, &limit, bt, 211 Bool b = BTFindLongResRange(&base, &limit, bt,
210 args[1], args[2], args[0]); 212 args[1], args[2], args[0]);
211 if (b) 213 if (b)
212 printf("%lu - %lu\n",base, limit); 214 printf("%"PRIuLONGEST" - %"PRIuLONGEST"\n",
215 (ulongest_t)base, (ulongest_t)limit);
213 else 216 else
214 printf("FALSE\n"); 217 printf("FALSE\n");
215 } 218 }
diff --git a/mps/code/cbs.c b/mps/code/cbs.c
index 6eff37a844e..e3f5204e03e 100644
--- a/mps/code/cbs.c
+++ b/mps/code/cbs.c
@@ -1380,7 +1380,6 @@ Bool CBSFindFirst(Addr *baseReturn, Addr *limitReturn,
1380 AVER(baseReturn != NULL); 1380 AVER(baseReturn != NULL);
1381 AVER(limitReturn != NULL); 1381 AVER(limitReturn != NULL);
1382 AVER(size > 0); 1382 AVER(size > 0);
1383 AVER(sizeof(unsigned long) >= sizeof(Size));
1384 AVER(SizeIsAligned(size, cbs->alignment)); 1383 AVER(SizeIsAligned(size, cbs->alignment));
1385 AVER(cbs->fastFind); 1384 AVER(cbs->fastFind);
1386 AVERT(CBSFindDelete, findDelete); 1385 AVERT(CBSFindDelete, findDelete);
@@ -1463,7 +1462,6 @@ Bool CBSFindLast(Addr *baseReturn, Addr *limitReturn,
1463 AVER(baseReturn != NULL); 1462 AVER(baseReturn != NULL);
1464 AVER(limitReturn != NULL); 1463 AVER(limitReturn != NULL);
1465 AVER(size > 0); 1464 AVER(size > 0);
1466 AVER(sizeof(unsigned long) >= sizeof(Size));
1467 AVER(SizeIsAligned(size, cbs->alignment)); 1465 AVER(SizeIsAligned(size, cbs->alignment));
1468 AVER(cbs->fastFind); 1466 AVER(cbs->fastFind);
1469 AVERT(CBSFindDelete, findDelete); 1467 AVERT(CBSFindDelete, findDelete);
@@ -1551,7 +1549,6 @@ Bool CBSFindLargest(Addr *baseReturn, Addr *limitReturn,
1551 1549
1552 AVER(baseReturn != NULL); 1550 AVER(baseReturn != NULL);
1553 AVER(limitReturn != NULL); 1551 AVER(limitReturn != NULL);
1554 AVER(sizeof(unsigned long) >= sizeof(Size));
1555 AVER(cbs->fastFind); 1552 AVER(cbs->fastFind);
1556 AVERT(CBSFindDelete, findDelete); 1553 AVERT(CBSFindDelete, findDelete);
1557 1554
diff --git a/mps/code/cbstest.c b/mps/code/cbstest.c
index 393a17c162d..0777a08732b 100644
--- a/mps/code/cbstest.c
+++ b/mps/code/cbstest.c
@@ -501,7 +501,7 @@ static void find(CBS cbs, void *block, BT alloc, Size size, Bool high,
501 501
502 expected = (high ? BTFindLongResRangeHigh : BTFindLongResRange) 502 expected = (high ? BTFindLongResRangeHigh : BTFindLongResRange)
503 (&expectedBase, &expectedLimit, alloc, 503 (&expectedBase, &expectedLimit, alloc,
504 (Index)0, (Index)ArraySize, (unsigned long)size); 504 (Index)0, (Index)ArraySize, (Count)size);
505 505
506 if (expected) { 506 if (expected) {
507 oldSize = (expectedLimit - expectedBase) * Alignment; 507 oldSize = (expectedLimit - expectedBase) * Alignment;
diff --git a/mps/code/dumper.c b/mps/code/dumper.c
index bb8889d6632..b2bc31de86c 100644
--- a/mps/code/dumper.c
+++ b/mps/code/dumper.c
@@ -20,12 +20,23 @@
20#include "ossu.h" 20#include "ossu.h"
21#endif 21#endif
22 22
23typedef unsigned long Word; 23typedef MPS_T_WORD Word;
24typedef struct AddrStruct *Addr; 24typedef struct AddrStruct *Addr;
25 25
26#include "eventcom.h" 26#include "eventcom.h"
27 27
28 28
29#ifdef MPS_PF_W3I6MV
30#define PRIuLONGEST "llu"
31#define PRIXPTR "016llX"
32typedef unsigned long long ulongest_t;
33#else
34#define PRIuLONGEST "lu"
35#define PRIXPTR "08lX"
36typedef unsigned long ulongest_t;
37#endif
38
39
29#define RELATION(type, code, always, kind, format) \ 40#define RELATION(type, code, always, kind, format) \
30 case Event ## type: \ 41 case Event ## type: \
31 readEvent(#type, #format, header[0], header[1], header[2]); \ 42 readEvent(#type, #format, header[0], header[1], header[2]); \
@@ -72,10 +83,10 @@ static void readEvent(char *type, char *format, Word code, Word length,
72 83
73 for(; *format != '\0'; format++) { 84 for(; *format != '\0'; format++) {
74 switch(*format) { 85 switch(*format) {
75 PROCESS('A', Addr, sizeof(Addr), "0x%08lX", unsigned long) 86 PROCESS('A', Addr, sizeof(Addr), "0x%"PRIXPTR, ulongest_t)
76 PROCESS('P', void *, sizeof(void *), "0x%08lX", unsigned long) 87 PROCESS('P', void *, sizeof(void *), "0x%"PRIXPTR, ulongest_t)
77 PROCESS('U', unsigned, sizeof(unsigned),"%u", unsigned) 88 PROCESS('U', unsigned, sizeof(unsigned),"%u", unsigned)
78 PROCESS('W', Word, sizeof(Word),"%lu", Word) 89 PROCESS('W', Word, sizeof(Word), "%"PRIuLONGEST, ulongest_t)
79 PROCESS('D', double, sizeof(double), "%f", double) 90 PROCESS('D', double, sizeof(double), "%f", double)
80 case 'S': { 91 case 'S': {
81 size_t n; 92 size_t n;
diff --git a/mps/code/eventrep.c b/mps/code/eventrep.c
index 7d9f739bf6e..e0d8e2baa17 100644
--- a/mps/code/eventrep.c
+++ b/mps/code/eventrep.c
@@ -34,6 +34,17 @@
34#endif 34#endif
35 35
36 36
37#ifdef MPS_PF_W3I6MV
38#define PRIuLONGEST "llu"
39#define PRIXPTR "016llX"
40typedef unsigned long long ulongest_t;
41#else
42#define PRIuLONGEST "lu"
43#define PRIXPTR "08lX"
44typedef unsigned long ulongest_t;
45#endif
46
47
37typedef unsigned long ulong; 48typedef unsigned long ulong;
38 49
39 50
@@ -114,7 +125,7 @@ static void error(const char *format, ...)
114 va_list args; 125 va_list args;
115 126
116 fflush(stdout); /* sync */ 127 fflush(stdout); /* sync */
117 fprintf(stderr, "Failed @%lu ", (ulong)eventTime); 128 fprintf(stderr, "Failed @%"PRIuLONGEST" ", (ulongest_t)eventTime);
118 va_start(args, format); 129 va_start(args, format);
119 vfprintf(stderr, format, args); 130 vfprintf(stderr, format, args);
120 fprintf(stderr, "\n"); 131 fprintf(stderr, "\n");
diff --git a/mps/code/exposet0.c b/mps/code/exposet0.c
index ac4fa9ff4c6..009347ec8bd 100644
--- a/mps/code/exposet0.c
+++ b/mps/code/exposet0.c
@@ -69,9 +69,9 @@ static void report(mps_arena_t arena)
69 not_condemned = mps_message_gc_not_condemned_size(arena, message); 69 not_condemned = mps_message_gc_not_condemned_size(arena, message);
70 70
71 printf("\nCollection %d finished:\n", ++nCollections); 71 printf("\nCollection %d finished:\n", ++nCollections);
72 printf("live %lu\n", (unsigned long)live); 72 printf("live %"PRIuLONGEST"\n", (ulongest_t)live);
73 printf("condemned %lu\n", (unsigned long)condemned); 73 printf("condemned %"PRIuLONGEST"\n", (ulongest_t)condemned);
74 printf("not_condemned %lu\n", (unsigned long)not_condemned); 74 printf("not_condemned %"PRIuLONGEST"\n", (ulongest_t)not_condemned);
75 75
76 mps_message_discard(arena, message); 76 mps_message_discard(arena, message);
77 77
diff --git a/mps/code/locbwcss.c b/mps/code/locbwcss.c
index 3d85576b4fc..766b427ce30 100644
--- a/mps/code/locbwcss.c
+++ b/mps/code/locbwcss.c
@@ -133,8 +133,8 @@ static void reportResults(PoolStat stat, char *name)
133 printf("\nResults for "); 133 printf("\nResults for ");
134 fputs(name, stdout); 134 fputs(name, stdout);
135 printf("\n"); 135 printf("\n");
136 printf(" Allocated %lu objects\n", (unsigned long)stat->aCount); 136 printf(" Allocated %"PRIuLONGEST" objects\n", (ulongest_t)stat->aCount);
137 printf(" Freed %lu objects\n", (unsigned long)stat->fCount); 137 printf(" Freed %"PRIuLONGEST" objects\n", (ulongest_t)stat->fCount);
138 printf(" There were %lu non-contiguous allocations\n", 138 printf(" There were %lu non-contiguous allocations\n",
139 (unsigned long)stat->ncCount); 139 (unsigned long)stat->ncCount);
140 printf(" Address range from %p to %p\n", 140 printf(" Address range from %p to %p\n",
diff --git a/mps/code/locusss.c b/mps/code/locusss.c
index bd1ab6584a6..58689adea8a 100644
--- a/mps/code/locusss.c
+++ b/mps/code/locusss.c
@@ -137,8 +137,8 @@ static void reportResults(PoolStat stat, char *name)
137 printf("\nResults for "); 137 printf("\nResults for ");
138 printf("%s", name); 138 printf("%s", name);
139 printf("\n"); 139 printf("\n");
140 printf(" Allocated %lu objects\n", (unsigned long)stat->aCount); 140 printf(" Allocated %"PRIuLONGEST" objects\n", (ulongest_t)stat->aCount);
141 printf(" Freed %lu objects\n", (unsigned long)stat->fCount); 141 printf(" Freed %"PRIuLONGEST" objects\n", (ulongest_t)stat->fCount);
142 printf(" There were %lu non-contiguous allocations\n", 142 printf(" There were %lu non-contiguous allocations\n",
143 (unsigned long)stat->ncCount); 143 (unsigned long)stat->ncCount);
144 printf(" Address range from %p to %p\n", stat->min, stat->max); 144 printf(" Address range from %p to %p\n", stat->min, stat->max);
diff --git a/mps/code/mpmtypes.h b/mps/code/mpmtypes.h
index d1aaa1e4cf2..09a754e09e0 100644
--- a/mps/code/mpmtypes.h
+++ b/mps/code/mpmtypes.h
@@ -132,7 +132,7 @@ typedef Res (*TraceFixMethod)(ScanState ss, Ref *refIO);
132 132
133/* This type is used by the PoolClass method Walk */ 133/* This type is used by the PoolClass method Walk */
134typedef void (*FormattedObjectsStepMethod)(Addr obj, Format fmt, Pool pool, 134typedef void (*FormattedObjectsStepMethod)(Addr obj, Format fmt, Pool pool,
135 void *v, unsigned long s); 135 void *v, size_t s);
136 136
137/* This type is used by the PoolClass method Walk */ 137/* This type is used by the PoolClass method Walk */
138typedef void (*FreeBlockStepMethod)(Addr base, Addr limit, Pool pool, void *p); 138typedef void (*FreeBlockStepMethod)(Addr base, Addr limit, Pool pool, void *p);
diff --git a/mps/code/mv2test.c b/mps/code/mv2test.c
index ee322f41c74..91e683d055e 100644
--- a/mps/code/mv2test.c
+++ b/mps/code/mv2test.c
@@ -236,7 +236,8 @@ static mps_res_t stress(mps_class_t class, mps_arena_t arena,
236 236
237 if (verbose) { 237 if (verbose) {
238 if(i && i%4==0) putchar('\n'); 238 if(i && i%4==0) putchar('\n');
239 printf("%8lX %6lX ", (unsigned long)ps[i], (unsigned long)ss[i]); 239 printf("%"PRIwLONGEST PRIXLONGEST" %6"PRIXLONGEST" ",
240 (ulongest_t)ps[i], (ulongest_t)ss[i]);
240 } 241 }
241 } 242 }
242 if (verbose) { 243 if (verbose) {
@@ -273,7 +274,8 @@ static mps_res_t stress(mps_class_t class, mps_arena_t arena,
273 274
274 if (verbose) { 275 if (verbose) {
275 if(i && i%4==0) putchar('\n'); 276 if(i && i%4==0) putchar('\n');
276 printf("%8lX %6lX ", (unsigned long)ps[i], (unsigned long)ss[i]); 277 printf("%"PRIwLONGEST PRIXLONGEST" %6"PRIXLONGEST" ",
278 (ulongest_t)ps[i], (ulongest_t)ss[i]);
277 } 279 }
278 } 280 }
279 if (verbose) 281 if (verbose)
diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c
index 16dc4386c2b..fc33cbbe548 100644
--- a/mps/code/poolamc.c
+++ b/mps/code/poolamc.c
@@ -2251,7 +2251,7 @@ static void AMCTraceEnd(Pool pool, Trace trace)
2251/* AMCWalk -- Apply function to (black) objects in segment */ 2251/* AMCWalk -- Apply function to (black) objects in segment */
2252 2252
2253static void AMCWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f, 2253static void AMCWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f,
2254 void *p, unsigned long s) 2254 void *p, size_t s)
2255{ 2255{
2256 Addr object, nextObject, limit; 2256 Addr object, nextObject, limit;
2257 AMC amc; 2257 AMC amc;
@@ -2301,7 +2301,7 @@ static void AMCWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f,
2301/* amcWalkAll -- Apply a function to all (black) objects in a pool */ 2301/* amcWalkAll -- Apply a function to all (black) objects in a pool */
2302 2302
2303static void amcWalkAll(Pool pool, FormattedObjectsStepMethod f, 2303static void amcWalkAll(Pool pool, FormattedObjectsStepMethod f,
2304 void *p, unsigned long s) 2304 void *p, size_t s)
2305{ 2305{
2306 Arena arena; 2306 Arena arena;
2307 Ring ring, next, node; 2307 Ring ring, next, node;
@@ -2466,7 +2466,7 @@ typedef struct mps_amc_apply_closure_s {
2466} mps_amc_apply_closure_s; 2466} mps_amc_apply_closure_s;
2467 2467
2468static void mps_amc_apply_iter(Addr addr, Format format, Pool pool, 2468static void mps_amc_apply_iter(Addr addr, Format format, Pool pool,
2469 void *p, unsigned long s) 2469 void *p, size_t s)
2470{ 2470{
2471 mps_amc_apply_closure_s *closure = p; 2471 mps_amc_apply_closure_s *closure = p;
2472 /* Can't check addr */ 2472 /* Can't check addr */
diff --git a/mps/code/poolawl.c b/mps/code/poolawl.c
index f2c6a977c15..38673219495 100644
--- a/mps/code/poolawl.c
+++ b/mps/code/poolawl.c
@@ -1145,7 +1145,7 @@ static Res AWLAccess(Pool pool, Seg seg, Addr addr,
1145/* AWLWalk -- walk all objects */ 1145/* AWLWalk -- walk all objects */
1146 1146
1147static void AWLWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f, 1147static void AWLWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f,
1148 void *p, unsigned long s) 1148 void *p, size_t s)
1149{ 1149{
1150 AWL awl; 1150 AWL awl;
1151 AWLSeg awlseg; 1151 AWLSeg awlseg;
diff --git a/mps/code/poollo.c b/mps/code/poollo.c
index 75f4bde67e9..c6f22a595cf 100644
--- a/mps/code/poollo.c
+++ b/mps/code/poollo.c
@@ -108,7 +108,7 @@ static Res loSegInit(Seg seg, Pool pool, Addr base, Size size,
108 Size tablebytes; /* # bytes in each control array */ 108 Size tablebytes; /* # bytes in each control array */
109 Arena arena; 109 Arena arena;
110 /* number of bits needed in each control array */ 110 /* number of bits needed in each control array */
111 unsigned long bits; 111 Count bits;
112 void *p; 112 void *p;
113 113
114 AVERT(Seg, seg); 114 AVERT(Seg, seg);
@@ -165,7 +165,7 @@ static void loSegFinish(Seg seg)
165 Pool pool; 165 Pool pool;
166 Arena arena; 166 Arena arena;
167 Size tablesize; 167 Size tablesize;
168 unsigned long bits; 168 Count bits;
169 169
170 AVERT(Seg, seg); 170 AVERT(Seg, seg);
171 loseg = SegLOSeg(seg); 171 loseg = SegLOSeg(seg);
@@ -236,7 +236,7 @@ static Bool loSegFindFree(Addr *bReturn, Addr *lReturn,
236 Seg seg; 236 Seg seg;
237 Arena arena; 237 Arena arena;
238 Count agrains; 238 Count agrains;
239 unsigned long tablesize; 239 Count bits;
240 Addr segBase; 240 Addr segBase;
241 241
242 AVER(bReturn != NULL); 242 AVER(bReturn != NULL);
@@ -260,9 +260,9 @@ static Bool loSegFindFree(Addr *bReturn, Addr *lReturn,
260 return FALSE; 260 return FALSE;
261 } 261 }
262 262
263 tablesize = SegSize(seg) >> lo->alignShift; 263 bits = SegSize(seg) >> lo->alignShift;
264 if(!BTFindLongResRange(&baseIndex, &limitIndex, loseg->alloc, 264 if(!BTFindLongResRange(&baseIndex, &limitIndex, loseg->alloc,
265 0, tablesize, agrains)) { 265 0, bits, agrains)) {
266 return FALSE; 266 return FALSE;
267 } 267 }
268 268
@@ -408,7 +408,7 @@ static void loSegReclaim(LOSeg loseg, Trace trace)
408/* a leaf pool, so there can't be any dangling references */ 408/* a leaf pool, so there can't be any dangling references */
409static void LOWalk(Pool pool, Seg seg, 409static void LOWalk(Pool pool, Seg seg,
410 FormattedObjectsStepMethod f, 410 FormattedObjectsStepMethod f,
411 void *p, unsigned long s) 411 void *p, size_t s)
412{ 412{
413 Addr base; 413 Addr base;
414 LO lo; 414 LO lo;
@@ -491,7 +491,7 @@ static Res LOInit(Pool pool, va_list arg)
491 pool->format = format; 491 pool->format = format;
492 lo->poolStruct.alignment = format->alignment; 492 lo->poolStruct.alignment = format->alignment;
493 lo->alignShift = 493 lo->alignShift =
494 SizeLog2((unsigned long)PoolAlignment(&lo->poolStruct)); 494 SizeLog2((Size)PoolAlignment(&lo->poolStruct));
495 lo->gen = LOGen; /* may be modified in debugger */ 495 lo->gen = LOGen; /* may be modified in debugger */
496 res = ChainCreate(&lo->chain, arena, 1, &loGenParam); 496 res = ChainCreate(&lo->chain, arena, 1, &loGenParam);
497 if (res != ResOK) 497 if (res != ResOK)
@@ -669,7 +669,7 @@ static void LOBufferEmpty(Pool pool, Buffer buffer, Addr init, Addr limit)
669static Res LOWhiten(Pool pool, Trace trace, Seg seg) 669static Res LOWhiten(Pool pool, Trace trace, Seg seg)
670{ 670{
671 LO lo; 671 LO lo;
672 unsigned long bits; 672 Count bits;
673 673
674 AVERT(Pool, pool); 674 AVERT(Pool, pool);
675 lo = PoolPoolLO(pool); 675 lo = PoolPoolLO(pool);
diff --git a/mps/code/poolsnc.c b/mps/code/poolsnc.c
index d4a5d0652b1..74ba6d3cab0 100644
--- a/mps/code/poolsnc.c
+++ b/mps/code/poolsnc.c
@@ -615,7 +615,7 @@ static void SNCFramePopPending(Pool pool, Buffer buf, AllocFrame frame)
615 615
616 616
617static void SNCWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f, 617static void SNCWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f,
618 void *p, unsigned long s) 618 void *p, size_t s)
619{ 619{
620 AVERT(Pool, pool); 620 AVERT(Pool, pool);
621 AVERT(Seg, seg); 621 AVERT(Seg, seg);
diff --git a/mps/code/qs.c b/mps/code/qs.c
index e289da40f6d..ae07aea9e60 100644
--- a/mps/code/qs.c
+++ b/mps/code/qs.c
@@ -311,8 +311,8 @@ static void validate(void)
311 cdie(((QSCell)reg[1])->tag == QSInt, "validate int"); 311 cdie(((QSCell)reg[1])->tag == QSInt, "validate int");
312 if(((QSCell)reg[1])->value != list[i]) { 312 if(((QSCell)reg[1])->value != list[i]) {
313 fprintf(stdout, 313 fprintf(stdout,
314 "mps_res_t: Element %lu of the two lists do not match.\n", 314 "mps_res_t: Element %"PRIuLONGEST" of the two lists do not match.\n",
315 (unsigned long)i); 315 (ulongest_t)i);
316 return; 316 return;
317 } 317 }
318 reg[1] = (mps_word_t)((QSCell)reg[1])->tail; 318 reg[1] = (mps_word_t)((QSCell)reg[1])->tail;
diff --git a/mps/code/replay.c b/mps/code/replay.c
index e958cb555c8..00dee793b7c 100644
--- a/mps/code/replay.c
+++ b/mps/code/replay.c
@@ -24,6 +24,17 @@
24#endif 24#endif
25 25
26 26
27#ifdef MPS_PF_W3I6MV
28#define PRIuLONGEST "llu"
29#define PRIXPTR "016llX"
30typedef unsigned long long ulongest_t;
31#else
32#define PRIuLONGEST "lu"
33#define PRIXPTR "08lX"
34typedef unsigned long ulongest_t;
35#endif
36
37
27typedef unsigned long ulong; 38typedef unsigned long ulong;
28 39
29 40
@@ -46,7 +57,7 @@ static void error(const char *format, ...)
46 va_list args; 57 va_list args;
47 58
48 fflush(stdout); /* sync */ 59 fflush(stdout); /* sync */
49 fprintf(stderr, "%s: @%lu ", prog, (ulong)eventTime); 60 fprintf(stderr, "%s: @%"PRIuLONGEST" ", prog, (ulongest_t)eventTime);
50 va_start(args, format); 61 va_start(args, format);
51 vfprintf(stderr, format, args); 62 vfprintf(stderr, format, args);
52 fprintf(stderr, "\n"); 63 fprintf(stderr, "\n");
diff --git a/mps/code/segsmss.c b/mps/code/segsmss.c
index 83d919b9995..71036b3edbb 100644
--- a/mps/code/segsmss.c
+++ b/mps/code/segsmss.c
@@ -376,13 +376,13 @@ static void AMSTFinish(Pool pool)
376 AVERT(AMST, amst); 376 AVERT(AMST, amst);
377 377
378 printf("\nDestroying pool, having performed:\n"); 378 printf("\nDestroying pool, having performed:\n");
379 printf(" %lu splits (S)\n", (unsigned long)amst->splits); 379 printf(" %"PRIuLONGEST" splits (S)\n", (ulongest_t)amst->splits);
380 printf(" %lu merges (M)\n", (unsigned long)amst->merges); 380 printf(" %"PRIuLONGEST" merges (M)\n", (ulongest_t)amst->merges);
381 printf(" %lu aborted splits (B)\n", (unsigned long)amst->badSplits); 381 printf(" %"PRIuLONGEST" aborted splits (B)\n", (ulongest_t)amst->badSplits);
382 printf(" %lu aborted merges (D)\n", (unsigned long)amst->badMerges); 382 printf(" %"PRIuLONGEST" aborted merges (D)\n", (ulongest_t)amst->badMerges);
383 printf(" which included:\n"); 383 printf(" which included:\n");
384 printf(" %lu buffered splits (C)\n", (unsigned long)amst->bsplits); 384 printf(" %"PRIuLONGEST" buffered splits (C)\n", (ulongest_t)amst->bsplits);
385 printf(" %lu buffered merges (J)\n", (unsigned long)amst->bmerges); 385 printf(" %"PRIuLONGEST" buffered merges (J)\n", (ulongest_t)amst->bmerges);
386 386
387 AMSFinish(pool); 387 AMSFinish(pool);
388 amst->sig = SigInvalid; 388 amst->sig = SigInvalid;
@@ -799,8 +799,8 @@ static void *test(void *arg, size_t s)
799 while(totalSize < totalSizeMAX) { 799 while(totalSize < totalSizeMAX) {
800 if (totalSize > lastStep + totalSizeSTEP) { 800 if (totalSize > lastStep + totalSizeSTEP) {
801 lastStep = totalSize; 801 lastStep = totalSize;
802 printf("\nSize %lu bytes, %lu objects.\n", 802 printf("\nSize %"PRIuLONGEST" bytes, %"PRIuLONGEST" objects.\n",
803 (unsigned long)totalSize, objs); 803 (ulongest_t)totalSize, (ulongest_t)objs);
804 printf("%s", indent); 804 printf("%s", indent);
805 fflush(stdout); 805 fflush(stdout);
806 for(i = 0; i < exactRootsCOUNT; ++i) 806 for(i = 0; i < exactRootsCOUNT; ++i)
diff --git a/mps/code/splay.c b/mps/code/splay.c
index 4668a23e48a..4042f2c0e07 100644
--- a/mps/code/splay.c
+++ b/mps/code/splay.c
@@ -801,7 +801,7 @@ typedef struct {
801 SplayTestNodeMethod testNode; 801 SplayTestNodeMethod testNode;
802 SplayTestTreeMethod testTree; 802 SplayTestTreeMethod testTree;
803 void *p; 803 void *p;
804 unsigned long s; 804 Size s;
805 SplayTree tree; 805 SplayTree tree;
806} SplayFindClosureStruct, *SplayFindClosure; 806} SplayFindClosureStruct, *SplayFindClosure;
807 807
@@ -809,7 +809,7 @@ static Compare SplayFindFirstCompare(void *key, SplayNode node)
809{ 809{
810 SplayFindClosure closure; 810 SplayFindClosure closure;
811 void *closureP; 811 void *closureP;
812 unsigned long closureS; 812 Size closureS;
813 SplayTestNodeMethod testNode; 813 SplayTestNodeMethod testNode;
814 SplayTestTreeMethod testTree; 814 SplayTestTreeMethod testTree;
815 SplayTree tree; 815 SplayTree tree;
@@ -840,7 +840,7 @@ static Compare SplayFindLastCompare(void *key, SplayNode node)
840{ 840{
841 SplayFindClosure closure; 841 SplayFindClosure closure;
842 void *closureP; 842 void *closureP;
843 unsigned long closureS; 843 Size closureS;
844 SplayTestNodeMethod testNode; 844 SplayTestNodeMethod testNode;
845 SplayTestTreeMethod testTree; 845 SplayTestTreeMethod testTree;
846 SplayTree tree; 846 SplayTree tree;
diff --git a/mps/code/steptest.c b/mps/code/steptest.c
index a017da67e87..821a0d5c95a 100644
--- a/mps/code/steptest.c
+++ b/mps/code/steptest.c
@@ -50,11 +50,11 @@ static mps_gen_param_s testChain[genCOUNT] = {
50 * during allocation. 50 * during allocation.
51 */ 51 */
52 52
53static size_t step_frequencies[] = { 53static unsigned long step_frequencies[] = {
54 1000, 54 1000,
55 5000, 55 5000,
56 10000, 56 10000,
57 1000000000, 57 1000000000, /* one billion */
58}; 58};
59 59
60#define TESTS (sizeof(step_frequencies) / sizeof(step_frequencies[0])) 60#define TESTS (sizeof(step_frequencies) / sizeof(step_frequencies[0]))
@@ -414,11 +414,11 @@ static void *test(void *arg, size_t s)
414 414
415 total_mps_time = alloc_time + step_time + no_step_time; 415 total_mps_time = alloc_time + step_time + no_step_time;
416 printf("Collection statistics:\n"); 416 printf("Collection statistics:\n");
417 printf(" %lu collections\n", (unsigned long)collections); 417 printf(" %"PRIuLONGEST" collections\n", (ulongest_t)collections);
418 printf(" %lu bytes condemned.\n", (unsigned long)condemned); 418 printf(" %"PRIuLONGEST" bytes condemned.\n", (ulongest_t)condemned);
419 printf(" %lu bytes not condemned.\n", 419 printf(" %lu bytes not condemned.\n",
420 (unsigned long)not_condemned); 420 (unsigned long)not_condemned);
421 printf(" %lu bytes survived.\n", (unsigned long)live); 421 printf(" %"PRIuLONGEST" bytes survived.\n", (ulongest_t)live);
422 if (condemned) { 422 if (condemned) {
423 printf(" Mortality %5.2f%%.\n", 423 printf(" Mortality %5.2f%%.\n",
424 (1.0 - ((double)live)/condemned) * 100.0); 424 (1.0 - ((double)live)/condemned) * 100.0);
@@ -471,7 +471,7 @@ static void *test(void *arg, size_t s)
471 print_time(" (adjusted for clock timing: ", 471 print_time(" (adjusted for clock timing: ",
472 total_clock_time, 472 total_clock_time,
473 " spent reading the clock;\n"); 473 " spent reading the clock;\n");
474 printf(" %lu clock reads; ", (unsigned long)clock_reads); 474 printf(" %"PRIuLONGEST" clock reads; ", (ulongest_t)clock_reads);
475 print_time("", total_clock_time / clock_reads, " per read;"); 475 print_time("", total_clock_time / clock_reads, " per read;");
476 print_time(" recently measured as ", clock_time, ").\n"); 476 print_time(" recently measured as ", clock_time, ").\n");
477 mps_ap_destroy(ap); 477 mps_ap_destroy(ap);
diff --git a/mps/code/testlib.h b/mps/code/testlib.h
index 2a70fa81f58..63d462a6658 100644
--- a/mps/code/testlib.h
+++ b/mps/code/testlib.h
@@ -75,6 +75,30 @@
75#endif /* MPS_BUILD_MV */ 75#endif /* MPS_BUILD_MV */
76 76
77 77
78/* ulongest_t -- longest unsigned integer type
79 *
80 * Define a longest unsigned integer type for testing and printing. We'd
81 * like to use C99's uintmax_t and PRIuMAX here, but the MPS is in C89
82 * and C99 isn't supported by Microsoft.
83 *
84 * We avoid using the ones defined in mpstd.h because we want the tests to
85 * root out any incompatible assumptions by breaking.
86 */
87
88#ifdef MPS_PF_W3I6MV
89#define PRIuLONGEST "llu"
90#define PRIXLONGEST "llX"
91#define PRIwLONGEST "16"
92typedef unsigned long long ulongest_t;
93#else
94#define PRIuLONGEST "lu"
95#define PRIXLONGEST "lX"
96#define PRIwLONGEST "8"
97typedef unsigned long ulongest_t;
98#endif
99#define PRIXPTR "0"PRIwLONGEST PRIXLONGEST
100
101
78/* testlib_unused -- declares that a variable is unused 102/* testlib_unused -- declares that a variable is unused
79 * 103 *
80 * It should be used to prevent compiler warnings about unused 104 * It should be used to prevent compiler warnings about unused
diff --git a/mps/code/zcoll.c b/mps/code/zcoll.c
index f9c868049f4..546e6b50def 100644
--- a/mps/code/zcoll.c
+++ b/mps/code/zcoll.c
@@ -92,13 +92,13 @@ static void *stack_start;
92static mps_thr_t stack_thr; 92static mps_thr_t stack_thr;
93 93
94 94
95static unsigned long cols(size_t bytes) 95static ulongest_t cols(size_t bytes)
96{ 96{
97 double M; /* Mebibytes */ 97 double M; /* Mebibytes */
98 unsigned long cM; /* hundredths of a Mebibyte */ 98 ulongest_t cM; /* hundredths of a Mebibyte */
99 99
100 M = (double)bytes / (1UL<<20); 100 M = (double)bytes / (1UL<<20);
101 cM = (unsigned long)(M * 100 + 0.5); /* round to nearest */ 101 cM = (ulongest_t)(M * 100.0 + 0.5); /* round to nearest */
102 return cM; 102 return cM;
103} 103}
104 104
@@ -424,8 +424,8 @@ static void CatalogDo(mps_arena_t arena, mps_ap_t ap)
424static void* MakeThing(mps_arena_t arena, mps_ap_t ap, size_t size) 424static void* MakeThing(mps_arena_t arena, mps_ap_t ap, size_t size)
425{ 425{
426 mps_word_t v; 426 mps_word_t v;
427 unsigned long words; 427 ulongest_t words;
428 unsigned long slots; 428 ulongest_t slots;
429 429
430 words = (size + (sizeof(mps_word_t) - 1) ) / sizeof(mps_word_t); 430 words = (size + (sizeof(mps_word_t) - 1) ) / sizeof(mps_word_t);
431 if(words < 2) 431 if(words < 2)
@@ -440,8 +440,8 @@ static void* MakeThing(mps_arena_t arena, mps_ap_t ap, size_t size)
440 440
441static void BigdropSmall(mps_arena_t arena, mps_ap_t ap, size_t big, char small_ref) 441static void BigdropSmall(mps_arena_t arena, mps_ap_t ap, size_t big, char small_ref)
442{ 442{
443 static unsigned long keepCount = 0; 443 static unsigned keepCount = 0;
444 unsigned long i; 444 unsigned i;
445 445
446 mps_arena_park(arena); 446 mps_arena_park(arena);
447 for(i = 0; i < 100; i++) { 447 for(i = 0; i < 100; i++) {
@@ -474,7 +474,7 @@ static unsigned long df(unsigned randm, unsigned number)
474static void Make(mps_arena_t arena, mps_ap_t ap, unsigned randm, unsigned keep1in, unsigned keepTotal, unsigned keepRootspace, unsigned sizemethod) 474static void Make(mps_arena_t arena, mps_ap_t ap, unsigned randm, unsigned keep1in, unsigned keepTotal, unsigned keepRootspace, unsigned sizemethod)
475{ 475{
476 unsigned keepCount = 0; 476 unsigned keepCount = 0;
477 unsigned long objCount = 0; 477 unsigned objCount = 0;
478 478
479 Insist(keepRootspace <= myrootExactCOUNT); 479 Insist(keepRootspace <= myrootExactCOUNT);
480 480
@@ -523,7 +523,7 @@ static void Make(mps_arena_t arena, mps_ap_t ap, unsigned randm, unsigned keep1i
523 } 523 }
524 printf(" ...made and kept: %u objects, storing cyclically in " 524 printf(" ...made and kept: %u objects, storing cyclically in "
525 "first %u roots " 525 "first %u roots "
526 "(actually created %lu objects, in accord with " 526 "(actually created %u objects, in accord with "
527 "keep-1-in %u).\n", 527 "keep-1-in %u).\n",
528 keepCount, keepRootspace, objCount, keep1in); 528 keepCount, keepRootspace, objCount, keep1in);
529} 529}
@@ -531,7 +531,7 @@ static void Make(mps_arena_t arena, mps_ap_t ap, unsigned randm, unsigned keep1i
531 531
532static void Rootdrop(char rank_char) 532static void Rootdrop(char rank_char)
533{ 533{
534 unsigned long i; 534 unsigned i;
535 535
536 if(rank_char == 'A') { 536 if(rank_char == 'A') {
537 for(i = 0; i < myrootAmbigCOUNT; ++i) { 537 for(i = 0; i < myrootAmbigCOUNT; ++i) {
@@ -553,6 +553,10 @@ static void stackwipe(void)
553 unsigned iw; 553 unsigned iw;
554 unsigned long aw[stackwipedepth]; 554 unsigned long aw[stackwipedepth];
555 555
556 /* Do some pointless work that the compiler won't optimise away, so that
557 this function wipes over the stack by filling stuff into the "aw"
558 array. */
559
556 /* http://xkcd.com/710/ */ 560 /* http://xkcd.com/710/ */
557 /* I don't want my friends to stop calling; I just want the */ 561 /* I don't want my friends to stop calling; I just want the */
558 /* compiler to stop optimising away my code. */ 562 /* compiler to stop optimising away my code. */
@@ -808,7 +812,7 @@ static void testscriptA(const char *script)
808 printf(" Create arena, size = %lu.\n", arenasize); 812 printf(" Create arena, size = %lu.\n", arenasize);
809 813
810 /* arena */ 814 /* arena */
811 die(mps_arena_create(&arena, mps_arena_class_vm(), arenasize), 815 die(mps_arena_create(&arena, mps_arena_class_vm(), (size_t)arenasize),
812 "arena_create"); 816 "arena_create");
813 817
814 /* thr: used to stop/restart multiple threads */ 818 /* thr: used to stop/restart multiple threads */