diff options
| author | Gareth Rees | 2013-03-08 15:13:16 +0000 |
|---|---|---|
| committer | Gareth Rees | 2013-03-08 15:13:16 +0000 |
| commit | 81eca1b2c196a6678fe1cbf3228124ca09e3835d (patch) | |
| tree | 1ab10b8d65d1257331a09f77bf1ad03a773a184c /mps/code | |
| parent | 2dd7d8f59982678082ecacb85402927b8dec77b5 (diff) | |
| download | emacs-81eca1b2c196a6678fe1cbf3228124ca09e3835d.tar.gz emacs-81eca1b2c196a6678fe1cbf3228124ca09e3835d.zip | |
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
Diffstat (limited to 'mps/code')
| -rw-r--r-- | mps/code/global.c | 10 | ||||
| -rw-r--r-- | mps/code/steptest.c | 3 |
2 files changed, 10 insertions, 3 deletions
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) | |||
| 788 | if (arenaShouldCollectWorld(arena, interval, multiplier, | 788 | if (arenaShouldCollectWorld(arena, interval, multiplier, |
| 789 | start, clocks_per_sec)) | 789 | start, clocks_per_sec)) |
| 790 | { | 790 | { |
| 791 | ArenaStartCollect(globals, TraceStartWhyOPPORTUNISM); | 791 | Res res; |
| 792 | arena->lastWorldCollect = start; | 792 | Trace trace; |
| 793 | stepped = TRUE; | 793 | res = TraceStartCollectAll(&trace, arena, TraceStartWhyOPPORTUNISM); |
| 794 | if (res == ResOK) { | ||
| 795 | arena->lastWorldCollect = start; | ||
| 796 | stepped = TRUE; | ||
| 797 | } | ||
| 794 | } | 798 | } |
| 795 | 799 | ||
| 796 | /* loop while there is work to do and time on the clock. */ | 800 | /* 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 @@ | |||
| 9 | #include "fmtdy.h" | 9 | #include "fmtdy.h" |
| 10 | #include "fmtdytst.h" | 10 | #include "fmtdytst.h" |
| 11 | #include "testlib.h" | 11 | #include "testlib.h" |
| 12 | #include "mpm.h" | ||
| 12 | #include "mpscamc.h" | 13 | #include "mpscamc.h" |
| 13 | #include "mpsavm.h" | 14 | #include "mpsavm.h" |
| 14 | #include "mpstd.h" | 15 | #include "mpstd.h" |
| @@ -278,6 +279,7 @@ static void test_step(mps_arena_t arena, double multiplier) | |||
| 278 | mps_bool_t res; | 279 | mps_bool_t res; |
| 279 | double t1 = my_clock(); | 280 | double t1 = my_clock(); |
| 280 | res = mps_arena_step(arena, 0.1, multiplier); | 281 | res = mps_arena_step(arena, 0.1, multiplier); |
| 282 | cdie(ArenaGlobals(arena)->clamped, "arena was unclamped"); | ||
| 281 | t1 = time_since(t1); | 283 | t1 = time_since(t1); |
| 282 | if (res) { | 284 | if (res) { |
| 283 | if (t1 > max_step_time) | 285 | if (t1 > max_step_time) |
| @@ -500,6 +502,7 @@ int main(int argc, char *argv[]) | |||
| 500 | die(mps_arena_create(&arena, mps_arena_class_vm(), | 502 | die(mps_arena_create(&arena, mps_arena_class_vm(), |
| 501 | testArenaSIZE), | 503 | testArenaSIZE), |
| 502 | "arena_create"); | 504 | "arena_create"); |
| 505 | mps_arena_clamp(arena); | ||
| 503 | die(mps_thread_reg(&thread, arena), "thread_reg"); | 506 | die(mps_thread_reg(&thread, arena), "thread_reg"); |
| 504 | mps_tramp(&r, test, arena, 0); | 507 | mps_tramp(&r, test, arena, 0); |
| 505 | mps_thread_dereg(thread); | 508 | mps_thread_dereg(thread); |