1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-10 00:00:39 -08:00

Ensure that code of the form if (condition) statement; is split over two lines, so that it is possible to set a breakpoint on the statement in a debugger.

This change was agreed in 1997 (see <https://info.ravenbrook.com/project/mps/mail/1997/08/19/13-44/0.txt>), so it's about time it was implemented.

Copied from Perforce
 Change: 187071
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2014-09-27 22:57:02 +01:00
parent 1499ab72af
commit c968255f1e
45 changed files with 542 additions and 280 deletions

View file

@ -161,8 +161,10 @@ Res ABQDescribe(ABQ abq, ABQDescribeElement describeElement, mps_lib_FILE *strea
Res res;
Index index;
if (!TESTT(ABQ, abq)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(ABQ, abq))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
res = WriteF(stream, depth,
"ABQ $P {\n", (WriteFP)abq,

View file

@ -99,12 +99,14 @@ static void test_main(void *marker, int interior, int stack)
mps_root_t reg_root = NULL;
res = mps_arena_create_k(&scheme_arena, mps_arena_class_vm(), mps_args_none);
if (res != MPS_RES_OK) error("Couldn't create arena");
if (res != MPS_RES_OK)
error("Couldn't create arena");
res = mps_chain_create(&obj_chain, scheme_arena,
sizeof(obj_gen_params) / sizeof(*obj_gen_params),
obj_gen_params);
if (res != MPS_RES_OK) error("Couldn't create obj chain");
if (res != MPS_RES_OK)
error("Couldn't create obj chain");
scheme_fmt(&obj_fmt);
@ -117,15 +119,18 @@ static void test_main(void *marker, int interior, int stack)
} MPS_ARGS_END(args);
res = mps_ap_create_k(&obj_ap, obj_pool, mps_args_none);
if (res != MPS_RES_OK) error("Couldn't create obj allocation point");
if (res != MPS_RES_OK)
error("Couldn't create obj allocation point");
res = mps_thread_reg(&thread, scheme_arena);
if (res != MPS_RES_OK) error("Couldn't register thread");
if (res != MPS_RES_OK)
error("Couldn't register thread");
if (stack) {
res = mps_root_create_reg(&reg_root, scheme_arena, mps_rank_ambig(), 0,
thread, mps_stack_scan_ambig, marker, 0);
if (res != MPS_RES_OK) error("Couldn't create root");
if (res != MPS_RES_OK)
error("Couldn't create root");
}
test_air(interior, stack);

View file

@ -47,8 +47,10 @@ static void arenaFreePage(Arena arena, Addr base, Pool pool);
static Res ArenaTrivDescribe(Arena arena, mps_lib_FILE *stream, Count depth)
{
if (!TESTT(Arena, arena)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Arena, arena))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
/* .describe.triv.never-called-from-subclass-method:
* This Triv method seems to assume that it will never get called
@ -454,20 +456,24 @@ Res ArenaDescribe(Arena arena, mps_lib_FILE *stream, Count depth)
Res res;
Size reserved;
if (!TESTT(Arena, arena)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Arena, arena))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
res = WriteF(stream, depth, "Arena $P {\n", (WriteFP)arena,
" class $P (\"$S\")\n",
(WriteFP)arena->class, (WriteFS)arena->class->name,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
if (arena->poolReady) {
res = WriteF(stream, depth + 2,
"controlPool $P\n", (WriteFP)&arena->controlPoolStruct,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
/* Note: this Describe clause calls a function */
@ -477,7 +483,8 @@ Res ArenaDescribe(Arena arena, mps_lib_FILE *stream, Count depth)
"total size of address-space reserved\n",
(WriteFW)reserved,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = WriteF(stream, depth + 2,
"committed $W <-- "
@ -495,23 +502,29 @@ Res ArenaDescribe(Arena arena, mps_lib_FILE *stream, Count depth)
"freeZones $B\n", (WriteFB)arena->freeZones,
"zoned $S\n", WriteFYesNo(arena->zoned),
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = WriteF(stream, depth + 2,
"droppedMessages $U$S\n", (WriteFU)arena->droppedMessages,
(arena->droppedMessages == 0 ? "" : " -- MESSAGES DROPPED!"),
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = (*arena->class->describe)(arena, stream, depth);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = WriteF(stream, depth + 2, "Globals {\n", NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = GlobalsDescribe(ArenaGlobals(arena), stream, depth + 4);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = WriteF(stream, depth + 2, "} Globals\n", NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = WriteF(stream, depth,
"} Arena $P ($U)\n", (WriteFP)arena,
@ -528,14 +541,17 @@ static Res arenaDescribeTractsInChunk(Chunk chunk, mps_lib_FILE *stream, Count d
Res res;
Index pi;
if (!TESTT(Chunk, chunk)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Chunk, chunk))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
res = WriteF(stream, depth, "Chunk [$P, $P) ($U) {\n",
(WriteFP)chunk->base, (WriteFP)chunk->limit,
(WriteFU)chunk->serial,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
for (pi = chunk->allocBase; pi < chunk->pages; ++pi) {
if (BTGet(chunk->allocTable, pi)) {
@ -544,7 +560,8 @@ static Res arenaDescribeTractsInChunk(Chunk chunk, mps_lib_FILE *stream, Count d
(WriteFP)TractBase(tract),
(WriteFP)TractLimit(tract, ChunkArena(chunk)),
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
if (TractHasPool(tract)) {
Pool pool = TractPool(tract);
res = WriteF(stream, 0, " $P $U ($S)",
@ -552,10 +569,12 @@ static Res arenaDescribeTractsInChunk(Chunk chunk, mps_lib_FILE *stream, Count d
(WriteFU)(pool->serial),
(WriteFS)(pool->class->name),
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
res = WriteF(stream, 0, "\n", NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
}
@ -573,13 +592,16 @@ Res ArenaDescribeTracts(Arena arena, mps_lib_FILE *stream, Count depth)
Ring node, next;
Res res;
if (!TESTT(Arena, arena)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Arena, arena))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
RING_FOR(node, &arena->chunkRing, next) {
Chunk chunk = RING_ELT(Chunk, chunkRing, node);
res = arenaDescribeTractsInChunk(chunk, stream, depth);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
return ResOK;
@ -636,8 +658,10 @@ Res ControlDescribe(Arena arena, mps_lib_FILE *stream, Count depth)
{
Res res;
if (!TESTT(Arena, arena)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Arena, arena))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
res = PoolDescribe(ArenaControlPool(arena), stream, depth);

View file

@ -194,10 +194,13 @@ static Res VMArenaDescribe(Arena arena, mps_lib_FILE *stream, Count depth)
Res res;
VMArena vmArena;
if (!TESTT(Arena, arena)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Arena, arena))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
vmArena = Arena2VMArena(arena);
if (!TESTT(VMArena, vmArena)) return ResFAIL;
if (!TESTT(VMArena, vmArena))
return ResFAIL;
/* Describe the superclass fields first via next-method call */
/* ...but the next method is ArenaTrivDescribe, so don't call it;
@ -205,7 +208,8 @@ static Res VMArenaDescribe(Arena arena, mps_lib_FILE *stream, Count depth)
*
super = ARENA_SUPERCLASS(VMArenaClass);
res = super->describe(arena, stream);
if (res != ResOK) return res;
if (res != ResOK)
return res;
*
*/

View file

@ -1028,7 +1028,8 @@ Count BTCountResRange(BT bt, Index base, Index limit)
AVER(base < limit);
for (bit = base; bit < limit; ++bit)
if (!BTGet(bt, bit)) ++c;
if (!BTGet(bt, bit))
++c;
return c;
}

View file

@ -150,8 +150,10 @@ Res BufferDescribe(Buffer buffer, mps_lib_FILE *stream, Count depth)
{
Res res;
if (!TESTT(Buffer, buffer)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Buffer, buffer))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
res = WriteF(stream, depth,
"Buffer $P ($U) {\n",
@ -178,10 +180,12 @@ Res BufferDescribe(Buffer buffer, mps_lib_FILE *stream, Count depth)
" alignment $W\n", (WriteFW)buffer->alignment,
" rampCount $U\n", (WriteFU)buffer->rampCount,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = buffer->class->describe(buffer, stream, depth + 2);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = WriteF(stream, depth, "} Buffer $P ($U)\n",
(WriteFP)buffer, (WriteFU)buffer->serial,
@ -1165,8 +1169,10 @@ static void bufferNoReassignSeg(Buffer buffer, Seg seg)
static Res bufferTrivDescribe(Buffer buffer, mps_lib_FILE *stream, Count depth)
{
if (!TESTT(Buffer, buffer)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Buffer, buffer))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
UNUSED(depth);
/* dispatching function does it all */
return ResOK;
@ -1428,15 +1434,19 @@ static Res segBufDescribe(Buffer buffer, mps_lib_FILE *stream, Count depth)
BufferClass super;
Res res;
if (!TESTT(Buffer, buffer)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Buffer, buffer))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
segbuf = BufferSegBuf(buffer);
if (!TESTT(SegBuf, segbuf)) return ResFAIL;
if (!TESTT(SegBuf, segbuf))
return ResFAIL;
/* Describe the superclass fields first via next-method call */
super = BUFFER_SUPERCLASS(SegBufClass);
res = super->describe(buffer, stream, depth);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = WriteF(stream, depth,
"Seg $P\n", (WriteFP)segbuf->seg,

View file

@ -1147,7 +1147,8 @@ static Res cbsDescribe(Land land, mps_lib_FILE *stream, Count depth)
" ownPool: $U\n", (WriteFU)cbs->ownPool,
" treeSize: $U\n", (WriteFU)cbs->treeSize,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
METER_WRITE(cbs->treeSearch, stream, depth + 2);
@ -1159,7 +1160,8 @@ static Res cbsDescribe(Land land, mps_lib_FILE *stream, Count depth)
describe = cbsSplayNodeDescribe;
res = SplayTreeDescribe(cbsSplay(cbs), stream, depth + 2, describe);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = WriteF(stream, depth, "} CBS $P\n", (WriteFP)cbs, NULL);

View file

@ -67,7 +67,8 @@ static size_t arena_grain_size = 1; /* arena grain size */
if (blocks[k].p == NULL) { \
size_t s = rnd() % ((sizeof(void *) << (rnd() % sshift)) - 1); \
void *p = NULL; \
if (s > 0) alloc(p, s); \
if (s > 0) \
alloc(p, s); \
blocks[k].p = p; \
blocks[k].s = s; \
} else { \

View file

@ -334,11 +334,14 @@ Res EventDescribe(Event event, mps_lib_FILE *stream, Count depth)
"Event $P {\n", (WriteFP)event,
" code $U\n", (WriteFU)event->any.code,
" clock ", NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = EVENT_CLOCK_WRITE(stream, depth, event->any.clock);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = WriteF(stream, depth, "\n size $U\n", (WriteFU)event->any.size, NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
switch (event->any.code) {
@ -352,14 +355,16 @@ Res EventDescribe(Event event, mps_lib_FILE *stream, Count depth)
" event \"$S\"", (WriteFS)#name, \
EVENT_##name##_PARAMS(EVENT_DESC_PARAM, name) \
NULL); \
if (res != ResOK) return res; \
if (res != ResOK)
return res; \
break;
EVENT_LIST(EVENT_DESC, X)
default:
res = WriteF(stream, depth, " event type unknown", NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
/* TODO: Hexdump unknown event contents. */
break;
}
@ -375,8 +380,10 @@ Res EventWrite(Event event, mps_lib_FILE *stream)
{
Res res;
if (event == NULL) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (event == NULL)
return ResFAIL;
if (stream == NULL)
return ResFAIL;
res = EVENT_CLOCK_WRITE(stream, 0, event->any.clock);
if (res != ResOK)
@ -392,14 +399,16 @@ Res EventWrite(Event event, mps_lib_FILE *stream)
res = WriteF(stream, 0, " $S", (WriteFS)#name, \
EVENT_##name##_PARAMS(EVENT_WRITE_PARAM, name) \
NULL); \
if (res != ResOK) return res; \
if (res != ResOK) \
return res; \
break;
EVENT_LIST(EVENT_WRITE, X)
default:
res = WriteF(stream, 0, " <unknown code $U>",
(WriteFU)event->any.code, NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
/* TODO: Hexdump unknown event contents. */
break;
}

View file

@ -172,7 +172,8 @@ static void printParamS(const char *str)
putchar('"');
for (i = 0; str[i] != '\0'; ++i) {
char c = str[i];
if (c == '"' || c == '\\') putchar('\\');
if (c == '"' || c == '\\')
putchar('\\');
putchar(c);
}
putchar('"');

View file

@ -620,11 +620,14 @@ Res EventRepInit(void)
totalEvents = 0; discardedEvents = 0; unknownEvents = 0;
res = TableCreate(&arenaTable, (size_t)1);
if (res != ResOK) goto failArena;
if (res != ResOK)
goto failArena;
res = TableCreate(&poolTable, (size_t)1<<4);
if (res != ResOK) goto failPool;
if (res != ResOK)
goto failPool;
res = TableCreate(&apTable, (size_t)1<<6);
if (res != ResOK) goto failAp;
if (res != ResOK)
goto failAp;
return ResOK;

View file

@ -138,7 +138,8 @@ static void printStr(const char *str)
putchar('"');
for (i = 0; str[i] != '\0'; ++i) {
char c = str[i];
if (c == '"' || c == '\\') putchar('\\');
if (c == '"' || c == '\\')
putchar('\\');
putchar(c);
}
putchar('"');

View file

@ -281,10 +281,13 @@ static Res failoverDescribe(Land land, mps_lib_FILE *stream, Count depth)
Failover fo;
Res res;
if (!TESTT(Land, land)) return ResFAIL;
if (!TESTT(Land, land))
return ResFAIL;
fo = failoverOfLand(land);
if (!TESTT(Failover, fo)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Failover, fo))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
res = WriteF(stream, depth,
"Failover $P {\n", (WriteFP)fo,

View file

@ -210,7 +210,8 @@ Res FormatDescribe(Format format, mps_lib_FILE *stream, Count depth)
" headerSize $W\n", (WriteFW)format->headerSize,
"} Format $P ($U)\n", (WriteFP)format, (WriteFU)format->serial,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
return ResOK;
}

View file

@ -747,9 +747,12 @@ static Bool freelistDescribeVisitor(Land land, Range range,
mps_lib_FILE *stream = closureP;
Count depth = closureS;
if (!TESTT(Land, land)) return FALSE;
if (!RangeCheck(range)) return FALSE;
if (stream == NULL) return FALSE;
if (!TESTT(Land, land))
return FALSE;
if (!RangeCheck(range))
return FALSE;
if (stream == NULL)
return FALSE;
res = WriteF(stream, depth,
"[$P,", (WriteFP)RangeBase(range),
@ -767,10 +770,13 @@ static Res freelistDescribe(Land land, mps_lib_FILE *stream, Count depth)
Res res;
Bool b;
if (!TESTT(Land, land)) return ResFAIL;
if (!TESTT(Land, land))
return ResFAIL;
fl = freelistOfLand(land);
if (!TESTT(Freelist, fl)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Freelist, fl))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
res = WriteF(stream, depth,
"Freelist $P {\n", (WriteFP)fl,
@ -778,7 +784,8 @@ static Res freelistDescribe(Land land, mps_lib_FILE *stream, Count depth)
NULL);
b = LandIterate(land, freelistDescribeVisitor, stream, depth + 2);
if (!b) return ResFAIL;
if (!b)
return ResFAIL;
res = WriteF(stream, depth, "} Freelist $P\n", (WriteFP)fl, NULL);
return res;

View file

@ -83,7 +83,8 @@ static void aset(obj_t v, size_t i, obj_t val) {
static obj_t mktree(mps_ap_t ap, unsigned d, obj_t leaf) {
obj_t tree;
size_t i;
if (d <= 0) return leaf;
if (d <= 0)
return leaf;
tree = mkvector(ap, width);
for (i = 0; i < width; ++i) {
aset(tree, i, mktree(ap, d - 1, leaf));

View file

@ -1017,8 +1017,10 @@ Res GlobalsDescribe(Globals arenaGlobals, mps_lib_FILE *stream, Count depth)
TraceId ti;
Trace trace;
if (!TESTT(Globals, arenaGlobals)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Globals, arenaGlobals))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
arena = GlobalsArena(arenaGlobals);
res = WriteF(stream, depth,
@ -1050,13 +1052,15 @@ Res GlobalsDescribe(Globals arenaGlobals, mps_lib_FILE *stream, Count depth)
"history {\n",
" [note: indices are raw, not rotated]\n",
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
for(i=0; i < LDHistoryLENGTH; ++ i) {
res = WriteF(stream, depth + 2,
"[$U] = $B\n", (WriteFU)i, (WriteFB)arena->history[i],
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
res = WriteF(stream, depth,
@ -1066,39 +1070,46 @@ Res GlobalsDescribe(Globals arenaGlobals, mps_lib_FILE *stream, Count depth)
"shCacheI $U\n", (WriteFU)arena->shCacheI,
/* @@@@ should SegDescribe the cached segs? */
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = RootsDescribe(arenaGlobals, stream, depth);
if (res != ResOK) return res;
if (res != ResOK)
return res;
RING_FOR(node, &arenaGlobals->poolRing, nextNode) {
Pool pool = RING_ELT(Pool, arenaRing, node);
res = PoolDescribe(pool, stream, depth);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
RING_FOR(node, &arena->formatRing, nextNode) {
Format format = RING_ELT(Format, arenaRing, node);
res = FormatDescribe(format, stream, depth);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
RING_FOR(node, &arena->threadRing, nextNode) {
Thread thread = ThreadRingThread(node);
res = ThreadDescribe(thread, stream, depth);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
RING_FOR(node, &arena->chainRing, nextNode) {
Chain chain = RING_ELT(Chain, chainRing, node);
res = ChainDescribe(chain, stream, depth);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
TRACE_SET_ITER(ti, trace, TraceSetUNIV, arena)
if (TraceSetIsMember(arena->busyTraces, trace)) {
res = TraceDescribe(trace, stream, depth);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
TRACE_SET_ITER_END(ti, trace, TraceSetUNIV, arena);

View file

@ -376,8 +376,10 @@ Res LandDescribe(Land land, mps_lib_FILE *stream, Count depth)
{
Res res;
if (!TESTT(Land, land)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Land, land))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
res = WriteF(stream, depth,
"Land $P {\n", (WriteFP)land,

View file

@ -84,8 +84,10 @@ Res LocusPrefDescribe(LocusPref pref, mps_lib_FILE *stream, Count depth)
{
Res res;
if (!TESTT(LocusPref, pref)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(LocusPref, pref))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
res = WriteF(stream, depth,
"LocusPref $P {\n", (WriteFP)pref,
@ -152,8 +154,10 @@ Res GenDescDescribe(GenDesc gen, mps_lib_FILE *stream, Count depth)
Res res;
Ring node, nextNode;
if (!TESTT(GenDesc, gen)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(GenDesc, gen))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
res = WriteF(stream, depth,
"GenDesc $P {\n", (WriteFP)gen,
@ -161,12 +165,14 @@ Res GenDescDescribe(GenDesc gen, mps_lib_FILE *stream, Count depth)
" capacity $W\n", (WriteFW)gen->capacity,
" mortality $D\n", (WriteFD)gen->mortality,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
RING_FOR(node, &gen->locusRing, nextNode) {
PoolGen pgen = RING_ELT(PoolGen, genRing, node);
res = PoolGenDescribe(pgen, stream, depth + 2);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
res = WriteF(stream, depth, "} GenDesc $P\n", (WriteFP)gen, NULL);
@ -467,19 +473,23 @@ Res ChainDescribe(Chain chain, mps_lib_FILE *stream, Count depth)
Res res;
size_t i;
if (!TESTT(Chain, chain)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Chain, chain))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
res = WriteF(stream, depth,
"Chain $P {\n", (WriteFP)chain,
" arena $P\n", (WriteFP)chain->arena,
" activeTraces $B\n", (WriteFB)chain->activeTraces,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
for (i = 0; i < chain->genCount; ++i) {
res = GenDescDescribe(&chain->gens[i], stream, depth + 2);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
res = WriteF(stream, depth,
@ -748,8 +758,10 @@ Res PoolGenDescribe(PoolGen pgen, mps_lib_FILE *stream, Count depth)
{
Res res;
if (!TESTT(PoolGen, pgen)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(PoolGen, pgen))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
res = WriteF(stream, depth,
"PoolGen $P {\n", (WriteFP)pgen,

View file

@ -485,7 +485,8 @@ Res WriteF_firstformat_v(mps_lib_FILE *stream, Count depth,
}
if (*format != '$') {
r = mps_lib_fputc(*format, stream); /* Could be more efficient */
if (r == mps_lib_EOF) return ResIO;
if (r == mps_lib_EOF)
return ResIO;
if (*format == '\n') {
start_of_line = TRUE;
}
@ -498,14 +499,16 @@ Res WriteF_firstformat_v(mps_lib_FILE *stream, Count depth,
WriteFA addr = va_arg(args, WriteFA);
res = WriteULongest(stream, (ULongest)addr, 16,
(sizeof(WriteFA) * CHAR_BIT + 3) / 4);
if (res != ResOK) return res;
if (res != ResOK)
return res;
} break;
case 'P': { /* pointer, see .writef.p */
WriteFP p = va_arg(args, WriteFP);
res = WriteULongest(stream, (ULongest)p, 16,
(sizeof(WriteFP) * CHAR_BIT + 3)/ 4);
if (res != ResOK) return res;
if (res != ResOK)
return res;
} break;
case 'F': { /* function */
@ -517,56 +520,65 @@ Res WriteF_firstformat_v(mps_lib_FILE *stream, Count depth,
for(i=0; i < sizeof(WriteFF); i++) {
res = WriteULongest(stream, (ULongest)(b[i]), 16,
(CHAR_BIT + 3) / 4);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
} break;
case 'S': { /* string */
WriteFS s = va_arg(args, WriteFS);
r = mps_lib_fputs((const char *)s, stream);
if (r == mps_lib_EOF) return ResIO;
if (r == mps_lib_EOF)
return ResIO;
} break;
case 'C': { /* character */
WriteFC c = va_arg(args, WriteFC); /* promoted */
r = mps_lib_fputc((int)c, stream);
if (r == mps_lib_EOF) return ResIO;
if (r == mps_lib_EOF)
return ResIO;
} break;
case 'W': { /* word */
WriteFW w = va_arg(args, WriteFW);
res = WriteULongest(stream, (ULongest)w, 16,
(sizeof(WriteFW) * CHAR_BIT + 3) / 4);
if (res != ResOK) return res;
if (res != ResOK)
return res;
} break;
case 'U': { /* decimal, see .writef.p */
WriteFU u = va_arg(args, WriteFU);
res = WriteULongest(stream, (ULongest)u, 10, 0);
if (res != ResOK) return res;
if (res != ResOK)
return res;
} break;
case '3': { /* decimal for thousandths */
WriteFU u = va_arg(args, WriteFU);
res = WriteULongest(stream, (ULongest)u, 10, 3);
if (res != ResOK) return res;
if (res != ResOK)
return res;
} break;
case 'B': { /* binary, see .writef.p */
WriteFB b = va_arg(args, WriteFB);
res = WriteULongest(stream, (ULongest)b, 2, sizeof(WriteFB) * CHAR_BIT);
if (res != ResOK) return res;
if (res != ResOK)
return res;
} break;
case '$': { /* dollar char */
r = mps_lib_fputc('$', stream);
if (r == mps_lib_EOF) return ResIO;
if (r == mps_lib_EOF)
return ResIO;
} break;
case 'D': { /* double */
WriteFD d = va_arg(args, WriteFD);
res = WriteDouble(stream, d);
if (res != ResOK) return res;
if (res != ResOK)
return res;
} break;
default:

View file

@ -95,7 +95,8 @@ static mps_res_t stress(mps_arena_t arena, mps_pool_debug_option_s *options,
for (i=testSetSIZE/2; i<testSetSIZE; ++i) {
ss[i] = (*size)(i);
res = mps_alloc((mps_addr_t *)&ps[i], pool, ss[i]);
if (res != MPS_RES_OK) return res;
if (res != MPS_RES_OK)
return res;
allocated += alignUp(ss[i], align) + debugOverhead;
}
check_allocated_size(pool, allocated);

View file

@ -193,7 +193,7 @@ mps_res_t mps_arena_commit_limit_set(mps_arena_t arena, size_t limit)
res = ArenaSetCommitLimit(arena, limit);
ArenaLeave(arena);
return res;
return (mps_res_t)res;
}
void mps_arena_spare_commit_limit_set(mps_arena_t arena, size_t limit)
@ -269,7 +269,7 @@ mps_res_t mps_arena_start_collect(mps_arena_t arena)
ArenaEnter(arena);
res = ArenaStartCollect(ArenaGlobals(arena), TraceStartWhyCLIENTFULL_INCREMENTAL);
ArenaLeave(arena);
return res;
return (mps_res_t)res;
}
mps_res_t mps_arena_collect(mps_arena_t arena)
@ -278,7 +278,7 @@ mps_res_t mps_arena_collect(mps_arena_t arena)
ArenaEnter(arena);
res = ArenaCollect(ArenaGlobals(arena), TraceStartWhyCLIENTFULL_BLOCK);
ArenaLeave(arena);
return res;
return (mps_res_t)res;
}
mps_bool_t mps_arena_step(mps_arena_t arena,
@ -303,7 +303,7 @@ mps_res_t mps_arena_create(mps_arena_t *mps_arena_o,
va_start(varargs, mps_arena_class);
res = mps_arena_create_v(mps_arena_o, mps_arena_class, varargs);
va_end(varargs);
return res;
return (mps_res_t)res;
}
@ -337,7 +337,7 @@ mps_res_t mps_arena_create_k(mps_arena_t *mps_arena_o,
res = ArenaCreate(&arena, arena_class, mps_args);
if (res != ResOK)
return res;
return (mps_res_t)res;
ArenaLeave(arena);
*mps_arena_o = (mps_arena_t)arena;
@ -461,7 +461,8 @@ mps_res_t mps_fmt_create_k(mps_fmt_t *mps_fmt_o,
ArenaLeave(arena);
if (res != ResOK) return res;
if (res != ResOK)
return (mps_res_t)res;
*mps_fmt_o = (mps_fmt_t)format;
return MPS_RES_OK;
}
@ -499,7 +500,8 @@ mps_res_t mps_fmt_create_A(mps_fmt_t *mps_fmt_o,
ArenaLeave(arena);
if (res != ResOK) return res;
if (res != ResOK)
return (mps_res_t)res;
*mps_fmt_o = (mps_fmt_t)format;
return MPS_RES_OK;
}
@ -533,7 +535,8 @@ mps_res_t mps_fmt_create_B(mps_fmt_t *mps_fmt_o,
ArenaLeave(arena);
if (res != ResOK) return res;
if (res != ResOK)
return (mps_res_t)res;
*mps_fmt_o = (mps_fmt_t)format;
return MPS_RES_OK;
}
@ -567,7 +570,8 @@ mps_res_t mps_fmt_create_auto_header(mps_fmt_t *mps_fmt_o,
ArenaLeave(arena);
if (res != ResOK) return res;
if (res != ResOK)
return (mps_res_t)res;
*mps_fmt_o = (mps_fmt_t)format;
return MPS_RES_OK;
}
@ -599,7 +603,8 @@ mps_res_t mps_fmt_create_fixed(mps_fmt_t *mps_fmt_o,
ArenaLeave(arena);
if (res != ResOK) return res;
if (res != ResOK)
return (mps_res_t)res;
*mps_fmt_o = (mps_fmt_t)format;
return MPS_RES_OK;
}
@ -659,9 +664,10 @@ mps_res_t mps_pool_create_k(mps_pool_t *mps_pool_o, mps_arena_t arena,
ArenaLeave(arena);
if (res != ResOK) return res;
if (res != ResOK)
return (mps_res_t)res;
*mps_pool_o = (mps_pool_t)pool;
return res;
return MPS_RES_OK;
}
void mps_pool_destroy(mps_pool_t pool)
@ -739,7 +745,8 @@ mps_res_t mps_alloc(mps_addr_t *p_o, mps_pool_t pool, size_t size)
ArenaLeave(arena);
if (res != ResOK) return res;
if (res != ResOK)
return (mps_res_t)res;
*p_o = (mps_addr_t)p;
return MPS_RES_OK;
}
@ -836,7 +843,7 @@ mps_res_t mps_ap_create_k(mps_ap_t *mps_ap_o,
ArenaLeave(arena);
if (res != ResOK)
return res;
return (mps_res_t)res;
*mps_ap_o = BufferAP(buf);
return MPS_RES_OK;
@ -1041,7 +1048,8 @@ mps_res_t mps_ap_fill(mps_addr_t *p_o, mps_ap_t mps_ap, size_t size)
ArenaLeave(arena);
if (res != ResOK) return res;
if (res != ResOK)
return (mps_res_t)res;
*p_o = (mps_addr_t)p;
return MPS_RES_OK;
}
@ -1072,7 +1080,8 @@ mps_res_t mps_ap_fill_with_reservoir_permit(mps_addr_t *p_o, mps_ap_t mps_ap,
ArenaLeave(arena);
if (res != ResOK) return res;
if (res != ResOK)
return (mps_res_t)res;
*p_o = (mps_addr_t)p;
return MPS_RES_OK;
}
@ -1127,7 +1136,8 @@ mps_res_t mps_sac_create(mps_sac_t *mps_sac_o, mps_pool_t pool,
ArenaLeave(arena);
if (res != ResOK) return (mps_res_t)res;
if (res != ResOK)
return (mps_res_t)res;
*mps_sac_o = ExternalSACOfSAC(sac);
return (mps_res_t)res;
}
@ -1189,7 +1199,8 @@ mps_res_t mps_sac_fill(mps_addr_t *p_o, mps_sac_t mps_sac, size_t size,
ArenaLeave(arena);
if (res != ResOK) return (mps_res_t)res;
if (res != ResOK)
return (mps_res_t)res;
*p_o = (mps_addr_t)p;
return (mps_res_t)res;
}
@ -1225,7 +1236,7 @@ mps_res_t mps_sac_alloc(mps_addr_t *p_o, mps_sac_t mps_sac, size_t size,
AVER(size > 0);
MPS_SAC_ALLOC_FAST(res, *p_o, mps_sac, size, (has_reservoir_permit != 0));
return res;
return (mps_res_t)res;
}
@ -1262,7 +1273,8 @@ mps_res_t mps_root_create(mps_root_t *mps_root_o, mps_arena_t arena,
ArenaLeave(arena);
if (res != ResOK) return res;
if (res != ResOK)
return (mps_res_t)res;
*mps_root_o = (mps_root_t)root;
return MPS_RES_OK;
}
@ -1291,7 +1303,8 @@ mps_res_t mps_root_create_table(mps_root_t *mps_root_o, mps_arena_t arena,
ArenaLeave(arena);
if (res != ResOK) return res;
if (res != ResOK)
return (mps_res_t)res;
*mps_root_o = (mps_root_t)root;
return MPS_RES_OK;
}
@ -1322,7 +1335,8 @@ mps_res_t mps_root_create_table_masked(mps_root_t *mps_root_o,
ArenaLeave(arena);
if (res != ResOK) return res;
if (res != ResOK)
return (mps_res_t)res;
*mps_root_o = (mps_root_t)root;
return MPS_RES_OK;
}
@ -1344,7 +1358,8 @@ mps_res_t mps_root_create_fmt(mps_root_t *mps_root_o, mps_arena_t arena,
res = RootCreateFmt(&root, arena, rank, mode, scan, (Addr)base, (Addr)limit);
ArenaLeave(arena);
if (res != ResOK) return res;
if (res != ResOK)
return (mps_res_t)res;
*mps_root_o = (mps_root_t)root;
return MPS_RES_OK;
}
@ -1373,7 +1388,8 @@ mps_res_t mps_root_create_reg(mps_root_t *mps_root_o, mps_arena_t arena,
ArenaLeave(arena);
if (res != ResOK) return res;
if (res != ResOK)
return (mps_res_t)res;
*mps_root_o = (mps_root_t)root;
return MPS_RES_OK;
}
@ -1433,7 +1449,8 @@ mps_res_t mps_thread_reg(mps_thr_t *mps_thr_o, mps_arena_t arena)
ArenaLeave(arena);
if (res != ResOK) return res;
if (res != ResOK)
return (mps_res_t)res;
*mps_thr_o = (mps_thr_t)thread;
return MPS_RES_OK;
}
@ -1534,7 +1551,7 @@ mps_res_t mps_finalize(mps_arena_t arena, mps_addr_t *refref)
res = ArenaFinalize(arena, object);
ArenaLeave(arena);
return res;
return (mps_res_t)res;
}
@ -1551,7 +1568,7 @@ mps_res_t mps_definalize(mps_arena_t arena, mps_addr_t *refref)
res = ArenaDefinalize(arena, object);
ArenaLeave(arena);
return res;
return (mps_res_t)res;
}
@ -1857,7 +1874,7 @@ mps_res_t mps_ap_alloc_pattern_end(mps_ap_t mps_ap,
ArenaPoll(ArenaGlobals(arena)); /* .poll */
ArenaLeave(arena);
return res;
return (mps_res_t)res;
}
@ -1942,7 +1959,7 @@ mps_res_t mps_chain_create(mps_chain_t *chain_o, mps_arena_t arena,
ArenaLeave(arena);
if (res != ResOK)
return res;
return (mps_res_t)res;
*chain_o = (mps_chain_t)chain;
return MPS_RES_OK;
}

View file

@ -130,11 +130,13 @@ static mps_addr_t make(void)
do {
MPS_RESERVE_BLOCK(res, pMps, ap, sizeMps);
if (res != MPS_RES_OK) die(res, "MPS_RESERVE_BLOCK");
if (res != MPS_RES_OK)
die(res, "MPS_RESERVE_BLOCK");
HeaderInit(pMps);
pCli = PtrMps2Cli(pMps);
res = dylan_init(pCli, sizeCli, exactRoots, exactRootsCOUNT);
if (res != MPS_RES_OK) die(res, "dylan_init");
if (res != MPS_RES_OK)
die(res, "dylan_init");
} while(!mps_commit(ap, pMps, sizeMps));
return pCli;
@ -153,11 +155,13 @@ static mps_addr_t make_with_permit(void)
do {
MPS_RESERVE_WITH_RESERVOIR_PERMIT_BLOCK(res, pMps, ap, sizeMps);
if (res != MPS_RES_OK) die(res, "MPS_RESERVE_WITH_RESERVOIR_PERMIT_BLOCK");
if (res != MPS_RES_OK)
die(res, "MPS_RESERVE_WITH_RESERVOIR_PERMIT_BLOCK");
HeaderInit(pMps);
pCli = PtrMps2Cli(pMps);
res = dylan_init(pCli, sizeCli, exactRoots, exactRootsCOUNT);
if (res != MPS_RES_OK) die(res, "dylan_init");
if (res != MPS_RES_OK)
die(res, "dylan_init");
} while(!mps_commit(ap, pMps, sizeMps));
return pCli;
@ -176,11 +180,13 @@ static mps_addr_t make_no_inline(void)
do {
res = (mps_reserve)(&pMps, ap, sizeMps);
if (res != MPS_RES_OK) die(res, "(mps_reserve)");
if (res != MPS_RES_OK)
die(res, "(mps_reserve)");
HeaderInit(pMps);
pCli = PtrMps2Cli(pMps);
res = dylan_init(pCli, sizeCli, exactRoots, exactRootsCOUNT);
if (res != MPS_RES_OK) die(res, "dylan_init");
if (res != MPS_RES_OK)
die(res, "dylan_init");
} while(!(mps_commit)(ap, pMps, sizeMps));
return pCli;

View file

@ -95,7 +95,8 @@ static mps_res_t stress(mps_arena_t arena, mps_align_t align,
size_t ss[TEST_SET_SIZE];
res = mps_pool_create_k(&pool, arena, pool_class, args);
if(res != MPS_RES_OK) return res;
if (res != MPS_RES_OK)
return res;
die(mps_ap_create(&ap, pool, mps_rank_exact()), "BufferCreate");
@ -110,7 +111,8 @@ static mps_res_t stress(mps_arena_t arena, mps_align_t align,
*ps[i] = 1; /* Write something, so it gets swap. */
if (verbose) {
if(i && i%4==0) putchar('\n');
if (i && i%4==0)
putchar('\n');
printf("%"PRIwWORD PRIXLONGEST" %6"PRIXLONGEST" ",
(ulongest_t)ps[i], (ulongest_t)ss[i]);
}
@ -151,7 +153,8 @@ static mps_res_t stress(mps_arena_t arena, mps_align_t align,
ss[i] = s;
if (verbose) {
if(i && i%4==0) putchar('\n');
if (i && i%4==0)
putchar('\n');
printf("%"PRIwWORD PRIXLONGEST" %6"PRIXLONGEST" ",
(ulongest_t)ps[i], (ulongest_t)ss[i]);
}

View file

@ -549,8 +549,10 @@ Res PoolDescribe(Pool pool, mps_lib_FILE *stream, Count depth)
Res res;
Ring node, nextNode;
if (!TESTT(Pool, pool)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Pool, pool))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
res = WriteF(stream, depth,
"Pool $P ($U) {\n", (WriteFP)pool, (WriteFU)pool->serial,
@ -560,10 +562,12 @@ Res PoolDescribe(Pool pool, mps_lib_FILE *stream, Count depth)
(WriteFP)pool->arena, (WriteFU)pool->arena->serial,
" alignment $W\n", (WriteFW)pool->alignment,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
if (NULL != pool->format) {
res = FormatDescribe(pool->format, stream, depth + 2);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
res = WriteF(stream, depth + 2,
"fillMutatorSize $UKb\n",
@ -575,21 +579,25 @@ Res PoolDescribe(Pool pool, mps_lib_FILE *stream, Count depth)
"emptyInternalSize $UKb\n",
(WriteFU)(pool->emptyInternalSize / 1024),
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = (*pool->class->describe)(pool, stream, depth + 2);
if (res != ResOK) return res;
if (res != ResOK)
return res;
RING_FOR(node, &pool->bufferRing, nextNode) {
Buffer buffer = RING_ELT(Buffer, poolRing, node);
res = BufferDescribe(buffer, stream, depth + 2);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
res = WriteF(stream, depth,
"} Pool $P ($U)\n", (WriteFP)pool, (WriteFU)pool->serial,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
return ResOK;
}

View file

@ -263,7 +263,8 @@ Res PoolTrivBufferFill(Addr *baseReturn, Addr *limitReturn,
AVERT(Bool, withReservoirPermit);
res = PoolAlloc(&p, pool, size, withReservoirPermit);
if(res != ResOK) return res;
if (res != ResOK)
return res;
*baseReturn = p;
*limitReturn = AddrAdd(p, size);

View file

@ -103,7 +103,8 @@ void AMSSegFreeWalk(AMSSeg amsseg, FreeBlockStepMethod f, void *p)
while (next < amsseg->grains) {
Bool found = BTFindLongResRange(&base, &limit, amsseg->allocTable,
next, amsseg->grains, 1);
if (!found) break;
if (!found)
break;
(*f)(AMS_INDEX_ADDR(seg, base), AMS_INDEX_ADDR(seg, limit), pool, p);
next = limit + 1;
}
@ -539,15 +540,19 @@ static Res AMSSegDescribe(Seg seg, mps_lib_FILE *stream, Count depth)
Buffer buffer; /* the segment's buffer, if it has one */
Index i;
if (!TESTT(Seg, seg)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Seg, seg))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
amsseg = Seg2AMSSeg(seg);
if (!TESTT(AMSSeg, amsseg)) return ResFAIL;
if (!TESTT(AMSSeg, amsseg))
return ResFAIL;
/* Describe the superclass fields first via next-method call */
super = SEG_SUPERCLASS(AMSSegClass);
res = super->describe(seg, stream, depth);
if (res != ResOK) return res;
if (res != ResOK)
return res;
buffer = SegBuffer(seg);
@ -558,7 +563,8 @@ static Res AMSSegDescribe(Seg seg, mps_lib_FILE *stream, Count depth)
" oldGrains $W\n", (WriteFW)amsseg->oldGrains,
" newGrains $W\n", (WriteFW)amsseg->newGrains,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
if (amsseg->allocTableInUse)
res = WriteF(stream, depth,
"alloctable $P\n", (WriteFP)amsseg->allocTable,
@ -567,23 +573,27 @@ static Res AMSSegDescribe(Seg seg, mps_lib_FILE *stream, Count depth)
res = WriteF(stream, depth,
"firstFree $W\n", (WriteFW)amsseg->firstFree,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = WriteF(stream, depth,
"tables: nongrey $P, nonwhite $P\n",
(WriteFP)amsseg->nongreyTable,
(WriteFP)amsseg->nonwhiteTable,
"map:",
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
for (i=0; i < amsseg->grains; ++i) {
char c = 0;
if (i % 64 == 0) {
res = WriteF(stream, 0, "\n", NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = WriteF(stream, depth, " ", NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
WRITE_BUFFER_LIMIT(stream, seg, i, buffer, BufferBase, "[");
@ -1697,10 +1707,13 @@ static Res AMSDescribe(Pool pool, mps_lib_FILE *stream, Count depth)
Ring node, nextNode;
Res res;
if (!TESTT(Pool, pool)) return ResFAIL;
if (!TESTT(Pool, pool))
return ResFAIL;
ams = PoolAMS(pool);
if (!TESTT(AMS, ams)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(AMS, ams))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
res = WriteF(stream, depth,
"AMS $P {\n", (WriteFP)ams,
@ -1708,18 +1721,21 @@ static Res AMSDescribe(Pool pool, mps_lib_FILE *stream, Count depth)
(WriteFP)pool, (WriteFU)pool->serial,
" grain shift $U\n", (WriteFU)ams->grainShift,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = WriteF(stream, depth + 2,
"segments: * black + grey - white . alloc ! bad\n"
"buffers: [ base < scan limit | init > alloc ] limit\n",
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
RING_FOR(node, &ams->segRing, nextNode) {
AMSSeg amsseg = RING_ELT(AMSSeg, segRing, node);
res = SegDescribe(AMSSeg2Seg(amsseg), stream, depth + 2);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
res = WriteF(stream, depth, "} AMS $P\n",(WriteFP)ams, NULL);

View file

@ -351,7 +351,8 @@ static Res MFSDescribe(Pool pool, mps_lib_FILE *stream, Count depth)
"free $W\n", (WriteFW)mfs->free,
"tractList $P\n", (WriteFP)mfs->tractList,
NULL);
if(res != ResOK) return res;
if (res != ResOK)
return res;
return ResOK;
}

View file

@ -804,16 +804,21 @@ static Res MRGDescribe(Pool pool, mps_lib_FILE *stream, Count depth)
RefPart refPart;
Res res;
if (!TESTT(Pool, pool)) return ResFAIL;
if (!TESTT(Pool, pool))
return ResFAIL;
mrg = PoolMRG(pool);
if (!TESTT(MRG, mrg)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(MRG, mrg))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
arena = PoolArena(pool);
res = WriteF(stream, depth, "extendBy $W\n", (WriteFW)mrg->extendBy, NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = WriteF(stream, depth, "Entry queue:\n", NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
RING_FOR(node, &mrg->entryRing, nextNode) {
Bool outsideShield = !arena->insideShield;
refPart = MRGRefPartOfLink(linkOfRing(node), arena);
@ -826,7 +831,8 @@ static Res MRGDescribe(Pool pool, mps_lib_FILE *stream, Count depth)
if (outsideShield) {
ShieldLeave(arena);
}
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
return ResOK;

View file

@ -455,7 +455,8 @@ static Res MVSpanFree(MVSpan span, Addr base, Addr limit, Pool blockPool)
/* block must be split into two parts. */
res = PoolAlloc(&addr, blockPool, sizeof(MVBlockStruct),
/* withReservoirPermit */ FALSE);
if(res != ResOK) return res;
if (res != ResOK)
return res;
new = (MVBlock)addr;
freeAreaSize = AddrOffset(base, limit);
@ -742,10 +743,13 @@ static Res MVDescribe(Pool pool, mps_lib_FILE *stream, Count depth)
char c;
Ring spans, node = NULL, nextNode; /* gcc whinge stop */
if(!TESTT(Pool, pool)) return ResFAIL;
if (!TESTT(Pool, pool))
return ResFAIL;
mv = PoolMV(pool);
if(!TESTT(MV, mv)) return ResFAIL;
if(stream == NULL) return ResFAIL;
if (!TESTT(MV, mv))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
res = WriteF(stream, depth,
"blockPool $P ($U)\n",
@ -769,7 +773,8 @@ static Res MVDescribe(Pool pool, mps_lib_FILE *stream, Count depth)
MVBlock block;
span = RING_ELT(MVSpan, spans, node);
res = WriteF(stream, depth, "MVSpan $P {\n", (WriteFP)span, NULL);
if(res != ResOK) return res;
if (res != ResOK)
return res;
res = WriteF(stream, depth + 2,
"span $P\n", (WriteFP)span,
@ -778,19 +783,22 @@ static Res MVDescribe(Pool pool, mps_lib_FILE *stream, Count depth)
"blocks $U\n", (WriteFU)span->blockCount,
"largest ",
NULL);
if(res != ResOK) return res;
if (res != ResOK)
return res;
if (span->largestKnown) /* .design.largest */
res = WriteF(stream, 0, "$W\n", (WriteFW)span->largest, NULL);
else
res = WriteF(stream, 0, "unknown\n", NULL);
if(res != ResOK) return res;
if (res != ResOK)
return res;
block = span->blocks;
for(i = span->base.base; i < span->limit.limit; i = AddrAdd(i, length)) {
res = WriteF(stream, depth + 2, "$A ", (WriteFA)i, NULL);
if(res != ResOK) return res;
if (res != ResOK)
return res;
for(j = i;
j < AddrAdd(i, length) && j < span->limit.limit;
@ -813,13 +821,16 @@ static Res MVDescribe(Pool pool, mps_lib_FILE *stream, Count depth)
else /* j > block->base && j < block->limit */
c = '=';
res = WriteF(stream, 0, "$C", (WriteFC)c, NULL);
if(res != ResOK) return res;
if (res != ResOK)
return res;
}
res = WriteF(stream, 0, "\n", NULL);
if(res != ResOK) return res;
if (res != ResOK)
return res;
}
res = WriteF(stream, depth, "} MVSpan $P\n", (WriteFP)span, NULL);
if(res != ResOK) return res;
if (res != ResOK)
return res;
}
return ResOK;

View file

@ -1027,10 +1027,13 @@ static Res MVTDescribe(Pool pool, mps_lib_FILE *stream, Count depth)
Res res;
MVT mvt;
if (!TESTT(Pool, pool)) return ResFAIL;
if (!TESTT(Pool, pool))
return ResFAIL;
mvt = PoolMVT(pool);
if (!TESTT(MVT, mvt)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(MVT, mvt))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
res = WriteF(stream, depth,
"MVT $P {\n", (WriteFP)mvt,
@ -1050,17 +1053,22 @@ static Res MVTDescribe(Pool pool, mps_lib_FILE *stream, Count depth)
" available: $U\n", (WriteFU)mvt->available,
" unavailable: $U\n", (WriteFU)mvt->unavailable,
NULL);
if(res != ResOK) return res;
if (res != ResOK)
return res;
res = LandDescribe(MVTFreePrimary(mvt), stream, depth + 2);
if(res != ResOK) return res;
if (res != ResOK)
return res;
res = LandDescribe(MVTFreeSecondary(mvt), stream, depth + 2);
if(res != ResOK) return res;
if (res != ResOK)
return res;
res = LandDescribe(MVTFreeLand(mvt), stream, depth + 2);
if(res != ResOK) return res;
if (res != ResOK)
return res;
res = ABQDescribe(MVTABQ(mvt), (ABQDescribeElement)RangeDescribe, stream,
depth + 2);
if(res != ResOK) return res;
if (res != ResOK)
return res;
METER_WRITE(mvt->segAllocs, stream, depth + 2);
METER_WRITE(mvt->segFrees, stream, depth + 2);

View file

@ -673,10 +673,13 @@ static Res MVFFDescribe(Pool pool, mps_lib_FILE *stream, Count depth)
Res res;
MVFF mvff;
if (!TESTT(Pool, pool)) return ResFAIL;
if (!TESTT(Pool, pool))
return ResFAIL;
mvff = PoolMVFF(pool);
if (!TESTT(MVFF, mvff)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(MVFF, mvff))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
res = WriteF(stream, depth,
"MVFF $P {\n", (WriteFP)mvff,
@ -688,22 +691,27 @@ static Res MVFFDescribe(Pool pool, mps_lib_FILE *stream, Count depth)
" slotHigh $U\n", (WriteFU)mvff->slotHigh,
" spare $D\n", (WriteFD)mvff->spare,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = LocusPrefDescribe(MVFFLocusPref(mvff), stream, depth + 2);
if (res != ResOK) return res;
if (res != ResOK)
return res;
/* Don't describe MVFFBlockPool(mvff) otherwise it'll appear twice
* in the output of GlobalDescribe. */
res = LandDescribe(MVFFTotalLand(mvff), stream, depth + 2);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = LandDescribe(MVFFFreePrimary(mvff), stream, depth + 2);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = LandDescribe(MVFFFreeSecondary(mvff), stream, depth + 2);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = WriteF(stream, depth, "} MVFF $P\n", (WriteFP)mvff, NULL);
return res;

View file

@ -1,5 +1,5 @@
/* replay.c: Allocation replayer
* Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
*
* $Id$
*/
@ -127,8 +127,10 @@ static void readLog(EventProc proc)
Res res;
res = EventRead(&event, proc);
if (res == ResFAIL) break; /* eof */
if (res != ResOK) error("Truncated log");
if (res == ResFAIL)
break; /* eof */
if (res != ResOK)
error("Truncated log");
eventTime = event->any.clock;
EventRecord(proc, event, eventTime);
EventReplay(event, eventTime);
@ -186,7 +188,7 @@ int main(int argc, char *argv[])
/* C. COPYRIGHT AND LICENSE
*
* Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*

View file

@ -584,8 +584,10 @@ Res RootDescribe(Root root, mps_lib_FILE *stream, Count depth)
{
Res res;
if (!TESTT(Root, root)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Root, root))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
res = WriteF(stream, depth,
"Root $P ($U) {\n", (WriteFP)root, (WriteFU)root->serial,
@ -608,7 +610,8 @@ Res RootDescribe(Root root, mps_lib_FILE *stream, Count depth)
root->pm & AccessREAD ? " READ" : "",
root->pm & AccessWRITE ? " WRITE" : "",
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
switch(root->var) {
case RootTABLE:
@ -617,7 +620,8 @@ Res RootDescribe(Root root, mps_lib_FILE *stream, Count depth)
(WriteFA)root->the.table.base,
(WriteFA)root->the.table.limit,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
break;
case RootTABLE_MASKED:
@ -627,7 +631,8 @@ Res RootDescribe(Root root, mps_lib_FILE *stream, Count depth)
(WriteFA)root->the.tableMasked.limit,
(WriteFB)root->the.tableMasked.mask,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
break;
case RootFUN:
@ -636,7 +641,8 @@ Res RootDescribe(Root root, mps_lib_FILE *stream, Count depth)
"environment p $P s $W\n",
(WriteFP)root->the.fun.p, (WriteFW)root->the.fun.s,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
break;
case RootREG:
@ -644,7 +650,8 @@ Res RootDescribe(Root root, mps_lib_FILE *stream, Count depth)
"thread $P\n", (WriteFP)root->the.reg.thread,
"environment p $P", (WriteFP)root->the.reg.p,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
break;
case RootFMT:
@ -653,7 +660,8 @@ Res RootDescribe(Root root, mps_lib_FILE *stream, Count depth)
"format base $A limit $A\n",
(WriteFA)root->the.fmt.base, (WriteFA)root->the.fmt.limit,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
break;
default:
@ -663,7 +671,8 @@ Res RootDescribe(Root root, mps_lib_FILE *stream, Count depth)
res = WriteF(stream, depth,
"} Root $P ($U)\n", (WriteFP)root, (WriteFU)root->serial,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
return ResOK;
}
@ -679,7 +688,8 @@ Res RootsDescribe(Globals arenaGlobals, mps_lib_FILE *stream, Count depth)
RING_FOR(node, &arenaGlobals->rootRing, next) {
Root root = RING_ELT(Root, arenaRing, node);
res = RootDescribe(root, stream, depth);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
return res;
}

View file

@ -52,13 +52,15 @@ static Bool SACCheck(SAC sac)
for (j = sac->middleIndex + 1, i = 0; j < sac->classesCount; ++j, i += 2) {
CHECKL(prevSize < esac->_freelists[i]._size);
b = sacFreeListBlockCheck(&(esac->_freelists[i]));
if (!b) return b;
if (!b)
return b;
prevSize = esac->_freelists[i]._size;
}
/* check overlarge class */
CHECKL(prevSize < esac->_freelists[i]._size);
b = sacFreeListBlockCheck(&(esac->_freelists[i]));
if (!b) return b;
if (!b)
return b;
CHECKL(esac->_freelists[i]._size == SizeMAX);
CHECKL(esac->_freelists[i]._count == 0);
CHECKL(esac->_freelists[i]._count_max == 0);
@ -68,7 +70,8 @@ static Bool SACCheck(SAC sac)
for (j = sac->middleIndex, i = 1; j > 0; --j, i += 2) {
CHECKL(prevSize > esac->_freelists[i]._size);
b = sacFreeListBlockCheck(&(esac->_freelists[i]));
if (!b) return b;
if (!b)
return b;
prevSize = esac->_freelists[i]._size;
}
/* check smallest class */
@ -136,7 +139,8 @@ Res SACCreate(SAC *sacReturn, Pool pool, Count classesCount,
/* Find middle one */
totalFreq /= 2;
for (i = 0; i < classesCount; ++i) {
if (totalFreq < classes[i].mps_frequency) break;
if (totalFreq < classes[i].mps_frequency)
break;
totalFreq -= classes[i].mps_frequency;
}
if (totalFreq <= classes[i].mps_frequency / 2)

View file

@ -96,7 +96,8 @@ static mps_res_t stress(mps_arena_t arena, mps_align_t align,
ps[j] = ps[i]; ss[j] = ss[i];
ps[i] = tp; ss[i] = ts;
}
if (k == (testLOOPS / 2)) mps_sac_flush(sac);
if (k == (testLOOPS / 2))
mps_sac_flush(sac);
/* free half of the objects */
/* upper half, as when allocating them again we want smaller objects */
/* see randomSize() */
@ -121,7 +122,8 @@ static mps_res_t stress(mps_arena_t arena, mps_align_t align,
res = mps_sac_alloc((mps_addr_t *)&ps[i], sac, ss[i], FALSE);
break;
}
if (res != MPS_RES_OK) return res;
if (res != MPS_RES_OK)
return res;
}
}

View file

@ -362,8 +362,10 @@ Res SegDescribe(Seg seg, mps_lib_FILE *stream, Count depth)
Res res;
Pool pool;
if (!TESTT(Seg, seg)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Seg, seg))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
pool = SegPool(seg);
@ -395,13 +397,16 @@ Res SegDescribe(Seg seg, mps_lib_FILE *stream, Count depth)
BS_IS_MEMBER(seg->rankSet, RankFINAL) ? " FINAL" : "",
BS_IS_MEMBER(seg->rankSet, RankWEAK) ? " WEAK" : "",
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = seg->class->describe(seg, stream, depth + 2);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = WriteF(stream, 0, "\n", NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = WriteF(stream, depth, "} Segment $P\n", (WriteFP)seg, NULL);
return res;
@ -1016,8 +1021,10 @@ static Res segTrivDescribe(Seg seg, mps_lib_FILE *stream, Count depth)
{
Res res;
if (!TESTT(Seg, seg)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Seg, seg))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
res = WriteF(stream, depth,
"shield depth $U\n", (WriteFU)seg->depth,
@ -1576,27 +1583,33 @@ static Res gcSegDescribe(Seg seg, mps_lib_FILE *stream, Count depth)
SegClass super;
GCSeg gcseg;
if (!TESTT(Seg, seg)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Seg, seg))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
gcseg = SegGCSeg(seg);
if (!TESTT(GCSeg, gcseg)) return ResFAIL;
if (!TESTT(GCSeg, gcseg))
return ResFAIL;
/* Describe the superclass fields first via next-method call */
super = SEG_SUPERCLASS(GCSegClass);
res = super->describe(seg, stream, depth);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = WriteF(stream, depth,
"summary $W\n", (WriteFW)gcseg->summary,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
if (gcseg->buffer == NULL) {
res = WriteF(stream, depth, "buffer: NULL\n", NULL);
} else {
res = BufferDescribe(gcseg->buffer, stream, depth);
}
if (res != ResOK) return res;
if (res != ResOK)
return res;
return ResOK;
}

View file

@ -1,7 +1,7 @@
/* shield.c: SHIELD IMPLEMENTATION
*
* $Id$
* Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
*
* See: idea.shield, design.mps.shield.
*
@ -133,7 +133,8 @@ static void flush(Arena arena, Size i)
AVER(i < arena->shCacheLimit);
seg = arena->shCache[i];
if (seg == NULL) return;
if (seg == NULL)
return;
AVERT(Seg, seg);
AVER(arena->shDepth > 0);
@ -157,7 +158,8 @@ static void cache(Arena arena, Seg seg)
AVERT_CRITICAL(Arena, arena);
AVERT_CRITICAL(Seg, seg);
if (SegSM(seg) == SegPM(seg)) return;
if (SegSM(seg)
== SegPM(seg)) return;
if (SegDepth(seg) > 0) {
ShieldSuspend(arena);
return;
@ -334,7 +336,7 @@ void (ShieldCover)(Arena arena, Seg seg)
/* C. COPYRIGHT AND LICENSE
*
* Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*

View file

@ -1024,34 +1024,44 @@ static Res SplayNodeDescribe(Tree node, mps_lib_FILE *stream,
{
Res res;
if (!TreeCheck(node)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (nodeDescribe == NULL) return ResFAIL;
if (!TreeCheck(node))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
if (nodeDescribe == NULL)
return ResFAIL;
res = WriteF(stream, 0, "( ", NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
if (TreeHasLeft(node)) {
res = SplayNodeDescribe(TreeLeft(node), stream, nodeDescribe);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = WriteF(stream, 0, " / ", NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
res = (*nodeDescribe)(node, stream);
if (res != ResOK) return res;
if (res != ResOK)
return res;
if (TreeHasRight(node)) {
res = WriteF(stream, 0, " \\ ", NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = SplayNodeDescribe(TreeRight(node), stream, nodeDescribe);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
res = WriteF(stream, 0, " )", NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
return ResOK;
}
@ -1356,9 +1366,12 @@ Res SplayTreeDescribe(SplayTree splay, mps_lib_FILE *stream, Count depth,
{
Res res;
if (!TESTT(SplayTree, splay)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (nodeDescribe == NULL) return ResFAIL;
if (!TESTT(SplayTree, splay))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
if (nodeDescribe == NULL)
return ResFAIL;
res = WriteF(stream, depth,
"Splay $P {\n", (WriteFP)splay,
@ -1366,13 +1379,16 @@ Res SplayTreeDescribe(SplayTree splay, mps_lib_FILE *stream, Count depth,
" nodeKey $F\n", (WriteFF)splay->nodeKey,
" updateNode $F\n", (WriteFF)splay->updateNode,
NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
if (SplayTreeRoot(splay) != TreeEMPTY) {
res = WriteF(stream, depth, " tree ", NULL);
if (res != ResOK) return res;
if (res != ResOK)
return res;
res = SplayNodeDescribe(SplayTreeRoot(splay), stream, nodeDescribe);
if (res != ResOK) return res;
if (res != ResOK)
return res;
}
res = WriteF(stream, depth, "\n} Splay $P\n", (WriteFP)splay, NULL);

View file

@ -1,7 +1,7 @@
/* table.h: A dictionary mapping a Word to a void*
*
* $Id$
* Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
*
* .note.good-hash: As is common in hash table implementations, we
* assume that the hash function is good.
@ -301,7 +301,8 @@ extern Res TableDefine(Table table, Word key, void *value)
if (table->count >= table->length * SPACEFRACTION) {
Res res = TableGrow(table, 1);
if(res != ResOK) return res;
if (res != ResOK)
return res;
entry = tableFind(table, key, FALSE /* no deletions yet */);
AVER(entry != NULL);
if (entryIsActive(table, entry))
@ -382,7 +383,7 @@ extern Count TableCount(Table table)
/* C. COPYRIGHT AND LICENSE
*
* Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*

View file

@ -53,7 +53,8 @@ Res ThreadRegister(Thread *threadReturn, Arena arena)
res = ControlAlloc(&p, arena, sizeof(ThreadStruct),
/* withReservoirPermit */ FALSE);
if(res != ResOK) return res;
if (res != ResOK)
return res;
thread = (Thread)p;
thread->arena = arena;
@ -138,7 +139,8 @@ Res ThreadDescribe(Thread thread, mps_lib_FILE *stream, Count depth)
(WriteFP)thread->arena, (WriteFU)thread->arena->serial,
"} Thread $P ($U)\n", (WriteFP)thread, (WriteFU)thread->serial,
NULL);
if(res != ResOK) return res;
if (res != ResOK)
return res;
return ResOK;
}

View file

@ -69,7 +69,8 @@ Res ThreadRegister(Thread *threadReturn, Arena arena)
res = ControlAlloc(&p, arena, sizeof(ThreadStruct),
/* withReservoirPermit */ FALSE);
if(res != ResOK) return res;
if (res != ResOK)
return res;
thread = (Thread)p;
thread->arena = arena;
@ -259,7 +260,8 @@ Res ThreadDescribe(Thread thread, mps_lib_FILE *stream, Count depth)
" port $U\n", (WriteFU)thread->port,
"} Thread $P ($U)\n", (WriteFP)thread, (WriteFU)thread->serial,
NULL);
if(res != ResOK) return res;
if (res != ResOK)
return res;
return ResOK;
}

View file

@ -1440,7 +1440,8 @@ Res TraceScanArea(ScanState ss, Addr *base, Addr *limit)
TRACE_SCAN_BEGIN(ss) {
p = base;
loop:
if(p >= limit) goto out;
if (p >= limit)
goto out;
ref = *p++;
if(!TRACE_FIX1(ss, ref))
goto loop;
@ -1504,10 +1505,13 @@ Res TraceScanAreaMasked(ScanState ss, Addr *base, Addr *limit, Word mask)
TRACE_SCAN_BEGIN(ss) {
p = base;
loop:
if(p >= limit) goto out;
if (p >= limit)
goto out;
ref = *p++;
if(((Word)ref & mask) != 0) goto loop;
if(!TRACE_FIX1(ss, ref)) goto loop;
if (((Word)ref & mask)
!= 0) goto loop;
if (!TRACE_FIX1(ss, ref))
goto loop;
res = TRACE_FIX2(ss, p-1);
if(res == ResOK)
goto loop;
@ -1916,8 +1920,10 @@ Res TraceDescribe(Trace trace, mps_lib_FILE *stream, Count depth)
Res res;
const char *state;
if (!TESTT(Trace, trace)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TESTT(Trace, trace))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
switch (trace->state) {
case TraceINIT: state = "INIT"; break;

View file

@ -359,10 +359,13 @@ Res ChunkNodeDescribe(Tree node, mps_lib_FILE *stream)
{
Chunk chunk;
if (!TreeCheck(node)) return ResFAIL;
if (stream == NULL) return ResFAIL;
if (!TreeCheck(node))
return ResFAIL;
if (stream == NULL)
return ResFAIL;
chunk = ChunkOfTree(node);
if (!TESTT(Chunk, chunk)) return ResFAIL;
if (!TESTT(Chunk, chunk))
return ResFAIL;
return WriteF(stream, 0, "[$P,$P)", (WriteFP)chunk->base,
(WriteFP)chunk->limit, NULL);

View file

@ -205,7 +205,8 @@ static void get(mps_arena_t arena)
(ulongest_t)mclockEnd, (ulongest_t)(mclockEnd - mclockBegin));
printf(" Coll End ");
showStatsText(notcon, con, live);
if(rnd()==0) showStatsAscii(notcon, con, live, alimit);
if (rnd()==0)
showStatsAscii(notcon, con, live, alimit);
break;
}
case mps_message_type_finalization(): {