diff --git a/mps/code/global.c b/mps/code/global.c index 55bb5013a79..a9090d00372 100644 --- a/mps/code/global.c +++ b/mps/code/global.c @@ -649,19 +649,51 @@ void (ArenaPoll)(Globals globals) #else void ArenaPoll(Globals globals) { - double size; + Arena arena; + Clock start; + Count quanta; + Size tracedSize; + double nextPollThreshold = 0.0; AVERT(Globals, globals); if (globals->clamped) return; - size = globals->fillMutatorSize; - if (globals->insidePoll || size < globals->pollThreshold) + if (globals->insidePoll) + return; + if(globals->fillMutatorSize < globals->pollThreshold) return; globals->insidePoll = TRUE; - (void)ArenaStep(globals, 0.0, 0.0); + /* fillMutatorSize has advanced; call TracePoll enough to catch up. */ + arena = GlobalsArena(globals); + start = ClockNow(); + quanta = 0; + while(globals->pollThreshold <= globals->fillMutatorSize) { + tracedSize = TracePoll(globals); + + if(tracedSize == 0) { + /* No work to do. Sleep until NOW + a bit. */ + nextPollThreshold = globals->fillMutatorSize + ArenaPollALLOCTIME; + } else { + /* We did one quantum of work; consume one unit of 'time'. */ + quanta += 1; + arena->tracedSize += tracedSize; + nextPollThreshold = globals->pollThreshold + ArenaPollALLOCTIME; + } + + /* Advance pollThreshold; check: enough precision? */ + AVER(nextPollThreshold > globals->pollThreshold); + globals->pollThreshold = nextPollThreshold; + } + + /* Don't count time spent checking for work, if there was no work to do. */ + if(quanta > 0) { + arena->tracedTime += (ClockNow() - start) / (double) ClocksPerSec(); + } + + AVER(globals->fillMutatorSize < globals->pollThreshold); globals->insidePoll = FALSE; } @@ -714,7 +746,6 @@ static Bool arenaShouldCollectWorld(Arena arena, Bool ArenaStep(Globals globals, double interval, double multiplier) { - double size; Size scanned; Bool stepped; Clock start, end, now; @@ -756,10 +787,6 @@ Bool ArenaStep(Globals globals, double interval, double multiplier) arena->tracedTime += (now - start) / (double) clocks_per_sec; } - size = globals->fillMutatorSize; - globals->pollThreshold = size + ArenaPollALLOCTIME; - AVER(globals->pollThreshold > size); /* enough precision? */ - return stepped; } diff --git a/mps/code/zcoll.c b/mps/code/zcoll.c index 373e60ec2c3..9bc9e931884 100644 --- a/mps/code/zcoll.c +++ b/mps/code/zcoll.c @@ -704,7 +704,9 @@ int main(int argc, char **argv) /* 16<<20 == 16777216 == 16 Mebibyte */ /* 1<<19 == 524288 == 1/2 Mebibyte */ - testscriptA("Arena(size 524288), Make(keep-1-in 5, keep 50000, rootspace 30000, sizemethod 1), Collect."); + /* This is bogus! sizemethod 1 can make a 300,000-slot dylan vector, ie. 1.2MB. */ + /* Try 100MB arena */ + testscriptA("Arena(size 100000000), Make(keep-1-in 5, keep 50000, rootspace 30000, sizemethod 1), Collect."); /* LSP -- Large Segment Padding (job001811) * diff --git a/mps/tool/test-runner.py b/mps/tool/test-runner.py index 2ca61d35580..d3f5e2df932 100755 --- a/mps/tool/test-runner.py +++ b/mps/tool/test-runner.py @@ -64,7 +64,7 @@ def mpsplatformcode() : # Here, we simplify and get it right for Windows and Macs. try : compiler = {'xc':'gc', - 'w3':'mv', + 'w3':'m9', }[os] except : pass @@ -79,7 +79,7 @@ mpsplatform = mpsplatformcode() make = '' if mpsplatform[4:6] == 'gc' : make = "make -r -f %s.gmk VARIETY=%%s %%s >> %%s" % mpsplatform -elif mpsplatform[4:6] == 'mv' : +elif mpsplatform[4:6] == 'm9' : make = "nmake /f %s.nmk VARIETY=%%s %%s.exe >>%%s" % mpsplatform run = '' @@ -119,6 +119,7 @@ runtestlist([ "awlut", "awluthe", "mpsicv", + "zcoll", "zmess", "messtest", ], ["we", "hi", "di", "ci"], testout)