From 7c08211b405229eee5df978d463a7c512c5490a3 Mon Sep 17 00:00:00 2001 From: Pekka Pirinen Date: Wed, 7 Mar 2001 17:11:00 +0000 Subject: [PATCH] Convert to chains Copied from Perforce Change: 21671 ServerID: perforce.ravenbrook.com --- mps/qa/function/19.c | 45 +++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/mps/qa/function/19.c b/mps/qa/function/19.c index 4641f4eb6a2..314836967f2 100644 --- a/mps/qa/function/19.c +++ b/mps/qa/function/19.c @@ -1,6 +1,6 @@ /* TEST_HEADER - id = $HopeName$ + id = $HopeName: MMQA_test_function!19.c(trunk.5) $ summary = create lots of aps at once (and cause to run out of memory) language = c link = testlib.o newfmt.o @@ -12,46 +12,61 @@ END_HEADER #include "testlib.h" #include "mpscamc.h" #include "mpscmv.h" +#include "mpsavm.h" #include "newfmt.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; + +static void test(void) +{ + mps_arena_t arena; mps_pool_t pool; mps_thr_t thread; mps_fmt_t format; + mps_chain_t chain; mps_root_t root; mps_ap_t ap; mps_addr_t q; int p; - die(mps_space_create(&space), "create"); - die(mps_thread_reg(&thread, space), "register thread"); - die(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, space, &fmtA), "create format"); + cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), + "create arena"); + 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"); + die(mps_fmt_create_A(&format, arena, &fmtA), "create format"); + die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create"); - die(mps_pool_create(&pool, space, mps_class_mv(), - 1024*32, 1024*16, 1024*256), "pool"); + die(mps_pool_create(&pool, arena, mps_class_mv(), + 1024*32, 1024*16, 1024*256), + "pool"); while (mps_alloc(&q, pool, 64*1024)==MPS_RES_OK); - p=0; + p = 0; - die(mps_pool_create(&pool, space, mps_class_amc(), format), - "create pool"); + cdie(mmqa_pool_create_chain(&pool, arena, mps_class_amc(), format, chain), + "create pool"); while (1) { p++; - die(mps_ap_create(&ap, pool, MPS_RANK_EXACT), - "create ap"); + die(mps_ap_create(&ap, pool, MPS_RANK_EXACT), "create ap"); report("ap", "%i", p); } asserts(1, "Unreachable!"); } + int main(void) { void *m;