mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-03 10:31:37 -08:00
Catch-up merge from master sources @185999 to branch/2014-04-17/describe.
Copied from Perforce Change: 186003 ServerID: perforce.ravenbrook.com
This commit is contained in:
commit
30f37732a9
63 changed files with 570 additions and 482 deletions
102
mps/code/locus.c
102
mps/code/locus.c
|
|
@ -80,6 +80,7 @@ void SegPrefExpress(SegPref pref, SegPrefKind kind, void *p)
|
|||
|
||||
/* GenDescCheck -- check a GenDesc */
|
||||
|
||||
ATTRIBUTE_UNUSED
|
||||
static Bool GenDescCheck(GenDesc gen)
|
||||
{
|
||||
CHECKS(GenDesc, gen);
|
||||
|
|
@ -317,13 +318,21 @@ Res ChainAlloc(Seg *segReturn, Chain chain, Serial genNr, SegClass class,
|
|||
|
||||
double ChainDeferral(Chain chain)
|
||||
{
|
||||
double time = DBL_MAX;
|
||||
size_t i;
|
||||
|
||||
AVERT(Chain, chain);
|
||||
|
||||
if (chain->activeTraces != TraceSetEMPTY)
|
||||
return DBL_MAX;
|
||||
else
|
||||
return chain->gens[0].capacity * 1024.0
|
||||
- (double)GenDescNewSize(&chain->gens[0]);
|
||||
if (chain->activeTraces == TraceSetEMPTY) {
|
||||
for (i = 0; i < chain->genCount; ++i) {
|
||||
double genTime = chain->gens[i].capacity * 1024.0
|
||||
- (double)GenDescNewSize(&chain->gens[i]);
|
||||
if (genTime < time)
|
||||
time = genTime;
|
||||
}
|
||||
}
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -336,7 +345,7 @@ double ChainDeferral(Chain chain)
|
|||
Res ChainCondemnAuto(double *mortalityReturn, Chain chain, Trace trace)
|
||||
{
|
||||
Res res;
|
||||
Serial topCondemnedGenSerial, currGenSerial;
|
||||
size_t topCondemnedGen, i;
|
||||
GenDesc gen;
|
||||
ZoneSet condemnedSet = ZoneSetEMPTY;
|
||||
Size condemnedSize = 0, survivorSize = 0, genNewSize, genTotalSize;
|
||||
|
|
@ -344,33 +353,39 @@ Res ChainCondemnAuto(double *mortalityReturn, Chain chain, Trace trace)
|
|||
AVERT(Chain, chain);
|
||||
AVERT(Trace, trace);
|
||||
|
||||
/* Find lowest gen within its capacity, set topCondemnedGenSerial to the */
|
||||
/* preceeding one. */
|
||||
currGenSerial = 0;
|
||||
gen = &chain->gens[0];
|
||||
AVERT(GenDesc, gen);
|
||||
genNewSize = GenDescNewSize(gen);
|
||||
do { /* At this point, we've decided to collect currGenSerial. */
|
||||
topCondemnedGenSerial = currGenSerial;
|
||||
/* Find the highest generation that's over capacity. We will condemn
|
||||
* this and all lower generations in the chain. */
|
||||
topCondemnedGen = chain->genCount;
|
||||
for (;;) {
|
||||
/* It's an error to call this function unless some generation is
|
||||
* over capacity as reported by ChainDeferral. */
|
||||
AVER(topCondemnedGen > 0);
|
||||
if (topCondemnedGen == 0)
|
||||
return ResFAIL;
|
||||
-- topCondemnedGen;
|
||||
gen = &chain->gens[topCondemnedGen];
|
||||
AVERT(GenDesc, gen);
|
||||
genNewSize = GenDescNewSize(gen);
|
||||
if (genNewSize >= gen->capacity * (Size)1024)
|
||||
break;
|
||||
}
|
||||
|
||||
/* At this point, we've decided to condemn topCondemnedGen and all
|
||||
* lower generations. */
|
||||
for (i = 0; i <= topCondemnedGen; ++i) {
|
||||
gen = &chain->gens[i];
|
||||
AVERT(GenDesc, gen);
|
||||
condemnedSet = ZoneSetUnion(condemnedSet, gen->zones);
|
||||
genTotalSize = GenDescTotalSize(gen);
|
||||
genNewSize = GenDescNewSize(gen);
|
||||
condemnedSize += genTotalSize;
|
||||
survivorSize += (Size)(genNewSize * (1.0 - gen->mortality))
|
||||
/* predict survivors will survive again */
|
||||
+ (genTotalSize - genNewSize);
|
||||
|
||||
/* is there another one to consider? */
|
||||
currGenSerial += 1;
|
||||
if (currGenSerial >= chain->genCount)
|
||||
break; /* reached the top */
|
||||
gen = &chain->gens[currGenSerial];
|
||||
AVERT(GenDesc, gen);
|
||||
genNewSize = GenDescNewSize(gen);
|
||||
} while (genNewSize >= gen->capacity * (Size)1024);
|
||||
}
|
||||
|
||||
AVER(condemnedSet != ZoneSetEMPTY || condemnedSize == 0);
|
||||
EVENT3(ChainCondemnAuto, chain, topCondemnedGenSerial, chain->genCount);
|
||||
UNUSED(topCondemnedGenSerial); /* only used for EVENT */
|
||||
EVENT3(ChainCondemnAuto, chain, topCondemnedGen, chain->genCount);
|
||||
|
||||
/* Condemn everything in these zones. */
|
||||
if (condemnedSet != ZoneSetEMPTY) {
|
||||
|
|
@ -384,41 +399,6 @@ Res ChainCondemnAuto(double *mortalityReturn, Chain chain, Trace trace)
|
|||
}
|
||||
|
||||
|
||||
/* ChainCondemnAll -- condemn everything in the chain */
|
||||
|
||||
Res ChainCondemnAll(Chain chain, Trace trace)
|
||||
{
|
||||
Ring node, nextNode;
|
||||
Bool haveWhiteSegs = FALSE;
|
||||
Res res;
|
||||
|
||||
/* Condemn every segment in every pool using this chain. */
|
||||
/* Finds the pools by iterating over the PoolGens in gen 0. */
|
||||
RING_FOR(node, &chain->gens[0].locusRing, nextNode) {
|
||||
PoolGen nursery = RING_ELT(PoolGen, genRing, node);
|
||||
Pool pool = nursery->pool;
|
||||
Ring segNode, nextSegNode;
|
||||
|
||||
AVERT(Pool, pool);
|
||||
AVER(PoolHasAttr(pool, AttrGC));
|
||||
RING_FOR(segNode, PoolSegRing(pool), nextSegNode) {
|
||||
Seg seg = SegOfPoolRing(segNode);
|
||||
|
||||
res = TraceAddWhite(trace, seg);
|
||||
if (res != ResOK)
|
||||
goto failBegin;
|
||||
haveWhiteSegs = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return ResOK;
|
||||
|
||||
failBegin:
|
||||
AVER(!haveWhiteSegs); /* Would leave white sets inconsistent. */
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/* ChainStartGC -- called to notify start of GC for this chain */
|
||||
|
||||
void ChainStartGC(Chain chain, Trace trace)
|
||||
|
|
@ -475,9 +455,11 @@ Res ChainDescribe(Chain chain, mps_lib_FILE *stream, Count depth)
|
|||
Res PoolGenInit(PoolGen gen, Chain chain, Serial nr, Pool pool)
|
||||
{
|
||||
/* Can't check gen, because it's not been initialized. */
|
||||
AVER(gen != NULL);
|
||||
AVERT(Chain, chain);
|
||||
AVER(nr <= chain->genCount);
|
||||
AVERT(Pool, pool);
|
||||
AVER(PoolHasAttr(pool, AttrGC));
|
||||
|
||||
gen->nr = nr;
|
||||
gen->pool = pool;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue