From b60a1636fc9911bc66fee2a6fafafd5649cae151 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 13 Jul 2018 20:56:08 +0100 Subject: [PATCH] Fix the mortality of the world to avoid runaway feedback between the dynamic criterion and the mortality of the arena's top generation as described in . Copied from Perforce Change: 194648 --- mps/code/policy.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mps/code/policy.c b/mps/code/policy.c index 51c2ee8f110..e44f67ad9fa 100644 --- a/mps/code/policy.c +++ b/mps/code/policy.c @@ -265,6 +265,11 @@ Bool PolicyStartTrace(Trace *traceReturn, Bool *collectWorldReturn, Res res; Trace trace; double TraceWorkFactor = 0.25; + /* Fix the mortality of the world to avoid runaway feedback between the + dynamic criterion and the mortality of the arena's top generation, + leading to all traces collecting the world. This is a (hopefully) + temporary hack, pending an improved scheduling algorithm. */ + double TraceWorldMortality = 0.5; AVER(traceReturn != NULL); AVERT(Arena, arena); @@ -278,7 +283,7 @@ Bool PolicyStartTrace(Trace *traceReturn, Bool *collectWorldReturn, sFoundation = (Size)0; /* condemning everything, only roots @@@@ */ /* @@@@ sCondemned should be scannable only */ sCondemned = ArenaCommitted(arena) - ArenaSpareCommitted(arena); - sSurvivors = (Size)(sCondemned * (1 - arena->topGen.mortality)); + sSurvivors = (Size)(sCondemned * (1 - TraceWorldMortality)); tTracePerScan = sFoundation + (sSurvivors * (1 + TraceCopyScanRATIO)); AVER(TraceWorkFactor >= 0); AVER(sSurvivors + tTracePerScan * TraceWorkFactor <= (double)SizeMAX);