From f05a6d8fb72e4ee6d8535bc44e076ec8609eb42d Mon Sep 17 00:00:00 2001 From: Pekka Pirinen Date: Fri, 9 Mar 2001 14:46:34 +0000 Subject: [PATCH] Convert to chains Copied from Perforce Change: 21687 ServerID: perforce.ravenbrook.com --- mps/qa/function/57.c | 80 +++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 42 deletions(-) diff --git a/mps/qa/function/57.c b/mps/qa/function/57.c index 30f94139e7c..28ac4c06348 100644 --- a/mps/qa/function/57.c +++ b/mps/qa/function/57.c @@ -1,6 +1,6 @@ /* TEST_HEADER - id = $HopeName$ + id = $HopeName: MMQA_test_function!57.c(trunk.4) $ summary = use AMC and itself without inactive LO pool language = c link = testlib.o awlfmt.o @@ -9,18 +9,28 @@ END_HEADER #include "testlib.h" #include "mpscamc.h" +#include "mpsavm.h" #include "awlfmt.h" + +#define genCOUNT (3) + +static mps_gen_param_s testChain[genCOUNT] = { + { 6000, 0.90 }, { 8000, 0.65 }, { 16000, 0.50 } }; + + void *stackpointer; + static void test(void) { - mps_space_t space; + mps_arena_t arena; mps_pool_t poolamc; mps_thr_t thread; mps_root_t root; mps_fmt_t format; + mps_chain_t chain; mps_ap_t apamc, apawl; mycell *a, *b, *c, *d, *e, *f, *g; @@ -30,22 +40,19 @@ static void test(void) RC; - cdie(mps_space_create(&space), "create space"); + cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), + "create arena"); - cdie(mps_thread_reg(&thread, space), "register thread"); + die(mps_thread_reg(&thread, arena), "register thread"); + die(mps_root_create_reg(&root, arena, MPS_RANK_AMBIG, 0, thread, + mps_stack_scan_ambig, stackpointer, 0), + "create root"); - cdie( - mps_root_create_reg(&root, space, MPS_RANK_AMBIG, 0, thread, - mps_stack_scan_ambig, stackpointer, 0), - "create root"); + die(mps_fmt_create_A(&format, arena, &fmtA), "create format"); + cdie(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create"); - cdie( - mps_fmt_create_A(&format, space, &fmtA), - "create format"); - - cdie( - mps_pool_create(&poolamc, space, mps_class_amc(), format), - "create pool"); + die(mmqa_pool_create_chain(&poolamc, arena, mps_class_amc(), format, chain), + "create pool(amc)"); cdie( mps_ap_create(&apawl, poolamc, MPS_RANK_EXACT), @@ -53,12 +60,11 @@ static void test(void) cdie( mps_ap_create(&apamc, poolamc, MPS_RANK_EXACT), - "create ap"); + "create ap(amc)"); b = allocone(apamc, 1, 1); - for (j=1; j<100; j++) - { + for (j = 1; j < 100; j++) { comment("%i of 100.", j); UC; a = allocone(apamc, 5, 1); @@ -69,52 +75,42 @@ static void test(void) f = a; g = a; - for (i=1; i<5000; i++) - { - UC; + for (i = 1; i < 5000; i++) { + UC; c = allocone(apamc, 20, 1); d = allocone(apawl, 20, 1); if (ranint(8) == 0) e = c; if (ranint(8) == 0) f = c; if (ranint(8) == 0) g = c; - UC; + UC; setref(b, 0, c); - UC; + UC; setref(c, 1, d); - UC; + UC; setref(c, 2, e); - UC; + UC; setref(c, 3, f); - UC; + UC; setref(c, 4, g); - UC; + UC; b = c; } - DC; - DMC; + DC; + DMC; } mps_ap_destroy(apawl); mps_ap_destroy(apamc); - comment("Destroyed aps."); - mps_pool_destroy(poolamc); - comment("Destroyed pools."); - + mps_chain_destroy(chain); mps_fmt_destroy(format); - comment("Destroyed format."); - mps_root_destroy(root); - comment("Destroyed root."); - mps_thread_dereg(thread); - comment("Deregistered thread."); - - mps_space_destroy(space); - comment("Destroyed space."); - + mps_arena_destroy(arena); + comment("Destroyed arena."); } + int main(void) { void *m;