mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-04-27 08:43:40 -07:00
Mps: better style.
Copied from Perforce Change: 162871 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
6018a84ac0
commit
0a13a65669
1 changed files with 155 additions and 112 deletions
|
|
@ -106,7 +106,7 @@ static Bool amcSegCheck(amcSeg amcseg)
|
|||
CHECKD(GCSeg, &amcseg->gcSegStruct);
|
||||
CHECKL(*amcseg->segTypeP == AMCPTypeNailboard
|
||||
|| *amcseg->segTypeP == AMCPTypeGen);
|
||||
if (*amcseg->segTypeP == AMCPTypeNailboard) {
|
||||
if(*amcseg->segTypeP == AMCPTypeNailboard) {
|
||||
CHECKL(SegNailed(amcSeg2Seg(amcseg)) != TraceSetEMPTY);
|
||||
}
|
||||
CHECKL(BoolCheck(amcseg->new));
|
||||
|
|
@ -132,7 +132,7 @@ static Res AMCSegInit(Seg seg, Pool pool, Addr base, Size size,
|
|||
/* Initialize the superclass fields first via next-method call */
|
||||
super = SEG_SUPERCLASS(amcSegClass);
|
||||
res = super->init(seg, pool, base, size, reservoirPermit, args);
|
||||
if (res != ResOK)
|
||||
if(res != ResOK)
|
||||
return res;
|
||||
|
||||
amcseg->segTypeP = segtype; /* .segtype */
|
||||
|
|
@ -164,7 +164,7 @@ static void AMCSegSketch(Seg seg, char *pbSketch, size_t cbSketch)
|
|||
amcseg = Seg2amcSeg(seg);
|
||||
AVERT(amcSeg, amcseg);
|
||||
|
||||
if (SegNailed(seg) == TraceSetEMPTY) {
|
||||
if(SegNailed(seg) == TraceSetEMPTY) {
|
||||
pbSketch[0] = 'm'; /* mobile */
|
||||
} else if (amcSegHasNailboard(seg)) {
|
||||
pbSketch[0] = 'b'; /* boarded */
|
||||
|
|
@ -172,20 +172,20 @@ static void AMCSegSketch(Seg seg, char *pbSketch, size_t cbSketch)
|
|||
pbSketch[0] = 's'; /* stuck */
|
||||
}
|
||||
|
||||
if (SegGrey(seg) == TraceSetEMPTY) {
|
||||
if(SegGrey(seg) == TraceSetEMPTY) {
|
||||
pbSketch[1] = '_';
|
||||
} else {
|
||||
pbSketch[1] = 'G'; /* Grey */
|
||||
}
|
||||
|
||||
if (SegWhite(seg) == TraceSetEMPTY) {
|
||||
if(SegWhite(seg) == TraceSetEMPTY) {
|
||||
pbSketch[2] = '_';
|
||||
} else {
|
||||
pbSketch[2] = 'W'; /* White */
|
||||
}
|
||||
|
||||
buffer = SegBuffer(seg);
|
||||
if (buffer == NULL) {
|
||||
if(buffer == NULL) {
|
||||
pbSketch[3] = '_';
|
||||
} else {
|
||||
Bool mut = BufferIsMutator(buffer);
|
||||
|
|
@ -195,15 +195,15 @@ static void AMCSegSketch(Seg seg, char *pbSketch, size_t cbSketch)
|
|||
|
||||
pbSketch[3] = 'X'; /* I don't know what's going on! */
|
||||
|
||||
if ( (flipped == trapped) && (trapped == limitzeroed) ) {
|
||||
if (mut) {
|
||||
if (flipped) {
|
||||
if((flipped == trapped) && (trapped == limitzeroed)) {
|
||||
if(mut) {
|
||||
if(flipped) {
|
||||
pbSketch[3] = 's'; /* stalo */
|
||||
} else {
|
||||
pbSketch[3] = 'n'; /* neo */
|
||||
}
|
||||
} else {
|
||||
if (!flipped) {
|
||||
if(!flipped) {
|
||||
pbSketch[3] = 'f'; /* forwarding */
|
||||
}
|
||||
}
|
||||
|
|
@ -232,15 +232,19 @@ static Res AMCSegDescribe(Seg seg, mps_lib_FILE *stream)
|
|||
Size row;
|
||||
char abzSketch[5];
|
||||
|
||||
if (!CHECKT(Seg, seg)) return ResFAIL;
|
||||
if (stream == NULL) return ResFAIL;
|
||||
if(!CHECKT(Seg, seg))
|
||||
return ResFAIL;
|
||||
if(stream == NULL)
|
||||
return ResFAIL;
|
||||
amcseg = Seg2amcSeg(seg);
|
||||
if (!CHECKT(amcSeg, amcseg)) return ResFAIL;
|
||||
if(!CHECKT(amcSeg, amcseg))
|
||||
return ResFAIL;
|
||||
|
||||
/* Describe the superclass fields first via next-method call */
|
||||
super = SEG_SUPERCLASS(amcSegClass);
|
||||
res = super->describe(seg, stream);
|
||||
if (res != ResOK) return res;
|
||||
if(res != ResOK)
|
||||
return res;
|
||||
|
||||
pool = SegPool(seg);
|
||||
step = PoolAlignment(pool);
|
||||
|
|
@ -254,24 +258,27 @@ static Res AMCSegDescribe(Seg seg, mps_lib_FILE *stream)
|
|||
"AMC seg $P [$A,$A){\n",
|
||||
(WriteFP)seg, (WriteFA)base, (WriteFA)limit,
|
||||
NULL);
|
||||
if (res != ResOK) return res;
|
||||
if(res != ResOK)
|
||||
return res;
|
||||
|
||||
if (amcSegHasNailboard(seg)) {
|
||||
if(amcSegHasNailboard(seg)) {
|
||||
res = WriteF(stream, " Boarded\n", NULL);
|
||||
/* @@@@ should have AMCNailboardDescribe() */
|
||||
} else {
|
||||
if (SegNailed(seg) == TraceSetEMPTY) {
|
||||
if(SegNailed(seg) == TraceSetEMPTY) {
|
||||
res = WriteF(stream, " Mobile\n", NULL);
|
||||
} else {
|
||||
res = WriteF(stream, " Stuck\n", NULL);
|
||||
}
|
||||
}
|
||||
if (res != ResOK) return res;
|
||||
if(res != ResOK)
|
||||
return res;
|
||||
|
||||
res = WriteF(stream, " Map: *===:object bbbb:buffer\n", NULL);
|
||||
if (res != ResOK) return res;
|
||||
if(res != ResOK)
|
||||
return res;
|
||||
|
||||
if (SegBuffer(seg) != NULL)
|
||||
if(SegBuffer(seg) != NULL)
|
||||
init = BufferGetInit(SegBuffer(seg));
|
||||
else
|
||||
init = limit;
|
||||
|
|
@ -281,34 +288,40 @@ static Res AMCSegDescribe(Seg seg, mps_lib_FILE *stream)
|
|||
char c;
|
||||
|
||||
res = WriteF(stream, " $A ", i, NULL);
|
||||
if (res != ResOK) return res;
|
||||
if(res != ResOK)
|
||||
return res;
|
||||
|
||||
/* @@@@ This needs to describe nailboards as well */
|
||||
/* @@@@ This misses a header-sized pad at the end. */
|
||||
for(j = i; j < AddrAdd(i, row); j = AddrAdd(j, step)) {
|
||||
if (j >= limit)
|
||||
if(j >= limit)
|
||||
c = ' '; /* if seg is not a whole number of print rows */
|
||||
else if (j >= init)
|
||||
else if(j >= init)
|
||||
c = 'b';
|
||||
else if (j == p) {
|
||||
else if(j == p) {
|
||||
c = '*';
|
||||
p = (pool->format->skip)(p);
|
||||
} else
|
||||
} else {
|
||||
c = '=';
|
||||
}
|
||||
res = WriteF(stream, "$C", c, NULL);
|
||||
if (res != ResOK) return res;
|
||||
if(res != ResOK)
|
||||
return res;
|
||||
}
|
||||
|
||||
res = WriteF(stream, "\n", NULL);
|
||||
if (res != ResOK) return res;
|
||||
if(res != ResOK)
|
||||
return res;
|
||||
}
|
||||
|
||||
AMCSegSketch(seg, abzSketch, NELEMS(abzSketch));
|
||||
res = WriteF(stream, " Sketch: $S\n", (WriteFS)abzSketch, NULL);
|
||||
if (res != ResOK) return res;
|
||||
if(res != ResOK)
|
||||
return res;
|
||||
|
||||
res = WriteF(stream, "} AMC Seg $P\n", (WriteFP)seg, NULL);
|
||||
if (res != ResOK) return res;
|
||||
if(res != ResOK)
|
||||
return res;
|
||||
|
||||
return ResOK;
|
||||
}
|
||||
|
|
@ -358,7 +371,7 @@ static amcNailboard amcSegNailboard(Seg seg)
|
|||
|
||||
static amcGen amcSegGen(Seg seg)
|
||||
{
|
||||
if (amcSegHasNailboard(seg)) {
|
||||
if(amcSegHasNailboard(seg)) {
|
||||
amcNailboard Nailboard = amcSegNailboard(seg);
|
||||
return Nailboard->gen;
|
||||
} else {
|
||||
|
|
@ -466,7 +479,7 @@ static Bool amcBufCheck(amcBuf amcbuf)
|
|||
CHECKS(amcBuf, amcbuf);
|
||||
segbuf = &amcbuf->segbufStruct;
|
||||
CHECKL(SegBufCheck(segbuf));
|
||||
if (amcbuf->gen != NULL)
|
||||
if(amcbuf->gen != NULL)
|
||||
CHECKD(amcGen, amcbuf->gen);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -486,7 +499,7 @@ static void amcBufSetGen(Buffer buffer, amcGen gen)
|
|||
{
|
||||
amcBuf amcbuf;
|
||||
|
||||
if (gen != NULL)
|
||||
if(gen != NULL)
|
||||
AVERT(amcGen, gen);
|
||||
amcbuf = Buffer2amcBuf(buffer);
|
||||
amcbuf->gen = gen;
|
||||
|
|
@ -510,11 +523,11 @@ static Res AMCBufInit(Buffer buffer, Pool pool, va_list args)
|
|||
/* call next method */
|
||||
superclass = BUFFER_SUPERCLASS(amcBufClass);
|
||||
res = (*superclass->init)(buffer, pool, args);
|
||||
if (res != ResOK)
|
||||
if(res != ResOK)
|
||||
return res;
|
||||
|
||||
amcbuf = Buffer2amcBuf(buffer);
|
||||
if (BufferIsMutator(buffer)) {
|
||||
if(BufferIsMutator(buffer)) {
|
||||
/* Set up the buffer to be allocating in the nursery. */
|
||||
amcbuf->gen = amc->nursery;
|
||||
} else {
|
||||
|
|
@ -542,7 +555,7 @@ static void AMCBufFinish(Buffer buffer)
|
|||
|
||||
amcbuf->sig = SigInvalid;
|
||||
|
||||
/* finish the superclass fields last */
|
||||
/* Finish the superclass fields last. */
|
||||
super = BUFFER_SUPERCLASS(amcBufClass);
|
||||
super->finish(buffer);
|
||||
}
|
||||
|
|
@ -575,16 +588,16 @@ static Res amcGenCreate(amcGen *genReturn, AMC amc, Serial genNr)
|
|||
arena = pool->arena;
|
||||
|
||||
res = ControlAlloc(&p, arena, sizeof(amcGenStruct), FALSE);
|
||||
if (res != ResOK)
|
||||
if(res != ResOK)
|
||||
goto failControlAlloc;
|
||||
gen = (amcGen)p;
|
||||
|
||||
res = BufferCreate(&buffer, EnsureamcBufClass(), pool, FALSE);
|
||||
if (res != ResOK)
|
||||
if(res != ResOK)
|
||||
goto failBufferCreate;
|
||||
|
||||
res = PoolGenInit(&gen->pgen, amc->chain, genNr, pool);
|
||||
if (res != ResOK)
|
||||
if(res != ResOK)
|
||||
goto failGenInit;
|
||||
gen->type = AMCPTypeGen;
|
||||
RingInit(&gen->amcRing);
|
||||
|
|
@ -635,7 +648,8 @@ static Res amcGenDescribe(amcGen gen, mps_lib_FILE *stream)
|
|||
{
|
||||
Res res;
|
||||
|
||||
if (!CHECKT(amcGen, gen)) return ResFAIL;
|
||||
if(!CHECKT(amcGen, gen))
|
||||
return ResFAIL;
|
||||
|
||||
res = WriteF(stream,
|
||||
" amcGen $P ($U) {\n", (WriteFP)gen, (WriteFU)amcGenNr(gen),
|
||||
|
|
@ -662,7 +676,7 @@ static Res amcSegCreateNailboard(Seg seg, Pool pool)
|
|||
arena = PoolArena(pool);
|
||||
|
||||
res = ControlAlloc(&p, arena, sizeof(amcNailboardStruct), FALSE);
|
||||
if (res != ResOK)
|
||||
if(res != ResOK)
|
||||
goto failAllocNailboard;
|
||||
board = p;
|
||||
board->type = AMCPTypeNailboard;
|
||||
|
|
@ -671,10 +685,11 @@ static Res amcSegCreateNailboard(Seg seg, Pool pool)
|
|||
board->distinctNails = (Count)0;
|
||||
board->newMarks = FALSE;
|
||||
board->markShift = SizeLog2((Size)pool->alignment);
|
||||
/* [I wonder what this comment is referring to? 2007-07-11 DRJ] */
|
||||
/* See d.m.p.Nailboard.size. */
|
||||
bits = (SegSize(seg) + pool->format->headerSize) >> board->markShift;
|
||||
res = ControlAlloc(&p, arena, BTSize(bits), FALSE);
|
||||
if (res != ResOK)
|
||||
if(res != ResOK)
|
||||
goto failMarkTable;
|
||||
board->mark = p;
|
||||
BTResRange(board->mark, 0, bits);
|
||||
|
|
@ -741,7 +756,7 @@ static Bool amcNailGetAndSetMark(Seg seg, Ref ref)
|
|||
|
||||
++board->nails;
|
||||
i = AddrOffset(SegBase(seg), ref) >> board->markShift;
|
||||
if (!BTGet(board->mark, i)) {
|
||||
if(!BTGet(board->mark, i)) {
|
||||
BTSet(board->mark, i);
|
||||
board->newMarks = TRUE;
|
||||
++board->distinctNails;
|
||||
|
|
@ -846,7 +861,7 @@ static Res amcInitComm(Pool pool, RankSet rankSet, va_list arg)
|
|||
amc->rampCount = 0;
|
||||
amc->rampMode = outsideRamp;
|
||||
|
||||
if (pool->format->headerSize == 0) {
|
||||
if(pool->format->headerSize == 0) {
|
||||
pool->fix = AMCFix;
|
||||
} else {
|
||||
pool->fix = AMCHeaderFix;
|
||||
|
|
@ -860,14 +875,15 @@ static Res amcInitComm(Pool pool, RankSet rankSet, va_list arg)
|
|||
{
|
||||
void *p;
|
||||
|
||||
genArraySize = sizeof(amcGen) * (genCount + 1); /* chain plus dynamic gen */
|
||||
/* One gen for each one in the chain plus dynamic gen. */
|
||||
genArraySize = sizeof(amcGen) * (genCount + 1);
|
||||
res = ControlAlloc(&p, arena, genArraySize, FALSE);
|
||||
if (res != ResOK)
|
||||
if(res != ResOK)
|
||||
goto failGensAlloc;
|
||||
amc->gen = p;
|
||||
for(i = 0; i < genCount + 1; ++i) {
|
||||
res = amcGenCreate(&amc->gen[i], amc, (Serial)i);
|
||||
if (res != ResOK) {
|
||||
if(res != ResOK) {
|
||||
goto failGenAlloc;
|
||||
}
|
||||
}
|
||||
|
|
@ -885,7 +901,7 @@ static Res amcInitComm(Pool pool, RankSet rankSet, va_list arg)
|
|||
|
||||
AVERT(AMC, amc);
|
||||
EVENT_PP(AMCInit, pool, amc);
|
||||
if (rankSet == RankSetEMPTY)
|
||||
if(rankSet == RankSetEMPTY)
|
||||
EVENT_PP(PoolInitAMCZ, pool, pool->format);
|
||||
else
|
||||
EVENT_PP(PoolInitAMC, pool, pool->format);
|
||||
|
|
@ -1009,11 +1025,11 @@ static Res AMCBufferFill(Addr *baseReturn, Addr *limitReturn,
|
|||
res = SegAlloc(&seg, amcSegClassGet(), &segPrefStruct,
|
||||
alignedSize, pool, withReservoirPermit,
|
||||
&gen->type); /* .segtype */
|
||||
if (res != ResOK)
|
||||
if(res != ResOK)
|
||||
return res;
|
||||
|
||||
/* <design/seg/#field.rankSet.start> */
|
||||
if (BufferRankSet(buffer) == RankSetEMPTY)
|
||||
if(BufferRankSet(buffer) == RankSetEMPTY)
|
||||
SegSetRankAndSummary(seg, BufferRankSet(buffer), RefSetEMPTY);
|
||||
else
|
||||
SegSetRankAndSummary(seg, BufferRankSet(buffer), RefSetUNIV);
|
||||
|
|
@ -1022,8 +1038,10 @@ static Res AMCBufferFill(Addr *baseReturn, Addr *limitReturn,
|
|||
++gen->segs;
|
||||
gen->pgen.totalSize += alignedSize;
|
||||
/* If ramping, don't count survivors in newSize. */
|
||||
if (amc->rampMode != ramping
|
||||
|| buffer != amc->rampGen->forward || gen != amc->rampGen) {
|
||||
if(amc->rampMode != ramping
|
||||
|| buffer != amc->rampGen->forward
|
||||
|| gen != amc->rampGen)
|
||||
{
|
||||
gen->pgen.newSize += alignedSize;
|
||||
} else {
|
||||
Seg2amcSeg(seg)->new = FALSE;
|
||||
|
|
@ -1065,7 +1083,7 @@ static void AMCBufferEmpty(Pool pool, Buffer buffer, Addr init, Addr limit)
|
|||
|
||||
/* <design/poolamc/#flush.pad> */
|
||||
size = AddrOffset(init, limit);
|
||||
if (size > 0) {
|
||||
if(size > 0) {
|
||||
ShieldExpose(arena, seg);
|
||||
(*pool->format->pad)(init, size);
|
||||
ShieldCover(arena, seg);
|
||||
|
|
@ -1088,8 +1106,8 @@ static void AMCRampBegin(Pool pool, Buffer buf, Bool collectAll)
|
|||
|
||||
AVER(amc->rampCount < UINT_MAX);
|
||||
++amc->rampCount;
|
||||
if (amc->rampCount == 1) {
|
||||
if (amc->rampMode != finishRamp)
|
||||
if(amc->rampCount == 1) {
|
||||
if(amc->rampMode != finishRamp)
|
||||
amc->rampMode = beginRamp;
|
||||
}
|
||||
}
|
||||
|
|
@ -1108,11 +1126,11 @@ static void AMCRampEnd(Pool pool, Buffer buf)
|
|||
|
||||
AVER(amc->rampCount > 0);
|
||||
--amc->rampCount;
|
||||
if (amc->rampCount == 0) {
|
||||
if(amc->rampCount == 0) {
|
||||
PoolGen pgen = &amc->rampGen->pgen;
|
||||
Ring node, nextNode;
|
||||
|
||||
if (amc->rampMode == ramping) /* if we are ramping, clean up */
|
||||
if(amc->rampMode == ramping) /* if we are ramping, clean up */
|
||||
amc->rampMode = finishRamp;
|
||||
else
|
||||
amc->rampMode = outsideRamp;
|
||||
|
|
@ -1122,8 +1140,9 @@ static void AMCRampEnd(Pool pool, Buffer buf)
|
|||
RING_FOR(node, PoolSegRing(pool), nextNode) {
|
||||
Seg seg = SegOfPoolRing(node);
|
||||
|
||||
if (amcSegGen(seg) == amc->rampGen && !Seg2amcSeg(seg)->new
|
||||
&& SegWhite(seg) == TraceSetEMPTY) {
|
||||
if(amcSegGen(seg) == amc->rampGen && !Seg2amcSeg(seg)->new
|
||||
&& SegWhite(seg) == TraceSetEMPTY)
|
||||
{
|
||||
pgen->newSize += SegSize(seg);
|
||||
Seg2amcSeg(seg)->new = TRUE;
|
||||
}
|
||||
|
|
@ -1264,17 +1283,18 @@ static Res amcScanNailedOnce(Bool *totalReturn, Bool *moreReturn,
|
|||
p = AddrAdd(SegBase(seg), format->headerSize);
|
||||
while(SegBuffer(seg) != NULL) {
|
||||
limit = AddrAdd(BufferScanLimit(SegBuffer(seg)), format->headerSize);
|
||||
if (p >= limit) {
|
||||
if(p >= limit) {
|
||||
AVER(p == limit);
|
||||
goto returnGood;
|
||||
}
|
||||
while(p < limit) {
|
||||
Addr q;
|
||||
q = (*format->skip)(p);
|
||||
if (amcNailGetMark(seg, p)) {
|
||||
if(amcNailGetMark(seg, p)) {
|
||||
res = (*format->scan)(ss, p, q);
|
||||
if (res != ResOK) {
|
||||
*totalReturn = FALSE; *moreReturn = TRUE;
|
||||
if(res != ResOK) {
|
||||
*totalReturn = FALSE;
|
||||
*moreReturn = TRUE;
|
||||
return res;
|
||||
}
|
||||
bytesScanned += AddrOffset(p, q);
|
||||
|
|
@ -1293,10 +1313,11 @@ static Res amcScanNailedOnce(Bool *totalReturn, Bool *moreReturn,
|
|||
while(p < limit) {
|
||||
Addr q;
|
||||
q = (*format->skip)(p);
|
||||
if (amcNailGetMark(seg, p)) {
|
||||
if(amcNailGetMark(seg, p)) {
|
||||
res = (*format->scan)(ss, p, q);
|
||||
if (res != ResOK) {
|
||||
*totalReturn = FALSE; *moreReturn = TRUE;
|
||||
if(res != ResOK) {
|
||||
*totalReturn = FALSE;
|
||||
*moreReturn = TRUE;
|
||||
return res;
|
||||
}
|
||||
bytesScanned += AddrOffset(p, q);
|
||||
|
|
@ -1329,17 +1350,16 @@ static Res amcScanNailed(Bool *totalReturn, ScanState ss, Pool pool,
|
|||
do {
|
||||
Res res;
|
||||
res = amcScanNailedOnce(&total, &moreScanning, ss, pool, seg, amc);
|
||||
if (res != ResOK) {
|
||||
if(res != ResOK) {
|
||||
*totalReturn = FALSE;
|
||||
return res;
|
||||
}
|
||||
loops += 1;
|
||||
} while(moreScanning);
|
||||
|
||||
if (loops > 1)
|
||||
{
|
||||
if(loops > 1) {
|
||||
{
|
||||
/* looped: should only happen under emergency tracing */
|
||||
/* Looped: should only happen under emergency tracing. */
|
||||
TraceId ti;
|
||||
Trace trace;
|
||||
Bool emerg = FALSE;
|
||||
|
|
@ -1347,14 +1367,14 @@ static Res amcScanNailed(Bool *totalReturn, ScanState ss, Pool pool,
|
|||
Arena arena = pool->arena;
|
||||
|
||||
TRACE_SET_ITER(ti, trace, ts, arena)
|
||||
if (trace->emergency) {
|
||||
if(trace->emergency) {
|
||||
emerg = TRUE;
|
||||
}
|
||||
TRACE_SET_ITER_END(ti, trace, ts, arena);
|
||||
AVER(emerg);
|
||||
}
|
||||
{
|
||||
/* looped: fixed refs (from 1st pass) were seen by MPS_FIX1
|
||||
/* Looped: fixed refs (from 1st pass) were seen by MPS_FIX1
|
||||
* (in later passes), so the "ss.unfixedSummary" is _not_
|
||||
* purely unfixed. In this one case, unfixedSummary is not
|
||||
* accurate, and cannot be used to verify the SegSummary (see
|
||||
|
|
@ -1421,7 +1441,7 @@ static Res AMCScan(Bool *totalReturn, ScanState ss, Pool pool, Seg seg)
|
|||
format = pool->format;
|
||||
arena = pool->arena;
|
||||
|
||||
if (amcSegHasNailboard(seg)) {
|
||||
if(amcSegHasNailboard(seg)) {
|
||||
return amcScanNailed(totalReturn, ss, pool, seg, amc);
|
||||
}
|
||||
|
||||
|
|
@ -1430,14 +1450,14 @@ static Res AMCScan(Bool *totalReturn, ScanState ss, Pool pool, Seg seg)
|
|||
base = AddrAdd(SegBase(seg), format->headerSize);
|
||||
while(SegBuffer(seg) != NULL) { /* <design/poolamc/#seg-scan.loop> */
|
||||
limit = AddrAdd(BufferScanLimit(SegBuffer(seg)), format->headerSize);
|
||||
if (base >= limit) {
|
||||
if(base >= limit) {
|
||||
/* @@@@ Are we sure we don't need scan the rest of the segment? */
|
||||
AVER(base == limit);
|
||||
*totalReturn = TRUE;
|
||||
return ResOK;
|
||||
}
|
||||
res = (*format->scan)(ss, base, limit);
|
||||
if (res != ResOK) {
|
||||
if(res != ResOK) {
|
||||
*totalReturn = FALSE;
|
||||
return res;
|
||||
}
|
||||
|
|
@ -1449,9 +1469,9 @@ static Res AMCScan(Bool *totalReturn, ScanState ss, Pool pool, Seg seg)
|
|||
limit = AddrAdd(SegLimit(seg), format->headerSize);
|
||||
AVER(SegBase(seg) <= base);
|
||||
AVER(base <= AddrAdd(SegLimit(seg), format->headerSize));
|
||||
if (base < limit) {
|
||||
if(base < limit) {
|
||||
res = (*format->scan)(ss, base, limit);
|
||||
if (res != ResOK) {
|
||||
if(res != ResOK) {
|
||||
*totalReturn = FALSE;
|
||||
return res;
|
||||
}
|
||||
|
|
@ -1487,18 +1507,18 @@ static void amcFixInPlace(Pool pool, Seg seg, ScanState ss, Ref *refIO)
|
|||
AVER(ref < SegLimit(seg));
|
||||
|
||||
EVENT_0(AMCFixInPlace);
|
||||
if (amcSegHasNailboard(seg)) {
|
||||
if(amcSegHasNailboard(seg)) {
|
||||
Bool wasMarked = amcNailGetAndSetMark(seg, ref);
|
||||
/* If there are no new marks (i.e., no new traces for which we */
|
||||
/* are marking, and no new mark bits set) then we can return */
|
||||
/* immediately, without changing colour. */
|
||||
if (TraceSetSub(ss->traces, SegNailed(seg)) && wasMarked)
|
||||
if(TraceSetSub(ss->traces, SegNailed(seg)) && wasMarked)
|
||||
return;
|
||||
} else if (TraceSetSub(ss->traces, SegNailed(seg))) {
|
||||
} else if(TraceSetSub(ss->traces, SegNailed(seg))) {
|
||||
return;
|
||||
}
|
||||
SegSetNailed(seg, TraceSetUnion(SegNailed(seg), ss->traces));
|
||||
if (SegRankSet(seg) != RankSetEMPTY)
|
||||
if(SegRankSet(seg) != RankSetEMPTY)
|
||||
SegSetGrey(seg, TraceSetUnion(SegGrey(seg), ss->traces));
|
||||
}
|
||||
|
||||
|
|
@ -1525,13 +1545,13 @@ static Res AMCFixEmergency(Pool pool, ScanState ss, Seg seg, Ref *refIO)
|
|||
|
||||
ss->wasMarked = TRUE;
|
||||
|
||||
if (ss->rank == RankAMBIG)
|
||||
if(ss->rank == RankAMBIG)
|
||||
goto fixInPlace;
|
||||
|
||||
ShieldExpose(arena, seg);
|
||||
newRef = (*pool->format->isMoved)(*refIO);
|
||||
ShieldCover(arena, seg);
|
||||
if (newRef != (Addr)0) {
|
||||
if(newRef != (Addr)0) {
|
||||
/* Object has been forwarded already, so snap-out pointer. */
|
||||
/* Useful weak pointer semantics not implemented. @@@@ */
|
||||
*refIO = newRef;
|
||||
|
|
@ -1729,7 +1749,7 @@ static Res AMCHeaderFix(Pool pool, ScanState ss, Seg seg, Ref *refIO)
|
|||
/* If the reference is ambiguous, set up the datastructures for */
|
||||
/* managing a nailed segment. This involves marking the segment */
|
||||
/* as nailed, and setting up a per-word mark table */
|
||||
if (ss->rank == RankAMBIG) {
|
||||
if(ss->rank == RankAMBIG) {
|
||||
/* .nail.new: Check to see whether we need a Nailboard for this seg. */
|
||||
/* We use "SegNailed(seg) == TraceSetEMPTY" rather than */
|
||||
/* "!amcSegHasNailboard(seg)" because this avoids setting up a new */
|
||||
|
|
@ -1737,9 +1757,9 @@ static Res AMCHeaderFix(Pool pool, ScanState ss, Seg seg, Ref *refIO)
|
|||
/* This must be avoided because otherwise assumptions in */
|
||||
/* AMCFixEmergency will be wrong (essentially we will lose some */
|
||||
/* pointer fixes because we introduced a nailboard). */
|
||||
if (SegNailed(seg) == TraceSetEMPTY) {
|
||||
if(SegNailed(seg) == TraceSetEMPTY) {
|
||||
res = amcSegCreateNailboard(seg, pool);
|
||||
if (res != ResOK)
|
||||
if(res != ResOK)
|
||||
return res;
|
||||
++ss->nailCount;
|
||||
SegSetNailed(seg, TraceSetUnion(SegNailed(seg), ss->traces));
|
||||
|
|
@ -1760,20 +1780,20 @@ static Res AMCHeaderFix(Pool pool, ScanState ss, Seg seg, Ref *refIO)
|
|||
newRef = (*format->isMoved)(ref);
|
||||
ShieldCover(arena, seg);
|
||||
|
||||
if (newRef == (Addr)0) {
|
||||
if(newRef == (Addr)0) {
|
||||
/* If object is nailed already then we mustn't copy it: */
|
||||
if (SegNailed(seg) != TraceSetEMPTY
|
||||
&& (!amcSegHasNailboard(seg) || amcNailGetMark(seg, ref))) {
|
||||
if(SegNailed(seg) != TraceSetEMPTY
|
||||
&& (!amcSegHasNailboard(seg) || amcNailGetMark(seg, ref))) {
|
||||
/* Segment only needs greying if there are new traces for which */
|
||||
/* we are nailing. */
|
||||
if (!TraceSetSub(ss->traces, SegNailed(seg))) {
|
||||
if (SegRankSet(seg) != RankSetEMPTY)
|
||||
if(!TraceSetSub(ss->traces, SegNailed(seg))) {
|
||||
if(SegRankSet(seg) != RankSetEMPTY)
|
||||
SegSetGrey(seg, TraceSetUnion(SegGrey(seg), ss->traces));
|
||||
SegSetNailed(seg, TraceSetUnion(SegNailed(seg), ss->traces));
|
||||
}
|
||||
res = ResOK;
|
||||
goto returnRes;
|
||||
} else if (ss->rank == RankWEAK) {
|
||||
} else if(ss->rank == RankWEAK) {
|
||||
/* object is not preserved (neither moved, nor nailed) */
|
||||
/* hence, reference should be splatted */
|
||||
goto updateReference;
|
||||
|
|
@ -1807,12 +1827,12 @@ static Res AMCHeaderFix(Pool pool, ScanState ss, Seg seg, Ref *refIO)
|
|||
/* union the greyness and the summaries together. */
|
||||
grey = TraceSetUnion(ss->traces, SegGrey(seg));
|
||||
toGrey = SegGrey(toSeg);
|
||||
if (TraceSetDiff(grey, toGrey) != TraceSetEMPTY
|
||||
if(TraceSetDiff(grey, toGrey) != TraceSetEMPTY
|
||||
&& SegRankSet(seg) != RankSetEMPTY)
|
||||
SegSetGrey(toSeg, TraceSetUnion(toGrey, grey));
|
||||
summary = SegSummary(seg);
|
||||
toSummary = SegSummary(toSeg);
|
||||
if (RefSetDiff(summary, toSummary) != RefSetEMPTY)
|
||||
if(RefSetDiff(summary, toSummary) != RefSetEMPTY)
|
||||
SegSetSummary(toSeg, RefSetUnion(toSummary, summary));
|
||||
|
||||
/* <design/trace/#fix.copy> */
|
||||
|
|
@ -1978,16 +1998,18 @@ static void AMCWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f,
|
|||
/* may have pointers to old-space. */
|
||||
|
||||
/* NB, segments containing a mix of colours (i.e., nailed segs) */
|
||||
/* are not handled properly: No objects are walked @@@@ */
|
||||
if (SegWhite(seg) == TraceSetEMPTY && SegGrey(seg) == TraceSetEMPTY
|
||||
&& SegNailed(seg) == TraceSetEMPTY) {
|
||||
/* are not handled properly: No objects are walked. See */
|
||||
/* job001682. */
|
||||
if(SegWhite(seg) == TraceSetEMPTY && SegGrey(seg) == TraceSetEMPTY
|
||||
&& SegNailed(seg) == TraceSetEMPTY)
|
||||
{
|
||||
amc = Pool2AMC(pool);
|
||||
AVERT(AMC, amc);
|
||||
format = pool->format;
|
||||
|
||||
/* If the segment is buffered, only walk as far as the end */
|
||||
/* of the initialized objects. cf. AMCScan */
|
||||
if (SegBuffer(seg) != NULL)
|
||||
if(SegBuffer(seg) != NULL)
|
||||
limit = BufferScanLimit(SegBuffer(seg));
|
||||
else
|
||||
limit = SegLimit(seg);
|
||||
|
|
@ -2041,39 +2063,58 @@ static Res AMCDescribe(Pool pool, mps_lib_FILE *stream)
|
|||
Ring node, nextNode;
|
||||
char *rampmode;
|
||||
|
||||
if (!CHECKT(Pool, pool)) return ResFAIL;
|
||||
if(!CHECKT(Pool, pool))
|
||||
return ResFAIL;
|
||||
amc = Pool2AMC(pool);
|
||||
if (!CHECKT(AMC, amc)) return ResFAIL;
|
||||
if (stream == NULL) return ResFAIL;
|
||||
if(!CHECKT(AMC, amc))
|
||||
return ResFAIL;
|
||||
if(stream == NULL)
|
||||
return ResFAIL;
|
||||
|
||||
res = WriteF(stream,
|
||||
(amc->rankSet == RankSetEMPTY) ? "AMCZ" : "AMC",
|
||||
" $P {\n", (WriteFP)amc, " pool $P ($U)\n",
|
||||
(WriteFP)AMC2Pool(amc), (WriteFU)AMC2Pool(amc)->serial,
|
||||
NULL);
|
||||
if (res != ResOK) return res;
|
||||
if(res != ResOK)
|
||||
return res;
|
||||
|
||||
switch(amc->rampMode) {
|
||||
case outsideRamp: rampmode = "outside ramp"; break;
|
||||
case beginRamp: rampmode = "begin ramp"; break;
|
||||
case ramping: rampmode = "ramping"; break;
|
||||
case finishRamp: rampmode = "finish ramp"; break;
|
||||
case collectingRamp: rampmode = "collecting ramp"; break;
|
||||
default: rampmode = "unknown ramp mode"; break;
|
||||
case outsideRamp:
|
||||
rampmode = "outside ramp";
|
||||
break;
|
||||
case beginRamp:
|
||||
rampmode = "begin ramp";
|
||||
break;
|
||||
case ramping:
|
||||
rampmode = "ramping";
|
||||
break;
|
||||
case finishRamp:
|
||||
rampmode = "finish ramp";
|
||||
break;
|
||||
case collectingRamp:
|
||||
rampmode = "collecting ramp";
|
||||
break;
|
||||
default:
|
||||
rampmode = "unknown ramp mode";
|
||||
break;
|
||||
}
|
||||
res = WriteF(stream,
|
||||
" ", rampmode, " ($U)\n", (WriteFU)amc->rampCount,
|
||||
NULL);
|
||||
if (res != ResOK) return res;
|
||||
if(res != ResOK)
|
||||
return res;
|
||||
|
||||
RING_FOR(node, &amc->genRing, nextNode) {
|
||||
amcGen gen = RING_ELT(amcGen, amcRing, node);
|
||||
res = amcGenDescribe(gen, stream);
|
||||
if (res != ResOK) return res;
|
||||
if(res != ResOK)
|
||||
return res;
|
||||
}
|
||||
|
||||
res = WriteF(stream, "} AMC $P\n", (WriteFP)amc, NULL);
|
||||
if (res != ResOK) return res;
|
||||
if(res != ResOK)
|
||||
return res;
|
||||
|
||||
return ResOK;
|
||||
}
|
||||
|
|
@ -2176,7 +2217,9 @@ void mps_amc_apply(mps_pool_t mps_pool,
|
|||
ArenaEnter(arena);
|
||||
AVERT(Pool, pool);
|
||||
|
||||
closure_s.f = f; closure_s.p = p; closure_s.s = s;
|
||||
closure_s.f = f;
|
||||
closure_s.p = p;
|
||||
closure_s.s = s;
|
||||
amcWalkAll(pool, mps_amc_apply_iter, &closure_s, sizeof(closure_s));
|
||||
|
||||
ArenaLeave(arena);
|
||||
|
|
@ -2195,7 +2238,7 @@ static Bool AMCCheck(AMC amc)
|
|||
CHECKL(RankSetCheck(amc->rankSet));
|
||||
CHECKL(RingCheck(&amc->genRing));
|
||||
CHECKL(BoolCheck(amc->gensBooted));
|
||||
if (amc->gensBooted) {
|
||||
if(amc->gensBooted) {
|
||||
CHECKD(amcGen, amc->nursery);
|
||||
CHECKL(amc->gen != NULL);
|
||||
CHECKD(amcGen, amc->rampGen);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue