diff --git a/mps/src/poolamc.c b/mps/src/poolamc.c index 8557299dfb7..b8e4fa01eb3 100644 --- a/mps/src/poolamc.c +++ b/mps/src/poolamc.c @@ -1,6 +1,6 @@ /* impl.c.poolamc: AUTOMATIC MOSTLY-COPYING MEMORY POOL CLASS * - * $HopeName: MMsrc!poolamc.c(trunk.41) $ + * $HopeName: MMsrc!poolamc.c(trunk.42) $ * Copyright (C) 2000 Harlequin Limited. All rights reserved. * * .sources: design.mps.poolamc. @@ -9,7 +9,7 @@ #include "mpscamc.h" #include "mpm.h" -SRCID(poolamc, "$HopeName: MMsrc!poolamc.c(trunk.41) $"); +SRCID(poolamc, "$HopeName: MMsrc!poolamc.c(trunk.42) $"); /* PType enumeration -- distinguishes AMCGen and AMCNailBoard */ @@ -1144,6 +1144,10 @@ static Res AMCWhiten(Pool pool, Trace trace, Seg seg) } } + /* .act.survivors: Whiten inits survivors; Reclaim will decrement it. */ + /* .stop.restart: Stops AMCBenefit from trying to restart the trace. */ + gen->survivors = gen->size; + return ResOK; } @@ -1283,24 +1287,18 @@ static Res AMCAct(Pool pool, Action action) res = amcCondemnGens(amc, trace, topCondemnedGenSerial); if (res != ResOK) goto failCondemn; - /* .act.survivors: Act inits survivors; Reclaim will decrement it. */ - /* .stop.restart: Stops AMCBenefit from trying to restart the trace. */ - currGenSerial = 0; - do { - gen = amc->gen[currGenSerial]; - AVERT(AMCGen, gen); - gen->survivors = gen->size; - if (currGenSerial == topCondemnedGenSerial) break; - currGenSerial = AMCGenNext(amc, currGenSerial); - } while (TRUE); if (topCondemnedGenSerial != TraceTopGen) { TraceStart(trace, TraceEphemeralMortality, (TraceGen0IncrementalityMultiple * TraceGen0Size * 1024uL)); } else { - TraceStart(trace, TraceTopGenMortality, - amcArenaAvail(arena) - - trace->condemned * (1 - TraceTopGenMortality)); + double finishingTime = amcArenaAvail(arena) + - trace->condemned * (1.0 - TraceTopGenMortality); + + if (finishingTime < 0) + /* Run out of time, should really try a smaller collection. @@@@ */ + finishingTime = 0.0; + TraceStart(trace, TraceTopGenMortality, finishingTime); } return ResOK;