1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

Update common assertions in the manual.

Convert capacity to bytes once on initialization rather than every time it is used.

Copied from Perforce
 Change: 194612
This commit is contained in:
Gareth Rees 2018-07-11 21:27:47 +01:00
parent c3fd9d5ba7
commit f65c8fdfdb
5 changed files with 10 additions and 9 deletions

View file

@ -107,7 +107,7 @@ Bool GenDescCheck(GenDesc gen)
{
CHECKS(GenDesc, gen);
/* nothing to check for zones */
/* nothing to check for capacity */
CHECKL(gen->capacity > 0);
CHECKL(gen->mortality >= 0.0);
CHECKL(gen->mortality <= 1.0);
CHECKD_NOSIG(Ring, &gen->locusRing);
@ -123,6 +123,7 @@ static Bool GenParamCheck(GenParamStruct *params)
{
CHECKL(params != NULL);
CHECKL(params->capacity > 0);
CHECKL(params->capacity <= SizeMAX / 1024);
CHECKL(params->mortality >= 0.0);
CHECKL(params->mortality <= 1.0);
return TRUE;
@ -139,7 +140,7 @@ static void GenDescInit(GenDesc gen, GenParamStruct *params)
AVER(GenParamCheck(params));
gen->zones = ZoneSetEMPTY;
gen->capacity = params->capacity;
gen->capacity = params->capacity * 1024;
gen->mortality = params->mortality;
RingInit(&gen->locusRing);
RingInit(&gen->segRing);
@ -162,7 +163,7 @@ static void GenDescFinish(GenDesc gen)
gen->sig = SigInvalid;
RingFinish(&gen->locusRing);
RingFinish(&gen->segRing);
AVER(gen->activeTraces == TraceSetEMPTY);
AVER(gen->activeTraces == TraceSetEMPTY); /* <design/check/#.common> */
for (ti = 0; ti < TraceLIMIT; ++ti)
RingFinish(&gen->trace[ti].traceRing);
}
@ -465,7 +466,7 @@ double ChainDeferral(Chain chain)
GenDesc gen = &chain->gens[i];
if (gen->activeTraces != TraceSetEMPTY)
return DBL_MAX;
genTime = gen->capacity * 1024.0 - (double)GenDescNewSize(&chain->gens[i]);
genTime = (double)gen->capacity - (double)GenDescNewSize(&chain->gens[i]);
if (genTime < time)
time = genTime;
}
@ -864,7 +865,7 @@ void LocusInit(Arena arena)
AVER(arena != NULL); /* not initialized yet. */
params.capacity = 1; /* unused */
params.capacity = 1; /* unused since top generation is not on any chain */
params.mortality = 0.5;
GenDescInit(&arena->topGen, &params);

View file

@ -43,7 +43,7 @@ typedef struct GenDescStruct *GenDesc;
typedef struct GenDescStruct {
Sig sig;
ZoneSet zones; /* zoneset for this generation */
Size capacity; /* capacity in kB */
Size capacity; /* capacity in bytes */
double mortality; /* predicted mortality */
RingStruct locusRing; /* Ring of all PoolGen's in this GenDesc (locus) */
RingStruct segRing; /* Ring of GCSegs in this generation */

View file

@ -434,7 +434,7 @@ typedef struct TraceStruct {
Bool firstStretch; /* in first stretch of band (see accessor) */
SegFixMethod fix; /* fix method to apply to references */
void *fixClosure; /* see .ss.fix-closure */
RingStruct genRing; /* ring of generations condemned by trace */
RingStruct genRing; /* ring of generations condemned for trace */
STATISTIC_DECL(Size preTraceArenaReserved) /* ArenaReserved before this trace */
Size condemned; /* condemned bytes */
Size notCondemned; /* collectable but not condemned */

View file

@ -229,7 +229,7 @@ static Res policyCondemnChain(double *mortalityReturn, Chain chain, Trace trace)
-- topCondemnedGen;
gen = &chain->gens[topCondemnedGen];
AVERT(GenDesc, gen);
if (GenDescNewSize(gen) >= gen->capacity * (Size)1024)
if (GenDescNewSize(gen) >= gen->capacity)
break;
}

View file

@ -324,7 +324,7 @@ this documentation.
:term:`stepper functions`.
``locus.c: chain->activeTraces == TraceSetEMPTY``
``locus.c: gen->activeTraces == TraceSetEMPTY``
The client program called :c:func:`mps_chain_destroy`, but there
was a garbage collection in progress on that chain. Park the arena