diff --git a/mps/src/amsss.c b/mps/src/amsss.c index e69de29bb2d..ddbce25bec5 100644 --- a/mps/src/amsss.c +++ b/mps/src/amsss.c @@ -0,0 +1,136 @@ +/* impl.c.amsss: POOL CLASS AMS STRESS TEST + * + * $HopeName: MMsrc!amsss.c(MMdevel_poolams.1) $ + * Copyright (C) 1996, 1997 Harlequin Group, all rights reserved + * + * A direct copy of amcss.c, with trivial changes. nickb 1997-08-14 + */ + +#include "testlib.h" +#include "mps.h" +#include "mpscams.h" +#include "fmtdy.h" +#include +#include +#include +#include +#include +#include +#ifdef MPS_OS_SU +#include "ossu.h" +#endif + +#define NR_EXACT_ROOTS 50 +#define NR_AMBIG_ROOTS 50 +#define FIELDS_MAX 2000 +#define COLLECTIONS 5 +#define OBJNULL ((mps_addr_t)0xDECEA5ED) + +static mps_pool_t pool; +static mps_ap_t ap; +static mps_addr_t exact_roots[NR_EXACT_ROOTS]; +static mps_addr_t ambig_roots[NR_AMBIG_ROOTS]; + +static mps_addr_t make(void) +{ + size_t length = rnd() % 20, size = (length+2)*sizeof(mps_word_t); + mps_addr_t p; + mps_res_t res; + + do { + MPS_RESERVE_BLOCK(res, p, ap, size); + if(res) + die(res, "MPS_RESERVE_BLOCK"); + res = dylan_init(p, size, exact_roots, NR_EXACT_ROOTS); + if(res) + die(res, "dylan_init"); + } while(!mps_commit(ap, p, size)); + + return p; +} + +static void *test(void *arg, size_t s) +{ + mps_space_t space; + mps_fmt_t format; + mps_root_t exact_root, ambig_root; + unsigned long i; + mps_word_t collections; + + space = (mps_space_t)arg; + + die(mps_fmt_create_A(&format, space, dylan_fmt_A()), "fmt_create"); + + die(mps_pool_create(&pool, space, mps_class_ams(), format), + "pool_create(ams)"); + + die(mps_ap_create(&ap, pool, MPS_RANK_EXACT), "BufferCreate"); + + die(mps_root_create_table(&exact_root, space, + MPS_RANK_EXACT, (mps_rm_t)0, + &exact_roots[0], NR_EXACT_ROOTS), + "root_create_table(exact)"); + + die(mps_root_create_table(&ambig_root, space, + MPS_RANK_AMBIG, (mps_rm_t)0, + &ambig_roots[0], NR_AMBIG_ROOTS), + "root_create_table(ambig)"); + + for(i=0; i