From 81eca1b2c196a6678fe1cbf3228124ca09e3835d Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 8 Mar 2013 15:13:16 +0000 Subject: Make mps_arena_step suitable for purpose: arenastep now calls tracestartcollectall directly (not via arenastartcollect) so that it no longer unclamps the arena as a side effect. Add test case: steptest now runs with the arena clamped, and checks that mps_arena_step does not unclamp it. Copied from Perforce Change: 181098 ServerID: perforce.ravenbrook.com --- mps/code/global.c | 10 +++++++--- mps/code/steptest.c | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'mps/code') diff --git a/mps/code/global.c b/mps/code/global.c index ed297978d64..2a8ec4e4d3b 100644 --- a/mps/code/global.c +++ b/mps/code/global.c @@ -788,9 +788,13 @@ Bool ArenaStep(Globals globals, double interval, double multiplier) if (arenaShouldCollectWorld(arena, interval, multiplier, start, clocks_per_sec)) { - ArenaStartCollect(globals, TraceStartWhyOPPORTUNISM); - arena->lastWorldCollect = start; - stepped = TRUE; + Res res; + Trace trace; + res = TraceStartCollectAll(&trace, arena, TraceStartWhyOPPORTUNISM); + if (res == ResOK) { + arena->lastWorldCollect = start; + stepped = TRUE; + } } /* loop while there is work to do and time on the clock. */ diff --git a/mps/code/steptest.c b/mps/code/steptest.c index 1905a141037..61ec888801b 100644 --- a/mps/code/steptest.c +++ b/mps/code/steptest.c @@ -9,6 +9,7 @@ #include "fmtdy.h" #include "fmtdytst.h" #include "testlib.h" +#include "mpm.h" #include "mpscamc.h" #include "mpsavm.h" #include "mpstd.h" @@ -278,6 +279,7 @@ static void test_step(mps_arena_t arena, double multiplier) mps_bool_t res; double t1 = my_clock(); res = mps_arena_step(arena, 0.1, multiplier); + cdie(ArenaGlobals(arena)->clamped, "arena was unclamped"); t1 = time_since(t1); if (res) { if (t1 > max_step_time) @@ -500,6 +502,7 @@ int main(int argc, char *argv[]) die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE), "arena_create"); + mps_arena_clamp(arena); die(mps_thread_reg(&thread, arena), "thread_reg"); mps_tramp(&r, test, arena, 0); mps_thread_dereg(thread); -- cgit v1.2.1