diff options
Diffstat (limited to 'mps/code')
| -rw-r--r-- | mps/code/diag.c | 1 | ||||
| -rw-r--r-- | mps/code/mpm.h | 2 | ||||
| -rw-r--r-- | mps/code/mpmst.h | 1 | ||||
| -rw-r--r-- | mps/code/mpmtypes.h | 1 | ||||
| -rw-r--r-- | mps/code/pool.c | 17 | ||||
| -rw-r--r-- | mps/code/poolabs.c | 8 | ||||
| -rw-r--r-- | mps/code/poolamc.c | 19 | ||||
| -rw-r--r-- | mps/code/trace.c | 8 |
8 files changed, 57 insertions, 0 deletions
diff --git a/mps/code/diag.c b/mps/code/diag.c index 45d473ddf09..9ee4deb0ada 100644 --- a/mps/code/diag.c +++ b/mps/code/diag.c | |||
| @@ -46,6 +46,7 @@ struct RuleStruct RulesGlobal[] = { | |||
| 46 | { "+", "TraceStart", "*", " PoolSum-" }, | 46 | { "+", "TraceStart", "*", " PoolSum-" }, |
| 47 | { "+", "TraceStart", "*", "MutatorSize " }, /* fillMutatorSize, emptyMutatorSize, fillInternalSize, emptyInternalSize */ | 47 | { "+", "TraceStart", "*", "MutatorSize " }, /* fillMutatorSize, emptyMutatorSize, fillInternalSize, emptyInternalSize */ |
| 48 | { "+", "TraceStart", "*", " segs" }, /* amcGen 0..N segs 3, totalSize 49152, newSize 0 */ | 48 | { "+", "TraceStart", "*", " segs" }, /* amcGen 0..N segs 3, totalSize 49152, newSize 0 */ |
| 49 | { "+", "AMCTraceEnd", "*", "*" }, | ||
| 49 | /* ----v---- always on please (RHSK) ----v---- */ | 50 | /* ----v---- always on please (RHSK) ----v---- */ |
| 50 | { "+", "traceSetSignalEmergency", "*", "*" }, | 51 | { "+", "traceSetSignalEmergency", "*", "*" }, |
| 51 | { NULL, "", "", "" } | 52 | { NULL, "", "", "" } |
diff --git a/mps/code/mpm.h b/mps/code/mpm.h index 1ca74e6ffd7..b4189afadcd 100644 --- a/mps/code/mpm.h +++ b/mps/code/mpm.h | |||
| @@ -211,6 +211,7 @@ extern Res (PoolFix)(Pool pool, ScanState ss, Seg seg, Addr *refIO); | |||
| 211 | ((*(pool)->fix)(pool, ss, seg, refIO)) | 211 | ((*(pool)->fix)(pool, ss, seg, refIO)) |
| 212 | extern void PoolFixEmergency(Pool pool, ScanState ss, Seg seg, Addr *refIO); | 212 | extern void PoolFixEmergency(Pool pool, ScanState ss, Seg seg, Addr *refIO); |
| 213 | extern void PoolReclaim(Pool pool, Trace trace, Seg seg); | 213 | extern void PoolReclaim(Pool pool, Trace trace, Seg seg); |
| 214 | extern void PoolTraceEnd(Pool pool, Trace trace); | ||
| 214 | extern void PoolWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f, | 215 | extern void PoolWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f, |
| 215 | void *v, unsigned long s); | 216 | void *v, unsigned long s); |
| 216 | extern void PoolFreeWalk(Pool pool, FreeBlockStepMethod f, void *p); | 217 | extern void PoolFreeWalk(Pool pool, FreeBlockStepMethod f, void *p); |
| @@ -250,6 +251,7 @@ extern void PoolTrivBlacken(Pool pool, TraceSet traceSet, Seg seg); | |||
| 250 | extern Res PoolNoScan(Bool *totalReturn, ScanState ss, Pool pool, Seg seg); | 251 | extern Res PoolNoScan(Bool *totalReturn, ScanState ss, Pool pool, Seg seg); |
| 251 | extern Res PoolNoFix(Pool pool, ScanState ss, Seg seg, Ref *refIO); | 252 | extern Res PoolNoFix(Pool pool, ScanState ss, Seg seg, Ref *refIO); |
| 252 | extern void PoolNoReclaim(Pool pool, Trace trace, Seg seg); | 253 | extern void PoolNoReclaim(Pool pool, Trace trace, Seg seg); |
| 254 | extern void PoolTrivTraceEnd(Pool pool, Trace trace); | ||
| 253 | extern void PoolNoRampBegin(Pool pool, Buffer buf, Bool collectAll); | 255 | extern void PoolNoRampBegin(Pool pool, Buffer buf, Bool collectAll); |
| 254 | extern void PoolTrivRampBegin(Pool pool, Buffer buf, Bool collectAll); | 256 | extern void PoolTrivRampBegin(Pool pool, Buffer buf, Bool collectAll); |
| 255 | extern void PoolNoRampEnd(Pool pool, Buffer buf); | 257 | extern void PoolNoRampEnd(Pool pool, Buffer buf); |
diff --git a/mps/code/mpmst.h b/mps/code/mpmst.h index e0a76f9bf0c..eeafab47fdc 100644 --- a/mps/code/mpmst.h +++ b/mps/code/mpmst.h | |||
| @@ -66,6 +66,7 @@ typedef struct PoolClassStruct { | |||
| 66 | PoolFixMethod fix; /* referent reachable during tracing */ | 66 | PoolFixMethod fix; /* referent reachable during tracing */ |
| 67 | PoolFixEmergencyMethod fixEmergency; /* as fix, no failure allowed */ | 67 | PoolFixEmergencyMethod fixEmergency; /* as fix, no failure allowed */ |
| 68 | PoolReclaimMethod reclaim; /* reclaim dead objects after tracing */ | 68 | PoolReclaimMethod reclaim; /* reclaim dead objects after tracing */ |
| 69 | PoolTraceEndMethod traceEnd; /* do end-of-trace work */ | ||
| 69 | PoolRampBeginMethod rampBegin;/* begin a ramp pattern */ | 70 | PoolRampBeginMethod rampBegin;/* begin a ramp pattern */ |
| 70 | PoolRampEndMethod rampEnd; /* end a ramp pattern */ | 71 | PoolRampEndMethod rampEnd; /* end a ramp pattern */ |
| 71 | PoolFramePushMethod framePush; /* push an allocation frame */ | 72 | PoolFramePushMethod framePush; /* push an allocation frame */ |
diff --git a/mps/code/mpmtypes.h b/mps/code/mpmtypes.h index bd232110349..fd27f8c2a80 100644 --- a/mps/code/mpmtypes.h +++ b/mps/code/mpmtypes.h | |||
| @@ -198,6 +198,7 @@ typedef Res (*PoolFixMethod)(Pool pool, ScanState ss, Seg seg, | |||
| 198 | typedef Res (*PoolFixEmergencyMethod)(Pool pool, ScanState ss, | 198 | typedef Res (*PoolFixEmergencyMethod)(Pool pool, ScanState ss, |
| 199 | Seg seg, Ref *refIO); | 199 | Seg seg, Ref *refIO); |
| 200 | typedef void (*PoolReclaimMethod)(Pool pool, Trace trace, Seg seg); | 200 | typedef void (*PoolReclaimMethod)(Pool pool, Trace trace, Seg seg); |
| 201 | typedef void (*PoolTraceEndMethod)(Pool pool, Trace trace); | ||
| 201 | typedef void (*PoolRampBeginMethod)(Pool pool, Buffer buf, Bool collectAll); | 202 | typedef void (*PoolRampBeginMethod)(Pool pool, Buffer buf, Bool collectAll); |
| 202 | typedef void (*PoolRampEndMethod)(Pool pool, Buffer buf); | 203 | typedef void (*PoolRampEndMethod)(Pool pool, Buffer buf); |
| 203 | typedef Res (*PoolFramePushMethod)(AllocFrame *frameReturn, | 204 | typedef Res (*PoolFramePushMethod)(AllocFrame *frameReturn, |
diff --git a/mps/code/pool.c b/mps/code/pool.c index 05045b3f309..e92106128c3 100644 --- a/mps/code/pool.c +++ b/mps/code/pool.c | |||
| @@ -461,6 +461,23 @@ void PoolReclaim(Pool pool, Trace trace, Seg seg) | |||
| 461 | } | 461 | } |
| 462 | 462 | ||
| 463 | 463 | ||
| 464 | /* PoolTraceEnd -- do end-of-trace work | ||
| 465 | * | ||
| 466 | * This method is for a pool class to do final end-of-trace work, | ||
| 467 | * after all reclaiming is complete. For example, emitting | ||
| 468 | * diagnostics about what happened during the trace. | ||
| 469 | */ | ||
| 470 | |||
| 471 | void PoolTraceEnd(Pool pool, Trace trace) | ||
| 472 | { | ||
| 473 | AVERT(Pool, pool); | ||
| 474 | AVERT(Trace, trace); | ||
| 475 | AVER(pool->arena == trace->arena); | ||
| 476 | |||
| 477 | (*pool->class->traceEnd)(pool, trace); | ||
| 478 | } | ||
| 479 | |||
| 480 | |||
| 464 | /* PoolWalk -- walk objects in this segment */ | 481 | /* PoolWalk -- walk objects in this segment */ |
| 465 | 482 | ||
| 466 | void PoolWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f, | 483 | void PoolWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f, |
diff --git a/mps/code/poolabs.c b/mps/code/poolabs.c index 3e52dc63c14..324975cb7c0 100644 --- a/mps/code/poolabs.c +++ b/mps/code/poolabs.c | |||
| @@ -136,6 +136,7 @@ DEFINE_CLASS(AbstractPoolClass, class) | |||
| 136 | class->fix = PoolNoFix; | 136 | class->fix = PoolNoFix; |
| 137 | class->fixEmergency = PoolNoFix; | 137 | class->fixEmergency = PoolNoFix; |
| 138 | class->reclaim = PoolNoReclaim; | 138 | class->reclaim = PoolNoReclaim; |
| 139 | class->traceEnd = PoolTrivTraceEnd; | ||
| 139 | class->rampBegin = PoolNoRampBegin; | 140 | class->rampBegin = PoolNoRampBegin; |
| 140 | class->rampEnd = PoolNoRampEnd; | 141 | class->rampEnd = PoolNoRampEnd; |
| 141 | class->framePush = PoolNoFramePush; | 142 | class->framePush = PoolNoFramePush; |
| @@ -529,6 +530,13 @@ void PoolNoReclaim(Pool pool, Trace trace, Seg seg) | |||
| 529 | NOTREACHED; | 530 | NOTREACHED; |
| 530 | } | 531 | } |
| 531 | 532 | ||
| 533 | void PoolTrivTraceEnd(Pool pool, Trace trace) | ||
| 534 | { | ||
| 535 | AVERT(Pool, pool); | ||
| 536 | AVERT(Trace, trace); | ||
| 537 | NOOP; | ||
| 538 | } | ||
| 539 | |||
| 532 | 540 | ||
| 533 | void PoolNoRampBegin(Pool pool, Buffer buf, Bool collectAll) | 541 | void PoolNoRampBegin(Pool pool, Buffer buf, Bool collectAll) |
| 534 | { | 542 | { |
diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c index 02984e08c12..6c3a3da4d99 100644 --- a/mps/code/poolamc.c +++ b/mps/code/poolamc.c | |||
| @@ -2232,6 +2232,24 @@ static void AMCReclaim(Pool pool, Trace trace, Seg seg) | |||
| 2232 | } | 2232 | } |
| 2233 | 2233 | ||
| 2234 | 2234 | ||
| 2235 | /* AMCTraceEnd -- emit end-of-trace diagnostics | ||
| 2236 | * | ||
| 2237 | */ | ||
| 2238 | static void AMCTraceEnd(Pool pool, Trace trace) | ||
| 2239 | { | ||
| 2240 | AMC amc; | ||
| 2241 | |||
| 2242 | AVERT(Pool, pool); | ||
| 2243 | amc = Pool2AMC(pool); | ||
| 2244 | AVERT(AMC, amc); | ||
| 2245 | AVERT(Trace, trace); | ||
| 2246 | |||
| 2247 | DIAG_SINGLEF(( "AMCTraceEnd", | ||
| 2248 | " pool: $P\n", pool, | ||
| 2249 | NULL )); | ||
| 2250 | } | ||
| 2251 | |||
| 2252 | |||
| 2235 | /* AMCWalk -- Apply function to (black) objects in segment */ | 2253 | /* AMCWalk -- Apply function to (black) objects in segment */ |
| 2236 | 2254 | ||
| 2237 | static void AMCWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f, | 2255 | static void AMCWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f, |
| @@ -2424,6 +2442,7 @@ DEFINE_POOL_CLASS(AMCPoolClass, this) | |||
| 2424 | this->fix = AMCFix; | 2442 | this->fix = AMCFix; |
| 2425 | this->fixEmergency = AMCFixEmergency; | 2443 | this->fixEmergency = AMCFixEmergency; |
| 2426 | this->reclaim = AMCReclaim; | 2444 | this->reclaim = AMCReclaim; |
| 2445 | this->traceEnd = AMCTraceEnd; | ||
| 2427 | this->rampBegin = AMCRampBegin; | 2446 | this->rampBegin = AMCRampBegin; |
| 2428 | this->rampEnd = AMCRampEnd; | 2447 | this->rampEnd = AMCRampEnd; |
| 2429 | this->walk = AMCWalk; | 2448 | this->walk = AMCWalk; |
diff --git a/mps/code/trace.c b/mps/code/trace.c index 1082eaefe78..ff13b6180a9 100644 --- a/mps/code/trace.c +++ b/mps/code/trace.c | |||
| @@ -770,6 +770,7 @@ static void traceReclaim(Trace trace) | |||
| 770 | { | 770 | { |
| 771 | Arena arena; | 771 | Arena arena; |
| 772 | Seg seg; | 772 | Seg seg; |
| 773 | Ring node, nextNode; | ||
| 773 | 774 | ||
| 774 | AVER(trace->state == TraceRECLAIM); | 775 | AVER(trace->state == TraceRECLAIM); |
| 775 | 776 | ||
| @@ -805,6 +806,13 @@ static void traceReclaim(Trace trace) | |||
| 805 | } | 806 | } |
| 806 | 807 | ||
| 807 | trace->state = TraceFINISHED; | 808 | trace->state = TraceFINISHED; |
| 809 | |||
| 810 | /* Call each pool's TraceEnd method -- do end-of-trace work */ | ||
| 811 | RING_FOR(node, &ArenaGlobals(arena)->poolRing, nextNode) { | ||
| 812 | Pool pool = RING_ELT(Pool, arenaRing, node); | ||
| 813 | PoolTraceEnd(pool, trace); | ||
| 814 | } | ||
| 815 | |||
| 808 | TracePostMessage(trace); /* trace end */ | 816 | TracePostMessage(trace); /* trace end */ |
| 809 | /* Immediately pre-allocate messages for next time; failure is okay */ | 817 | /* Immediately pre-allocate messages for next time; failure is okay */ |
| 810 | (void)TraceIdMessagesCreate(arena, trace->ti); | 818 | (void)TraceIdMessagesCreate(arena, trace->ti); |