/* TEST_HEADER id = $HopeName$ summary = MVFF low-memory test language = c link = testlib.o END_HEADER */ #include #include "testlib.h" #include "mpscmvff.h" #include "mpsavm.h" #define MAXNUMBER 1000000 void *stackpointer; mps_space_t space; mps_bool_t slotHigh, arenaHigh, firstFit; int comments = 0; static struct {mps_addr_t addr; size_t size;} queue[MAXNUMBER]; static mps_pool_debug_option_s debugOpts = {(void *) "fefifofu", 8}; enum {SEQ=0, RAN=1, SEQGAP=2, RANGAP=3, DUMMY=4}; static char *tdesc[] = {"sequential", "random", "sequential gap", "random gap", "dummy"}; static void setobj(mps_addr_t a, size_t size, unsigned char val) { unsigned char *b; b = a; commentif(comments, "Set %x, size %x = %i", b, size, (int) val); while (size>0) { *b=val; b++; size--; } } static int chkobj(mps_addr_t a, size_t size, unsigned char val) { unsigned char *b; b = a; while (size>0) { /* comment("%p == %i", b, (int) val); */ if (*b != val) return 0; b++; size--; } return 1; } static void dt(int kind, size_t extendBy, size_t avgSize, size_t align, size_t mins, size_t maxs, int number, int iter) { mps_pool_t pool; int i, hd; clock_t time0, time1; size_t size; int secs; asserts(number <= MAXNUMBER, "number too big"); time0 = clock(); asserts(time0 != -1, "processor time not available"); die( mps_pool_create(&pool, space, mps_class_mvff_debug(), &debugOpts, extendBy, avgSize, align, slotHigh, arenaHigh, firstFit), "create MVFF pool"); for(hd=0; hd 0; comlimit -= 4*1024) { mps_arena_commit_limit_set(space, comlimit); report("limit", "%x", comlimit); symm = ranint(8); slotHigh = (symm >> 2) & 1; arenaHigh = (symm >> 1) & 1; firstFit = (symm & 1); mins = ranrange(1, 16); dt(RANGAP, 64*1024, 32, 8, 4*mins, 4*ranrange(mins, mins*100), 1000, 100000); } mps_thread_dereg(thread); mps_arena_destroy(space); } int main(void) { void *m; stackpointer=&m; /* hack to get stack pointer */ easy_tramp(test); pass(); return 0; }