mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-17 10:27:41 +00:00
Mps br/padding: new pooltraceendmethod: do end-of-trace work
Tracer calls PoolTraceEnd() when the trace is TraceFINISHED. AbstractPoolClass uses PoolTrivTraceEnd -- a NOOP. [mpm.h, mpmst.h, mpmtypes.h, pool.c, poolabs.c] AMC overrides with AMCTraceEnd, to emit diagnostic on how well the trace went! [poolamc.c] Copied from Perforce Change: 168478 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
1c3940b99a
commit
bf80a3a11d
8 changed files with 57 additions and 0 deletions
|
|
@ -46,6 +46,7 @@ struct RuleStruct RulesGlobal[] = {
|
|||
{ "+", "TraceStart", "*", " PoolSum-" },
|
||||
{ "+", "TraceStart", "*", "MutatorSize " }, /* fillMutatorSize, emptyMutatorSize, fillInternalSize, emptyInternalSize */
|
||||
{ "+", "TraceStart", "*", " segs" }, /* amcGen 0..N segs 3, totalSize 49152, newSize 0 */
|
||||
{ "+", "AMCTraceEnd", "*", "*" },
|
||||
/* ----v---- always on please (RHSK) ----v---- */
|
||||
{ "+", "traceSetSignalEmergency", "*", "*" },
|
||||
{ NULL, "", "", "" }
|
||||
|
|
|
|||
|
|
@ -211,6 +211,7 @@ extern Res (PoolFix)(Pool pool, ScanState ss, Seg seg, Addr *refIO);
|
|||
((*(pool)->fix)(pool, ss, seg, refIO))
|
||||
extern void PoolFixEmergency(Pool pool, ScanState ss, Seg seg, Addr *refIO);
|
||||
extern void PoolReclaim(Pool pool, Trace trace, Seg seg);
|
||||
extern void PoolTraceEnd(Pool pool, Trace trace);
|
||||
extern void PoolWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f,
|
||||
void *v, unsigned long s);
|
||||
extern void PoolFreeWalk(Pool pool, FreeBlockStepMethod f, void *p);
|
||||
|
|
@ -250,6 +251,7 @@ extern void PoolTrivBlacken(Pool pool, TraceSet traceSet, Seg seg);
|
|||
extern Res PoolNoScan(Bool *totalReturn, ScanState ss, Pool pool, Seg seg);
|
||||
extern Res PoolNoFix(Pool pool, ScanState ss, Seg seg, Ref *refIO);
|
||||
extern void PoolNoReclaim(Pool pool, Trace trace, Seg seg);
|
||||
extern void PoolTrivTraceEnd(Pool pool, Trace trace);
|
||||
extern void PoolNoRampBegin(Pool pool, Buffer buf, Bool collectAll);
|
||||
extern void PoolTrivRampBegin(Pool pool, Buffer buf, Bool collectAll);
|
||||
extern void PoolNoRampEnd(Pool pool, Buffer buf);
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ typedef struct PoolClassStruct {
|
|||
PoolFixMethod fix; /* referent reachable during tracing */
|
||||
PoolFixEmergencyMethod fixEmergency; /* as fix, no failure allowed */
|
||||
PoolReclaimMethod reclaim; /* reclaim dead objects after tracing */
|
||||
PoolTraceEndMethod traceEnd; /* do end-of-trace work */
|
||||
PoolRampBeginMethod rampBegin;/* begin a ramp pattern */
|
||||
PoolRampEndMethod rampEnd; /* end a ramp pattern */
|
||||
PoolFramePushMethod framePush; /* push an allocation frame */
|
||||
|
|
|
|||
|
|
@ -198,6 +198,7 @@ typedef Res (*PoolFixMethod)(Pool pool, ScanState ss, Seg seg,
|
|||
typedef Res (*PoolFixEmergencyMethod)(Pool pool, ScanState ss,
|
||||
Seg seg, Ref *refIO);
|
||||
typedef void (*PoolReclaimMethod)(Pool pool, Trace trace, Seg seg);
|
||||
typedef void (*PoolTraceEndMethod)(Pool pool, Trace trace);
|
||||
typedef void (*PoolRampBeginMethod)(Pool pool, Buffer buf, Bool collectAll);
|
||||
typedef void (*PoolRampEndMethod)(Pool pool, Buffer buf);
|
||||
typedef Res (*PoolFramePushMethod)(AllocFrame *frameReturn,
|
||||
|
|
|
|||
|
|
@ -461,6 +461,23 @@ void PoolReclaim(Pool pool, Trace trace, Seg seg)
|
|||
}
|
||||
|
||||
|
||||
/* PoolTraceEnd -- do end-of-trace work
|
||||
*
|
||||
* This method is for a pool class to do final end-of-trace work,
|
||||
* after all reclaiming is complete. For example, emitting
|
||||
* diagnostics about what happened during the trace.
|
||||
*/
|
||||
|
||||
void PoolTraceEnd(Pool pool, Trace trace)
|
||||
{
|
||||
AVERT(Pool, pool);
|
||||
AVERT(Trace, trace);
|
||||
AVER(pool->arena == trace->arena);
|
||||
|
||||
(*pool->class->traceEnd)(pool, trace);
|
||||
}
|
||||
|
||||
|
||||
/* PoolWalk -- walk objects in this segment */
|
||||
|
||||
void PoolWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f,
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ DEFINE_CLASS(AbstractPoolClass, class)
|
|||
class->fix = PoolNoFix;
|
||||
class->fixEmergency = PoolNoFix;
|
||||
class->reclaim = PoolNoReclaim;
|
||||
class->traceEnd = PoolTrivTraceEnd;
|
||||
class->rampBegin = PoolNoRampBegin;
|
||||
class->rampEnd = PoolNoRampEnd;
|
||||
class->framePush = PoolNoFramePush;
|
||||
|
|
@ -529,6 +530,13 @@ void PoolNoReclaim(Pool pool, Trace trace, Seg seg)
|
|||
NOTREACHED;
|
||||
}
|
||||
|
||||
void PoolTrivTraceEnd(Pool pool, Trace trace)
|
||||
{
|
||||
AVERT(Pool, pool);
|
||||
AVERT(Trace, trace);
|
||||
NOOP;
|
||||
}
|
||||
|
||||
|
||||
void PoolNoRampBegin(Pool pool, Buffer buf, Bool collectAll)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2232,6 +2232,24 @@ static void AMCReclaim(Pool pool, Trace trace, Seg seg)
|
|||
}
|
||||
|
||||
|
||||
/* AMCTraceEnd -- emit end-of-trace diagnostics
|
||||
*
|
||||
*/
|
||||
static void AMCTraceEnd(Pool pool, Trace trace)
|
||||
{
|
||||
AMC amc;
|
||||
|
||||
AVERT(Pool, pool);
|
||||
amc = Pool2AMC(pool);
|
||||
AVERT(AMC, amc);
|
||||
AVERT(Trace, trace);
|
||||
|
||||
DIAG_SINGLEF(( "AMCTraceEnd",
|
||||
" pool: $P\n", pool,
|
||||
NULL ));
|
||||
}
|
||||
|
||||
|
||||
/* AMCWalk -- Apply function to (black) objects in segment */
|
||||
|
||||
static void AMCWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f,
|
||||
|
|
@ -2424,6 +2442,7 @@ DEFINE_POOL_CLASS(AMCPoolClass, this)
|
|||
this->fix = AMCFix;
|
||||
this->fixEmergency = AMCFixEmergency;
|
||||
this->reclaim = AMCReclaim;
|
||||
this->traceEnd = AMCTraceEnd;
|
||||
this->rampBegin = AMCRampBegin;
|
||||
this->rampEnd = AMCRampEnd;
|
||||
this->walk = AMCWalk;
|
||||
|
|
|
|||
|
|
@ -770,6 +770,7 @@ static void traceReclaim(Trace trace)
|
|||
{
|
||||
Arena arena;
|
||||
Seg seg;
|
||||
Ring node, nextNode;
|
||||
|
||||
AVER(trace->state == TraceRECLAIM);
|
||||
|
||||
|
|
@ -805,6 +806,13 @@ static void traceReclaim(Trace trace)
|
|||
}
|
||||
|
||||
trace->state = TraceFINISHED;
|
||||
|
||||
/* Call each pool's TraceEnd method -- do end-of-trace work */
|
||||
RING_FOR(node, &ArenaGlobals(arena)->poolRing, nextNode) {
|
||||
Pool pool = RING_ELT(Pool, arenaRing, node);
|
||||
PoolTraceEnd(pool, trace);
|
||||
}
|
||||
|
||||
TracePostMessage(trace); /* trace end */
|
||||
/* Immediately pre-allocate messages for next time; failure is okay */
|
||||
(void)TraceIdMessagesCreate(arena, trace->ti);
|
||||
|
|
|
|||
Loading…
Reference in a new issue