1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-13 17:51:29 -07:00

Redact test subdirectory to remove global graphics confidential stuff.

Copied from Perforce
 Change: 29874
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Nick Barnes 2002-06-07 12:45:38 +01:00
parent 250c6d5302
commit d784feff11
53 changed files with 0 additions and 4980 deletions

View file

@ -1,17 +0,0 @@
af_six
allocate and free log for temp pool in ScriptWorks.
trunk of 1998-09-10,
30MB for rip, separations, 1024dpi, testhqn, extra grays.
Jobs ripped:
mnchenwk.ps
ausenpln.ps
hgp101.hpg
a1p101.hpg
musician.ps
radiocas.ps
Log generated with anchovy.3, variety.ti, dumper.exe and alloclog.pl.

View file

@ -1,176 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = EPDL allocation test
language = c
link = testlib.o
END_HEADER
*/
#include <time.h>
#include "testlib.h"
#include "mpscepdl.h"
#include "mpsavm.h"
#define MAXNUMBER 1000000
void *stackpointer;
mps_space_t space;
static struct {mps_addr_t addr; size_t size;} queue[MAXNUMBER];
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;
while (size>0)
{
*b=val;
/* comment("%p = %i", b, (int) 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 maxSize,
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_epdl(),
extendBy, avgSize, 8),
"create pool");
for(hd=0; hd<number; hd++)
{
size = ranrange(mins, maxs);
if ((ranint(2) && (kind & 2)) || (kind==DUMMY))
{
queue[hd].addr=NULL;
}
else
{
die(mps_alloc(&queue[hd].addr, pool, size), "alloc");
setobj(queue[hd].addr, size, (unsigned char) (hd%256));
queue[hd].size = size;
}
};
hd=-1;
for(i=0; i<iter; i++)
{
if (kind & 1) hd = ranint(number);
else {ranint(number); hd=(hd+1)%number;} /* call raninit anyway
to use same time */
if (queue[hd].addr != NULL)
{
asserts(chkobj(queue[hd].addr, queue[hd].size, (unsigned char) (hd%256)),
"corrupt at %x (%s: %x, %x, %x, %x, %x, %i, %i)",
queue[hd].addr,
tdesc[kind], (int) extendBy, (int) avgSize, (int) maxSize,
(int) mins, (int) maxs, number, iter);
mps_free(pool, queue[hd].addr, queue[hd].size);
}
size = ranrange(mins, maxs);
if ((ranint(2) && (kind & 2)) || (kind==DUMMY))
{
queue[hd].addr=NULL;
}
else
{
die(mps_alloc(&queue[hd].addr, pool, size),"alloc");
setobj(queue[hd].addr, size, (unsigned char) (hd%256));
queue[hd].size = size;
}
}
mps_pool_destroy(pool);
time1=clock();
secs=(int) 100*(time1-time0)/CLOCKS_PER_SEC;
comment("%s test (%x, %x, %x, %x, %x, %i, %i) in %i centisecs",
tdesc[kind], (int) extendBy, (int) avgSize, (int) maxSize,
(int) mins, (int) maxs, number, iter, secs);
}
static void test(void)
{
mps_thr_t thread;
size_t mins;
cdie(mps_arena_create(&space, mps_arena_class_vm(), (size_t) (1024*1024*50)), "create space");
cdie(mps_thread_reg(&thread, space), "register thread");
mins = sizeof(int);
dt(SEQ, 4096, 32, 64*1024, 8, 9, 5, 10);
dt(RANGAP, 64, 64, 64, 8, 128, 100, 1000);
dt(DUMMY, 4096, 32, 64*1024, 8, 64, 1000, 10000);
dt(SEQ, 4096, 32, 64*1024, 8, 64, 1000, 10000);
dt(RAN, 4096, 32, 64*1024, 8, 64, 1000, 10000);
dt(SEQGAP, 4096, 32, 64*1024, 8, 64, 1000, 10000);
dt(RANGAP, 4096, 32, 64*1024, 8, 64, 1000, 10000);
dt(DUMMY, 4096, 1024, 64*1024, 100, 132, 1000, 10000);
dt(SEQ, 4096, 1024, 64*1024, 100, 132, 1000, 10000);
dt(RAN, 4096, 1024, 64*1024, 100, 132, 1000, 10000);
dt(SEQGAP, 4096, 1024, 64*1024, 100, 132, 1000, 10000);
dt(RANGAP, 4096, 1024, 64*1024, 100, 132, 1000, 10000);
dt(DUMMY, 128*1024, 64*1024, 6400*1024, mins, 128*1024, 100, 10000);
dt(SEQ, 128*1024, 64*1024, 6400*1024, mins, 128*1024, 100, 10000);
dt(RAN, 128*1024, 64*1024, 6400*1024, mins, 128*1024, 100, 10000);
dt(SEQGAP, 128*1024, 64*1024, 6400*1024, mins, 128*1024, 100, 10000);
dt(RANGAP, 128*1024, 64*1024, 6400*1024, mins, 128*1024, 100, 10000);
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;
}

View file

@ -1,176 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = EPDL allocation test (with new alignment)
language = c
link = testlib.o
END_HEADER
*/
#include <time.h>
#include "testlib.h"
#include "mpscepdl.h"
#include "mpsavm.h"
#define MAXNUMBER 1000000
void *stackpointer;
mps_space_t space;
static struct {mps_addr_t addr; size_t size;} queue[MAXNUMBER];
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;
while (size>0)
{
*b=val;
/* comment("%p = %i", b, (int) 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 maxSize,
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_epdl(),
extendBy, avgSize, 8),
"create pool");
for(hd=0; hd<number; hd++)
{
size = ranrange(mins, maxs);
if ((ranint(2) && (kind & 2)) || (kind==DUMMY))
{
queue[hd].addr=NULL;
}
else
{
die(mps_alloc(&queue[hd].addr, pool, size), "alloc");
setobj(queue[hd].addr, size, (unsigned char) (hd%256));
queue[hd].size = size;
}
};
hd=-1;
for(i=0; i<iter; i++)
{
if (kind & 1) hd = ranint(number);
else {ranint(number); hd=(hd+1)%number;} /* call raninit anyway
to use same time */
if (queue[hd].addr != NULL)
{
asserts(chkobj(queue[hd].addr, queue[hd].size, (unsigned char) (hd%256)),
"corrupt at %x (%s: %x, %x, %x, %x, %x, %i, %i)",
queue[hd].addr,
tdesc[kind], (int) extendBy, (int) avgSize, (int) maxSize,
(int) mins, (int) maxs, number, iter);
mps_free(pool, queue[hd].addr, queue[hd].size);
}
size = ranrange(mins, maxs);
if ((ranint(2) && (kind & 2)) || (kind==DUMMY))
{
queue[hd].addr=NULL;
}
else
{
die(mps_alloc(&queue[hd].addr, pool, size),"alloc");
setobj(queue[hd].addr, size, (unsigned char) (hd%256));
queue[hd].size = size;
}
}
mps_pool_destroy(pool);
time1=clock();
secs=(int) 100*(time1-time0)/CLOCKS_PER_SEC;
comment("%s test (%x, %x, %x, %x, %x, %i, %i) in %i centisecs",
tdesc[kind], (int) extendBy, (int) avgSize, (int) maxSize,
(int) mins, (int) maxs, number, iter, secs);
}
static void test(void)
{
mps_thr_t thread;
size_t mins;
cdie(mps_arena_create(&space, mps_arena_class_vm(), (size_t) (1024*1024*50)), "create space");
cdie(mps_thread_reg(&thread, space), "register thread");
mins = sizeof(int);
dt(SEQ, 4096, 32, 64*1024, 8, 9, 5, 10);
dt(RANGAP, 64, 64, 64, 8, 128, 100, 1000);
dt(DUMMY, 4096, 32, 64*1024, 8, 64, 1000, 10000);
dt(SEQ, 4096, 32, 64*1024, 8, 64, 1000, 10000);
dt(RAN, 4096, 32, 64*1024, 8, 64, 1000, 10000);
dt(SEQGAP, 4096, 32, 64*1024, 8, 64, 1000, 10000);
dt(RANGAP, 4096, 32, 64*1024, 8, 64, 1000, 10000);
dt(DUMMY, 4096, 1024, 64*1024, 100, 132, 1000, 10000);
dt(SEQ, 4096, 1024, 64*1024, 100, 132, 1000, 10000);
dt(RAN, 4096, 1024, 64*1024, 100, 132, 1000, 10000);
dt(SEQGAP, 4096, 1024, 64*1024, 100, 132, 1000, 10000);
dt(RANGAP, 4096, 1024, 64*1024, 100, 132, 1000, 10000);
dt(DUMMY, 128*1024, 64*1024, 6400*1024, mins, 128*1024, 100, 10000);
dt(SEQ, 128*1024, 64*1024, 6400*1024, mins, 128*1024, 100, 10000);
dt(RAN, 128*1024, 64*1024, 6400*1024, mins, 128*1024, 100, 10000);
dt(SEQGAP, 128*1024, 64*1024, 6400*1024, mins, 128*1024, 100, 10000);
dt(RANGAP, 128*1024, 64*1024, 6400*1024, mins, 128*1024, 100, 10000);
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;
}

View file

@ -1,64 +0,0 @@
/*
TEST_HEADER
id = $HopeName: MMQA_test_function!141.c(trunk.2) $
summary = EPDR fenceposting check
language = c
link = testlib.o
OUTPUT_SPEC
assert = true
assertfile P= dbgpool.c
END_HEADER
*/
#include "testlib.h"
#include "mpscepdl.h"
#include "mpsavm.h"
void *stackpointer;
mps_arena_t arena;
static mps_pool_debug_option_s debugOpts = {(void *)"bibblebo", 8};
static void test(void) {
mps_thr_t thread;
mps_pool_t pool;
mps_addr_t a;
char *c;
cdie(mps_arena_create(&arena, mps_arena_class_vmnz(),
(size_t) (1024*1024*50)), "create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
die(
mps_pool_create(&pool, arena, mps_class_epdr_debug(), &debugOpts,
8192, 8, 8),
"create MVFF pool");
die(mps_alloc(&a, pool, 64), "alloc a");
c = a;
c -= 1;
*c = 0;
mps_pool_check_fenceposts(pool);
comment("Fencepost check.");
c += 67;
*c = 0;
mps_pool_check_fenceposts(pool);
comment("Fencepost check.");
mps_pool_destroy(pool);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void) {
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,59 +0,0 @@
/*
TEST_HEADER
id = $HopeName: MMQA_test_function!142.c(trunk.3) $
summary = EPDR fenceposting check: subfree
language = c
link = testlib.o
OUTPUT_SPEC
assert = true
assertfile P= dbgpool.c
assertcond = fencepost check on free
END_HEADER
*/
#include "testlib.h"
#include "mpscepdl.h"
#include "mpsavm.h"
void *stackpointer;
mps_arena_t arena;
static mps_pool_debug_option_s debugOpts = {(void *)"bibblebo", 8};
static void test(void)
{
mps_thr_t thread;
mps_pool_t pool;
mps_addr_t a;
cdie(mps_arena_create(&arena, mps_arena_class_vmnz(),
(size_t) (1024*1024*50)), "create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
die(
mps_pool_create(&pool, arena, mps_class_epdr_debug(), &debugOpts,
8192, 8, 8),
"create MVFF pool");
die(mps_alloc(&a, pool, 64), "alloc a");
mps_free(pool, a, 32);
mps_pool_destroy(pool);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,57 +0,0 @@
/*
TEST_HEADER
id = $HopeName: MMQA_test_function!143.c(trunk.2) $
summary = EPDR fenceposting check: free
language = c
link = testlib.o
OUTPUT_SPEC
assert = true
assertcond = fencepost check on free
END_HEADER
*/
#include "testlib.h"
#include "mpscepdl.h"
#include "mpsavm.h"
void *stackpointer;
mps_arena_t arena;
static mps_pool_debug_option_s debugOpts = {(void *)"bibblebo", 8};
static void test(void) {
mps_thr_t thread;
mps_pool_t pool;
mps_addr_t a;
char * c;
cdie(mps_arena_create(&arena, mps_arena_class_vmnz(),
(size_t) (1024*1024*50)), "create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
die(
mps_pool_create(&pool, arena, mps_class_epdr_debug(), &debugOpts,
8192, 8, 8),
"create MVFF pool");
die(mps_alloc(&a, pool, 63), "alloc a");
c = a;
c += 63;
*c = 0;
mps_free(pool, a, 63);
mps_pool_destroy(pool);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void) {
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,100 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = EPVM low-memory test
language = c
link = testlib.o epvmfmt.o
END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpscepvm.h"
#include "mpsavm.h"
#include "epvmfmt.h"
#define MAX_SAVE 10
#define INIT_SAVE 0
#define OBJ_SIZE 8
void *stackpointer;
static mps_pool_t pooli[1024];
static void tryout(size_t comlimit, int pools) {
mps_arena_t arena;
mps_thr_t thread;
mps_fmt_t format;
mps_pool_t pool;
mps_ap_t ap;
psobj *a;
int i, p;
comment("Limit: %lu, pools: %d", (unsigned long) comlimit, pools);
if (mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*128)))
goto no_arena;
mps_arena_commit_limit_set(arena, comlimit);
if (mps_thread_reg(&thread, arena)) goto no_thread;
if (mps_fmt_create_A(&format, arena, &fmtepvm)) goto no_fmt;
for (p = 0; p < pools; p ++) {
if (mps_pool_create(&pooli[p], arena, mps_class_mv(), 4096, 32, 4096)) {
break;
};
}
if (mps_pool_create(&pool, arena, mps_class_epvm(), format, 10, 0))
goto no_pool;
if (mps_ap_create(&ap, pool, 0)) goto no_ap;
allocrepvm(&a, ap, OBJ_SIZE);
mps_epvm_save(pool);
allocrepvm(&a, ap, OBJ_SIZE);
mps_epvm_save(pool);
for (i=0; i<100; i++) {
allocrepvm(&a, ap, OBJ_SIZE);
}
mps_epvm_restore(pool, 0);
mps_ap_destroy(ap);
no_ap:
mps_pool_destroy(pool);
no_pool:
for (; p >= 0; p--) {
if (pooli[p]) {
mps_pool_destroy(pooli[p]);
}
}
mps_fmt_destroy(format);
no_fmt:
mps_thread_dereg(thread);
no_thread:
mps_arena_destroy(arena);
no_arena:
a = NULL;
}
static void test(void)
{
int i;
for (i = 0; i <1024; i ++) {
tryout(1024*64, i);
}
}
int main(void) {
void *m;
stackpointer=&m;
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,106 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = EPVM low-memory test
language = c
link = testlib.o epvmfmt.o
END_HEADER
*/
#include "testlib.h"
#include "mpscepvm.h"
#include "mpsavm.h"
#include "epvmfmt.h"
#define MAX_SAVE 10
#define INIT_SAVE 0
#define OBJ_SIZE 8
#define MAXAPS 4096
void *stackpointer;
static mps_ap_t api[MAXAPS];
static void tryout(size_t comlimit, int aps) {
mps_arena_t arena;
mps_thr_t thread;
mps_fmt_t format;
mps_pool_t pool, pool1;
mps_ap_t ap;
psobj *a;
int i, p;
comment("Limit: %lu, aps: %d", (unsigned long) comlimit, aps);
if (mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*128)))
goto no_arena;
mps_arena_commit_limit_set(arena, comlimit);
if (mps_thread_reg(&thread, arena)) goto no_thread;
if (mps_fmt_create_A(&format, arena, &fmtepvm)) goto no_fmt;
if (mps_pool_create(&pool1, arena, mps_class_epvm(), format, 10, 0))
goto no_pool;
for (p = 0; p < aps; p ++) {
if (mps_ap_create(&api[p], pool1, 0)) {
break;
};
}
if (mps_pool_create(&pool, arena, mps_class_epvm(), format, 10, 0))
goto no_pool2;
if (mps_ap_create(&ap, pool, 0)) goto no_ap;
allocrepvm(&a, ap, OBJ_SIZE);
mps_epvm_save(pool);
allocrepvm(&a, ap, OBJ_SIZE);
mps_epvm_save(pool);
for (i=0; i<100; i++) {
allocrepvm(&a, ap, OBJ_SIZE);
}
mps_epvm_restore(pool, 0);
mps_ap_destroy(ap);
no_ap:
mps_pool_destroy(pool);
no_pool2:
for (; p >= 0; p--) {
if (api[p]) {
mps_ap_destroy(api[p]);
}
}
mps_pool_destroy(pool1);
no_pool:
mps_fmt_destroy(format);
no_fmt:
mps_thread_dereg(thread);
no_thread:
mps_arena_destroy(arena);
no_arena:
a = NULL;
}
static void test(void)
{
int i;
for (i = 0; i < MAXAPS; i ++) {
tryout(1024*64, i);
}
}
int main(void) {
void *m;
stackpointer=&m;
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,73 +0,0 @@
/*
TEST_HEADER
id = $HopeName: MMQA_test_function!154.c(trunk.1) $
summary = EPVM allocate and epvm_collect, once only
language = c
link = testlib.o epvmfmt.o
END_HEADER
*/
#include "testlib.h"
#include "mpscepvm.h"
#include "mpsavm.h"
#include "epvmfmt.h"
#define MAX_SAVE 1000
#define INIT_SAVE 12
void *stackpointer;
static void test(void)
{
mps_arena_t arena;
mps_thr_t thread;
mps_fmt_t format;
mps_pool_t pool1;
mps_ap_t ap1s;
int j;
psobj *a;
/* create an arena that can't grow beyond 64M */
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*64)),
"create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_fmt_create_A(&format, arena, &fmtepvm), "create format");
cdie(mps_pool_create(&pool1, arena, mps_class_epvm(),
format, MAX_SAVE, INIT_SAVE), "create pool1");
cdie(mps_ap_create(&ap1s, pool1, 0), "create ap1s");
for (j=0; j<3000; j++) {
a = allocepvm(ap1s, (size_t) (8+8*ranint(500)));
}
comment("collecting...");
mps_epvm_collect(pool1);
mps_ap_destroy(ap1s);
mps_pool_destroy(pool1);
mps_fmt_destroy(format);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
comment("Destroyed arena");
}
int main(void) {
void *m;
stackpointer=&m;
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,64 +0,0 @@
/*
TEST_HEADER
id = $HopeName: MMQA_test_function!155.c(trunk.1) $
summary = EPDL fenceposting check
language = c
link = testlib.o
OUTPUT_SPEC
assert = true
assertfile P= dbgpool.c
END_HEADER
*/
#include "testlib.h"
#include "mpscepdl.h"
#include "mpsavm.h"
void *stackpointer;
mps_arena_t arena;
static mps_pool_debug_option_s debugOpts = {(void *)"bibblebo", 8};
static void test(void) {
mps_thr_t thread;
mps_pool_t pool;
mps_addr_t a;
char *c;
cdie(mps_arena_create(&arena, mps_arena_class_vmnz(),
(size_t) (1024*1024*50)), "create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
die(
mps_pool_create(&pool, arena, mps_class_epdl_debug(), &debugOpts,
8192, 8, 8),
"create MVFF pool");
die(mps_alloc(&a, pool, 64), "alloc a");
c = a;
c -= 1;
*c = 0;
mps_pool_check_fenceposts(pool);
comment("Fencepost check.");
c += 67;
*c = 0;
mps_pool_check_fenceposts(pool);
comment("Fencepost check.");
mps_pool_destroy(pool);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void) {
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,58 +0,0 @@
/*
TEST_HEADER
id = $HopeName: MMQA_test_function!156.c(trunk.2) $
summary = EPDL fenceposting check: subfree
language = c
link = testlib.o
OUTPUT_SPEC
assert = true
assertfile P= dbgpool.c
assertcond = fencepost check on free
END_HEADER
*/
#include "testlib.h"
#include "mpscepdl.h"
#include "mpsavm.h"
void *stackpointer;
mps_arena_t arena;
static mps_pool_debug_option_s debugOpts = {(void *)"bibblebo", 8};
static void test(void)
{
mps_thr_t thread;
mps_pool_t pool;
mps_addr_t a;
cdie(mps_arena_create(&arena, mps_arena_class_vmnz(),
(size_t) (1024*1024*50)), "create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
die(
mps_pool_create(&pool, arena, mps_class_epdl_debug(), &debugOpts,
8192, 8, 8),
"create MVFF pool");
die(mps_alloc(&a, pool, 64), "alloc a");
mps_free(pool, a, 32);
mps_pool_destroy(pool);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,57 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = EPDL fenceposting check: free
language = c
link = testlib.o
OUTPUT_SPEC
assert = true
assertcond = fencepost check on free
END_HEADER
*/
#include "testlib.h"
#include "mpscepdl.h"
#include "mpsavm.h"
void *stackpointer;
mps_arena_t arena;
static mps_pool_debug_option_s debugOpts = {(void *)"bibblebo", 8};
static void test(void) {
mps_thr_t thread;
mps_pool_t pool;
mps_addr_t a;
char * c;
cdie(mps_arena_create(&arena, mps_arena_class_vmnz(),
(size_t) (1024*1024*50)), "create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
die(
mps_pool_create(&pool, arena, mps_class_epdl_debug(), &debugOpts,
8192, 8, 8),
"create MVFF pool");
die(mps_alloc(&a, pool, 63), "alloc a");
c = a;
c += 63;
*c = 0;
mps_free(pool, a, 63);
mps_pool_destroy(pool);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void) {
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,102 +0,0 @@
/*
TEST_HEADER
id = $HopeName: MMQA_test_function!166.c(trunk.1) $
summary = MVFF with AP split allocate from SW log (af_six)
language = c
link = testlib.o
stdin = af_six
harness = 2.0
parameters = EXTEND=65536 AVGSIZE=32 ALIGN=8 \
ARENAHIGH=1 SLOTHIGH=1 FIRST=1 SPLIT1=0 SPLIT2=0
OUTPUT_SPEC
completed = yes
END_HEADER
*/
#include "testlib.h"
#include "mpscmvff.h"
#include "mpsavm.h"
#define MAXOBJS (30000)
mps_addr_t objs[MAXOBJS];
size_t sizes[MAXOBJS];
void *stackpointer;
mps_arena_t arena;
static void test(void)
{
mps_thr_t thread;
mps_ap_t ap1, ap2, ap3, ap;
mps_pool_t pool1, pool2, pool3, pool;
log_event event;
int id;
char *c;
size_t size;
unsigned long maxcom;
mps_res_t res;
maxcom = 0;
cdie(mps_arena_create(&arena, mps_arena_class_vmnz(), (size_t) (1024*1024*100)),
"create space");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_pool_create(&pool1,arena,mps_class_mvff(),
EXTEND,AVGSIZE,ALIGN,ARENAHIGH,SLOTHIGH,FIRST),
"create pool1");
cdie(mps_pool_create(&pool2,arena,mps_class_mvff(),
EXTEND,AVGSIZE,ALIGN,ARENAHIGH,SLOTHIGH,FIRST),
"create pool2");
cdie(mps_pool_create(&pool3,arena,mps_class_mvff(),
EXTEND,AVGSIZE,ALIGN,ARENAHIGH,SLOTHIGH,FIRST),
"create pool3");
cdie(mps_ap_create(&ap1,pool1), "ap 1");
cdie(mps_ap_create(&ap2,pool2), "ap 2");
cdie(mps_ap_create(&ap3,pool3), "ap 3");
while (read_event(&event)) {
if (event.type == EVENT_ALLOC) {
id = event.alloc.id;
asserts(id < MAXOBJS, "MAXOBJS too small");
size = ((event.alloc.size + ALIGN-1)|(ALIGN-1))^(ALIGN-1);
ap = (size < SPLIT1) ? ap1 : (size < SPLIT2) ? ap2 : ap3;
do {
MPS_RESERVE_BLOCK(res, objs[id], ap, size);
asserts(res == MPS_RES_OK, "alloc failed");
} while (!mps_commit(ap, objs[id], size));
sizes[id] = size;
c = objs[id];
*c = 43;
} else if (event.type == EVENT_FREE) {
id = event.free.id;
size = sizes[id];
pool = (size < SPLIT1) ? pool1 : (size < SPLIT2) ? pool2 : pool3;
mps_free(pool, objs[id], size);
}
size = mps_arena_committed(arena);
if (size > maxcom) maxcom=size;
}
report("maxcom", "%ld", maxcom);
mps_ap_destroy(ap1);
mps_ap_destroy(ap2);
mps_ap_destroy(ap3);
mps_pool_destroy(pool1);
mps_pool_destroy(pool2);
mps_pool_destroy(pool3);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,96 +0,0 @@
/*
TEST_HEADER
id = $HopeName: MMQA_test_function!168.c(trunk.2) $
summary = MVFF split allocate from SW log (af_six), with hysteresis control
language = c
link = testlib.o
stdin = af_six
parameters = EXTEND=65536 AVGSIZE=32 ALIGN=8 \
ARENAHIGH=1 SLOTHIGH=1 FIRST=1 SPLIT1=0 SPLIT2=0 \
COMMIT=30000000 SPARE=0
OUTPUT_SPEC
result = pass
END_HEADER
*/
#include "testlib.h"
#include "mpscmvff.h"
#include "mpsavm.h"
#define MAXOBJS (30000)
mps_addr_t objs[MAXOBJS];
size_t sizes[MAXOBJS];
void *stackpointer;
mps_arena_t arena;
static void test(void)
{
mps_thr_t thread;
mps_pool_t pool1, pool2, pool3, pool;
log_event event;
int id;
char *c;
size_t size;
unsigned long maxcom;
maxcom = 0;
cdie(mps_arena_create(&arena, mps_arena_class_vmnz(), (size_t) (1024*1024*100)),
"create space");
cdie(mps_thread_reg(&thread, arena), "register thread");
mps_arena_commit_limit_set(arena, COMMIT);
mps_arena_spare_commit_limit_set(arena, SPARE);
cdie(mps_pool_create(&pool1,arena,mps_class_mvff(),
EXTEND,AVGSIZE,ALIGN,ARENAHIGH,SLOTHIGH,FIRST),
"create pool1");
cdie(mps_pool_create(&pool2,arena,mps_class_mvff(),
EXTEND,AVGSIZE,ALIGN,ARENAHIGH,SLOTHIGH,FIRST),
"create pool2");
cdie(mps_pool_create(&pool3,arena,mps_class_mvff(),
EXTEND,AVGSIZE,ALIGN,ARENAHIGH,SLOTHIGH,FIRST),
"create pool3");
while (read_event(&event)) {
if (event.type == EVENT_ALLOC) {
id = event.alloc.id;
asserts(id < MAXOBJS, "MAXOBJS too small");
size = event.alloc.size;
pool = (size < SPLIT1) ? pool1 : (size < SPLIT2) ? pool2 : pool3;
die(mps_alloc(&objs[id], pool, size), "alloc");
/*
comment("%d %ld %p", id, size, objs[id]);
*/
sizes[id] = size;
c = objs[id];
*c = 43;
} else if (event.type == EVENT_FREE) {
id = event.free.id;
size = sizes[id];
pool = (size < SPLIT1) ? pool1 : (size < SPLIT2) ? pool2 : pool3;
mps_free(pool, objs[id], size);
}
size = mps_arena_committed(arena);
if (size > maxcom) maxcom=size;
}
report("maxcom", "%ld", maxcom);
mps_pool_destroy(pool1);
mps_pool_destroy(pool2);
mps_pool_destroy(pool3);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,92 +0,0 @@
/*
TEST_HEADER
id = $HopeName: MMQA_test_function!154.c(trunk.1) $
summary = EPVM allocate smaller segment when big one doesn't fit
language = c
link = testlib.o epvmfmt.o
harness = 2.0
parameters = RAISE=16384
END_HEADER
*/
#include "testlib.h"
#include "mpscepvm.h"
#include "mpsavm.h"
#include "epvmfmt.h"
#define MAX_SAVE 1000
#define INIT_SAVE 12
void *stackpointer;
static void test(void)
{
mps_arena_t arena;
mps_thr_t thread;
mps_fmt_t format;
mps_pool_t pool1;
mps_ap_t ap1s;
int j;
psobj *a;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*64)),
"create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_fmt_create_A(&format, arena, &fmtepvm), "create format");
cdie(mps_pool_create(&pool1, arena, mps_class_epvm(),
format, MAX_SAVE, INIT_SAVE), "create pool1");
cdie(mps_ap_create(&ap1s, pool1, 0), "create ap1s");
/* allocate a bit to get us off the initial segment */
for (j=0; j<1024; j++) {
a = allocepvm(ap1s, 32);
}
comment("initial allocation");
/* set commit limit to allow no more */
cdie(mps_arena_commit_limit_set(arena, mps_arena_committed(arena)),
"commit limit set");
/* and allocate 4KB objects until full */
while(allocrepvm(&a, ap1s, 4096/8) == MPS_RES_OK) {};
/* raise commit limit by RAISE (default is 16KB) */
cdie(mps_arena_commit_limit_set(arena, mps_arena_committed(arena)+RAISE),
"commit limit raise");
/* and try to allocate one more object */
a = allocepvm(ap1s, 4096/8);
mps_ap_destroy(ap1s);
mps_pool_destroy(pool1);
mps_fmt_destroy(format);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
comment("Destroyed arena");
}
int main(void) {
void *m;
stackpointer=&m;
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,68 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = Intern and Label telemetry events
language = c
link = testlib.o
stdin = af_six
OUTPUT_SPEC
result = pass
END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpsavm.h"
void *stackpointer;
mps_arena_t arena;
static void test(void)
{
mps_thr_t thread;
mps_pool_t pool;
mps_addr_t a;
int i;
char str[] = " 0 MMQA interned symbol\t212 œ%)(*œ!)( ";
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*10)),
"create space");
(void) mps_telemetry_control(0x7F, 0x7F);
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_pool_create(&pool,arena,mps_class_mv(), 65536, 32, 65536),
"create pool");
mps_telemetry_label(NULL, mps_telemetry_intern("FOO"));
for (i = 0; i < 20; i++) {
die(mps_alloc(&a, pool, 64), "alloc");
}
for (i = 0; i < 10; i++) {
die(mps_alloc(&a, pool, 128), "alloc");
mps_telemetry_label(a, mps_telemetry_intern(str));
str[1]++;
}
for (i = 0; i < 20; i++) {
die(mps_alloc(&a, pool, 64), "alloc");
}
mps_pool_destroy(pool);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,79 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
harness = 3.0
summary = Get the last page in a chunk into the hysteresis fund
language = c
link = testlib.o
parameters = CHUNK_SIZE=(1024*1024) OBJ_FROM=(1024*1024*2) \
OBJ_TO=(1024*1024*3)
OUTPUT_SPEC
completed = yes
END_HEADER
*/
/* This test was written to provoke the assertion in
request.epcore.160256 (Assertion failure while purging the
hysteresis fund.)
drj suggested that the assertion would be provoked if we
arranged for an arena chunk to have less than one whole
page description on the last page occupied by the page table,
arranged for the page corresponding to this page description
to be in the hysteresis fund, and then purged the fund.
This test attempts to cause this situation by creating an arena
with a small chunk size, allocating an object that's bigger
than the chunk size (hence causing a new chunk to be created),
freeing it, then destroying the arena again. We repeat with
different object sizes, until (we hope) eventually there is
only a partial page descriptor in the last page occupied by
the page table.
We use an EPDR pool to increase the chance of the object covering
the last page (but it's a VM arena so we can't be sure what zones
will be used). Of course, the test is sensitive to the algorithm
by which the arena decides how big to make the new chunk.
*/
#include "testlib.h"
#include "mpsavm.h"
#include "mpscepdl.h"
mps_arena_t arena;
mps_thr_t thread;
mps_root_t root;
static void test(void)
{
mps_pool_t pool;
mps_addr_t a;
size_t objsize;
for (objsize = OBJ_FROM; objsize < OBJ_TO; objsize += 4096) {
report("objsize", "%d", objsize);
die(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) CHUNK_SIZE),
"create arena with 1MB chunk size");
die(mps_thread_reg(&thread, arena), "register thread");
die(mps_pool_create(&pool, arena, mps_class_epdr(), 65536, 32, 8),
"create EPDR pool");
mps_arena_spare_commit_limit_set(arena, (size_t) OBJ_TO);
die(mps_alloc(&a, pool, objsize), "alloc");
mps_free(pool, a, objsize);
mps_pool_destroy(pool);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
}
int main(void)
{
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,89 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = MV SAC allocate from SW log (af_six)
language = c
link = testlib.o
stdin = af_six
parameters = EXTEND=65536 AVGSIZE=32 MAXSIZE=256*1024 \
SPLIT1=128 COUNT1=64 FREQ1=1 SPLIT2=1024 COUNT2=64 FREQ2=2
OUTPUT_SPEC
result = pass
END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpsavm.h"
#define MAXOBJS (30000)
mps_addr_t objs[MAXOBJS];
size_t sizes[MAXOBJS];
void *stackpointer;
mps_arena_t arena;
static void test(void)
{
mps_thr_t thread;
mps_pool_t pool;
mps_sac_t sac;
log_event event;
int id;
char *c;
size_t size;
unsigned long maxcom;
mps_res_t res;
struct mps_sac_classes_s sac_classes[] = {
{ SPLIT1, COUNT1, FREQ1 },
{ SPLIT2, COUNT2, FREQ2 }
};
maxcom = 0;
cdie(mps_arena_create(&arena, mps_arena_class_vmnz(), (size_t) (1024*1024*100)),
"create space");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_pool_create(&pool,arena,mps_class_mv(),EXTEND,AVGSIZE,MAXSIZE),
"create pool");
cdie(mps_sac_create(&sac, pool, 2, sac_classes), "sac create");
while (read_event(&event)) {
if (event.type == EVENT_ALLOC) {
id = event.alloc.id;
asserts(id < MAXOBJS, "MAXOBJS too small");
size = event.alloc.size;
MPS_SAC_ALLOC(res, objs[id], sac, size, 0);
asserts(res == MPS_RES_OK, "alloc");
sizes[id] = size;
c = objs[id];
*c = 43;
} else if (event.type == EVENT_FREE) {
id = event.free.id;
size = sizes[id];
MPS_SAC_FREE(sac, objs[id], size);
}
size = mps_arena_committed(arena);
if (size > maxcom) maxcom=size;
}
report("maxcom", "%ld", maxcom);
mps_sac_destroy(sac);
mps_pool_destroy(pool);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,65 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
harness = 2.2
summary = MV SAC create alloc free destroy
language = c
link = testlib.o
stdin = af_six
parameters = ITERATIONS=30000 OBJSIZE=1024*1024 EXTEND=65536 AVGSIZE=32 MAXSIZE=65536
OUTPUT_SPEC
completed = yes
END_HEADER
*/
#include "testlib.h"
#include "mpscmv.h"
#include "mpsavm.h"
void *stackpointer;
mps_arena_t arena;
static void test(void)
{
mps_thr_t thread;
mps_pool_t pool;
mps_sac_t sac;
mps_res_t res;
void *p;
int i;
struct mps_sac_classes_s sac_classes[] = {
{ OBJSIZE, 30, 10 },
};
cdie(mps_arena_create(&arena, mps_arena_class_vmnz(), (size_t) (1024*1024*100)),
"create space");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_pool_create(&pool,arena,mps_class_mv(),EXTEND,AVGSIZE,MAXSIZE),
"create pool");
for (i = 0; i < ITERATIONS; i++) {
if (i % 1000 == 0) comment("%d", i);
die(mps_sac_create(&sac, pool, 1, sac_classes), "sac create");
MPS_SAC_ALLOC(res, p, sac, OBJSIZE, 0);
asserts(res == MPS_RES_OK, "alloc failed");
MPS_SAC_FREE(sac, p, OBJSIZE);
mps_sac_destroy(sac);
}
mps_pool_destroy(pool);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,176 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = new EPDL allocation test
language = c
link = testlib.o
END_HEADER
*/
#include <time.h>
#include "testlib.h"
#include "mpscepdl.h"
#include "mpsavm.h"
#define MAXNUMBER 1000000
void *stackpointer;
mps_space_t space;
static struct {mps_addr_t addr; size_t size;} queue[MAXNUMBER];
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;
while (size>0)
{
*b=val;
/* comment("%p = %i", b, (int) 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_epdl(),
extendBy, avgSize, align),
"create EPDL pool");
for(hd=0; hd<number; hd++)
{
size = ranrange(mins, maxs);
if ((ranint(2) && (kind & 2)) || (kind==DUMMY))
{
queue[hd].addr=NULL;
}
else
{
die(mps_alloc(&queue[hd].addr, pool, size), "alloc");
setobj(queue[hd].addr, size, (unsigned char) (hd%256));
queue[hd].size = size;
}
};
hd=-1;
for(i=0; i<iter; i++)
{
if (kind & 1) hd = ranint(number);
else {ranint(number); hd=(hd+1)%number;} /* call raninit anyway
to use same time */
if (queue[hd].addr != NULL)
{
asserts(chkobj(queue[hd].addr, queue[hd].size, (unsigned char) (hd%256)),
"corrupt at %x (%s: %x, %x, %x, %x, %x, %i, %i)",
queue[hd].addr,
tdesc[kind], (int) extendBy, (int) avgSize, (int) align,
(int) mins, (int) maxs, number, iter);
mps_free(pool, queue[hd].addr, queue[hd].size);
}
size = ranrange(mins, maxs);
if ((ranint(2) && (kind & 2)) || (kind==DUMMY))
{
queue[hd].addr=NULL;
}
else
{
die(mps_alloc(&queue[hd].addr, pool, size),"alloc");
setobj(queue[hd].addr, size, (unsigned char) (hd%256));
queue[hd].size = size;
}
}
mps_pool_destroy(pool);
time1=clock();
secs=(int) 100*(time1-time0)/CLOCKS_PER_SEC;
comment("%s test (%x, %x, %x, %x, %x, %i, %i) in %i centisecs",
tdesc[kind], (int) extendBy, (int) avgSize, (int) align,
(int) mins, (int) maxs, number, iter, secs);
}
static void test(void)
{
mps_thr_t thread;
size_t mins;
cdie(mps_arena_create(&space, mps_arena_class_vm(), (size_t) (1024*1024*50)), "create space");
cdie(mps_thread_reg(&thread, space), "register thread");
mins = sizeof(int);
dt(SEQ, 4096, 32, 8, 8, 9, 5, 1000);
dt(RANGAP, 64, 64, 8, 8, 128, 100, 100000);
dt(DUMMY, 4096, 32, 8, 8, 64, 1000, 1000000);
dt(SEQ, 4096, 32, 8, 8, 64, 1000, 1000000);
dt(RAN, 4096, 32, 8, 8, 64, 1000, 1000000);
dt(SEQGAP, 4096, 32, 8, 8, 64, 1000, 1000000);
dt(RANGAP, 4096, 32, 8, 8, 64, 1000, 1000000);
dt(DUMMY, 4096, 1024, 8, 100, 132, 1000, 1000000);
dt(SEQ, 4096, 1024, 8, 100, 132, 1000, 1000000);
dt(RAN, 4096, 1024, 8, 100, 132, 1000, 1000000);
dt(SEQGAP, 4096, 1024, 8, 100, 132, 1000, 1000000);
dt(RANGAP, 4096, 1024, 8, 100, 132, 1000, 1000000);
dt(DUMMY, 128*1024, 64*1024, 8, mins, 128*1024, 100, 10000);
dt(SEQ, 128*1024, 64*1024, 8, mins, 128*1024, 100, 10000);
dt(RAN, 128*1024, 64*1024, 8, mins, 128*1024, 100, 10000);
dt(SEQGAP, 128*1024, 64*1024, 8, mins, 128*1024, 100, 10000);
dt(RANGAP, 128*1024, 64*1024, 8, mins, 128*1024, 100, 10000);
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;
}

View file

@ -1,176 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = new EPDR allocation test
language = c
link = testlib.o
END_HEADER
*/
#include <time.h>
#include "testlib.h"
#include "mpscepdl.h"
#include "mpsavm.h"
#define MAXNUMBER 1000000
void *stackpointer;
mps_space_t space;
static struct {mps_addr_t addr; size_t size;} queue[MAXNUMBER];
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;
while (size>0)
{
*b=val;
/* comment("%p = %i", b, (int) 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_epdr(),
extendBy, avgSize, align),
"create EPDR pool");
for(hd=0; hd<number; hd++)
{
size = ranrange(mins, maxs);
if ((ranint(2) && (kind & 2)) || (kind==DUMMY))
{
queue[hd].addr=NULL;
}
else
{
die(mps_alloc(&queue[hd].addr, pool, size), "alloc");
setobj(queue[hd].addr, size, (unsigned char) (hd%256));
queue[hd].size = size;
}
};
hd=-1;
for(i=0; i<iter; i++)
{
if (kind & 1) hd = ranint(number);
else {ranint(number); hd=(hd+1)%number;} /* call raninit anyway
to use same time */
if (queue[hd].addr != NULL)
{
asserts(chkobj(queue[hd].addr, queue[hd].size, (unsigned char) (hd%256)),
"corrupt at %x (%s: %x, %x, %x, %x, %x, %i, %i)",
queue[hd].addr,
tdesc[kind], (int) extendBy, (int) avgSize, (int) align,
(int) mins, (int) maxs, number, iter);
mps_free(pool, queue[hd].addr, queue[hd].size);
}
size = ranrange(mins, maxs);
if ((ranint(2) && (kind & 2)) || (kind==DUMMY))
{
queue[hd].addr=NULL;
}
else
{
die(mps_alloc(&queue[hd].addr, pool, size),"alloc");
setobj(queue[hd].addr, size, (unsigned char) (hd%256));
queue[hd].size = size;
}
}
mps_pool_destroy(pool);
time1=clock();
secs=(int) 100*(time1-time0)/CLOCKS_PER_SEC;
comment("%s test (%x, %x, %x, %x, %x, %i, %i) in %i centisecs",
tdesc[kind], (int) extendBy, (int) avgSize, (int) align,
(int) mins, (int) maxs, number, iter, secs);
}
static void test(void)
{
mps_thr_t thread;
size_t mins;
cdie(mps_arena_create(&space, mps_arena_class_vm(), (size_t) (1024*1024*50)), "create space");
cdie(mps_thread_reg(&thread, space), "register thread");
mins = sizeof(int);
dt(SEQ, 4096, 32, 8, 8, 9, 5, 1000);
dt(RANGAP, 64, 64, 8, 8, 128, 100, 100000);
dt(DUMMY, 4096, 32, 8, 8, 64, 1000, 1000000);
dt(SEQ, 4096, 32, 8, 8, 64, 1000, 1000000);
dt(RAN, 4096, 32, 8, 8, 64, 1000, 1000000);
dt(SEQGAP, 4096, 32, 8, 8, 64, 1000, 1000000);
dt(RANGAP, 4096, 32, 8, 8, 64, 1000, 1000000);
dt(DUMMY, 4096, 1024, 8, 100, 132, 1000, 1000000);
dt(SEQ, 4096, 1024, 8, 100, 132, 1000, 1000000);
dt(RAN, 4096, 1024, 8, 100, 132, 1000, 1000000);
dt(SEQGAP, 4096, 1024, 8, 100, 132, 1000, 1000000);
dt(RANGAP, 4096, 1024, 8, 100, 132, 1000, 1000000);
dt(DUMMY, 128*1024, 64*1024, 8, mins, 128*1024, 100, 10000);
dt(SEQ, 128*1024, 64*1024, 8, mins, 128*1024, 100, 10000);
dt(RAN, 128*1024, 64*1024, 8, mins, 128*1024, 100, 10000);
dt(SEQGAP, 128*1024, 64*1024, 8, mins, 128*1024, 100, 10000);
dt(RANGAP, 128*1024, 64*1024, 8, mins, 128*1024, 100, 10000);
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;
}

View file

@ -1,71 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = EPDR pool-destroy speed test
language = c
link = testlib.o
END_HEADER
*/
#include "testlib.h"
#include "mpscepdl.h"
#include "mpsavm.h"
#define EXTENDBY 8192
#define AVGSIZE 8192
#define ALIGN 8
#define SIZE 8192
#define ITER 5000
#define NALLOC 8192
#define SALLOC 1
void *stackpointer;
mps_arena_t arena;
static void alloclots(mps_pool_t pool, int n) {
int i;
mps_addr_t a;
for (i = 0; i < n; i++) {
die(mps_alloc(&a, pool, SIZE), "alloc failed");
}
}
static void test(void)
{
mps_thr_t thread;
mps_pool_t pool1, pool2;
int i;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)),
"create space");
cdie(mps_thread_reg(&thread, arena), "register thread");
die(
mps_pool_create(&pool1, arena, mps_class_epdr(),
EXTENDBY, AVGSIZE, ALIGN),
"create EPDR pool");
alloclots(pool1, NALLOC);
for (i = 0; i < ITER; i++) {
die(mps_pool_create(&pool2, arena, mps_class_epdr(),
EXTENDBY, AVGSIZE, ALIGN), "pool create");
alloclots(pool2, SALLOC);
mps_pool_destroy(pool2);
}
mps_pool_destroy(pool1);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,68 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = EPDR allocate far too much test
language = c
link = testlib.o
OUTPUT_SPEC
res = MEMORY
result = pass
END_HEADER
*/
#include "testlib.h"
#include "mpscepdl.h"
#include "mpsavm.h"
#define EXTENDBY 8192
#define AVGSIZE 8192
#define ALIGN 8
#define SIZE 4096
void *stackpointer;
mps_arena_t arena;
static void test(void)
{
mps_thr_t thread;
mps_pool_t pool;
mps_res_t res;
mps_addr_t a;
int *b;
int i;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*300)),
"create space");
cdie(mps_thread_reg(&thread, arena), "register thread");
die(
mps_pool_create(&pool, arena, mps_class_epdr(),
EXTENDBY, AVGSIZE, ALIGN),
"create EPDR pool");
i = 0;
while (MPS_RES_OK == (res = mps_alloc(&a, pool, SIZE))) {
b = a;
*b = 152;
i++;
}
report("total", "%d", i);
report_res("res", res);
mps_pool_destroy(pool);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,78 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = EPDR allocate from SW log (af_six)
language = c
link = testlib.o
stdin = af_six
OUTPUT_SPEC
result = pass
END_HEADER
*/
#include "testlib.h"
#include "mpscepdl.h"
#include "mpsavm.h"
#define MAXOBJS (30000)
mps_addr_t objs[MAXOBJS];
size_t sizes[MAXOBJS];
void *stackpointer;
mps_arena_t arena;
static void test(void)
{
mps_thr_t thread;
mps_pool_t pool;
log_event event;
int id;
char *c;
size_t size;
unsigned long maxcom;
maxcom = 0;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)),
"create space");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(
mps_pool_create(&pool, arena, mps_class_epdr(),
8192, 32, 4),
"create EPDR pool");
while (read_event(&event)) {
if (event.type == EVENT_ALLOC) {
id = event.alloc.id;
asserts(id < MAXOBJS, "MAXOBJS too small");
size = event.alloc.size;
die(mps_alloc(&objs[id], pool, size), "alloc");
sizes[id] = size;
c = objs[id];
*c = 43;
} else if (event.type == EVENT_FREE) {
id = event.free.id;
mps_free(pool, objs[id], sizes[id]);
}
size = mps_arena_committed(arena);
if (size > maxcom) maxcom = size;
}
report("maxcom", "%ld", maxcom);
mps_pool_destroy(pool);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,77 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = MVFF allocate from SW log (af_six)
language = c
link = testlib.o
stdin = af_six
OUTPUT_SPEC
result = pass
END_HEADER
*/
#include "testlib.h"
#include "mpscmvff.h"
#include "mpsavm.h"
#define MAXOBJS (30000)
mps_addr_t objs[MAXOBJS];
size_t sizes[MAXOBJS];
void *stackpointer;
mps_arena_t arena;
static void test(void)
{
mps_thr_t thread;
mps_pool_t pool;
log_event event;
int id;
char *c;
size_t size;
unsigned long maxcom;
maxcom = 0;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)),
"create space");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(
mps_pool_create(&pool, arena, mps_class_mvff(),
8192, 32, 8, 1, 1, 0),
"create EPDR pool");
while (read_event(&event)) {
if (event.type == EVENT_ALLOC) {
id = event.alloc.id;
asserts(id < MAXOBJS, "MAXOBJS too small");
size = event.alloc.size;
die(mps_alloc(&objs[id], pool, size), "alloc");
sizes[id] = size;
c = objs[id];
*c = 43;
} else if (event.type == EVENT_FREE) {
id = event.free.id;
mps_free(pool, objs[id], sizes[id]);
}
size = mps_arena_committed(arena);
if (size > maxcom) maxcom=size;
}
report("maxcom", "%ld", maxcom);
mps_pool_destroy(pool);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,92 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = MV2 allocate from SW log (af_six)
language = c
link = testlib.o
stdin = af_six
OUTPUT_SPEC
result = pass
END_HEADER
*/
#include "testlib.h"
#include "mpscmv2.h"
#include "mpsavm.h"
#define MAXOBJS (30000)
#define MINSIZE 8
#define AVGSIZE 128
#define MAXSIZE 8192
#define DEPTH 10
#define FRAGLIMIT 100
mps_addr_t objs[MAXOBJS];
size_t sizes[MAXOBJS];
void *stackpointer;
mps_arena_t arena;
static void test(void)
{
mps_thr_t thread;
mps_pool_t pool;
mps_ap_t ap;
log_event event;
int id;
char *c;
size_t size;
unsigned long maxcom;
mps_res_t res;
maxcom = 0;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)),
"create space");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(
mps_pool_create(&pool, arena, mps_class_mv2(),
MINSIZE, AVGSIZE, MAXSIZE, DEPTH, FRAGLIMIT),
"create MV2 pool");
cdie(mps_ap_create(&ap, pool, MPS_RANK_AMBIG), "create ap");
while (read_event(&event)) {
if (event.type == EVENT_ALLOC) {
id = event.alloc.id;
asserts(id < MAXOBJS, "MAXOBJS too small");
size = event.alloc.size;
sizes[id] = size;
size = ((size+7)/8)*8;
do {
MPS_RESERVE_BLOCK(res, objs[id], ap, size);
asserts(res == MPS_RES_OK, "alloc failed");
} while (!mps_commit(ap, objs[id], size));
c = objs[id];
*c = 43;
} else if (event.type == EVENT_FREE) {
id = event.free.id;
mps_free(pool, objs[id], sizes[id]);
}
size = mps_arena_committed(arena);
if (size > maxcom) maxcom=size;
}
report("maxcom", "%ld", maxcom);
mps_pool_destroy(pool);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,87 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = MV2 allocate from SW log (af_six)
language = c
link = testlib.o
stdin = af_six
parameters = MINSIZE AVGSIZE MAXSIZE DEPTH FRAGLIMIT
OUTPUT_SPEC
result = pass
END_HEADER
*/
#include "testlib.h"
#include "mpscmv2.h"
#include "mpsavm.h"
#define MAXOBJS (30000)
mps_addr_t objs[MAXOBJS];
size_t sizes[MAXOBJS];
void *stackpointer;
mps_arena_t arena;
static void test(void)
{
mps_thr_t thread;
mps_pool_t pool;
mps_ap_t ap;
log_event event;
int id;
char *c;
size_t size;
unsigned long maxcom;
mps_res_t res;
maxcom = 0;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)),
"create space");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(
mps_pool_create(&pool, arena, mps_class_mv2(),
MINSIZE, AVGSIZE, MAXSIZE, DEPTH, FRAGLIMIT),
"create MV2 pool");
cdie(mps_ap_create(&ap, pool, MPS_RANK_AMBIG), "create ap");
while (read_event(&event)) {
if (event.type == EVENT_ALLOC) {
id = event.alloc.id;
asserts(id < MAXOBJS, "MAXOBJS too small");
size = event.alloc.size;
sizes[id] = size;
size = ((size+7)/8)*8;
do {
MPS_RESERVE_BLOCK(res, objs[id], ap, size);
asserts(res == MPS_RES_OK, "alloc failed");
} while (!mps_commit(ap, objs[id], size));
c = objs[id];
*c = 43;
} else if (event.type == EVENT_FREE) {
id = event.free.id;
mps_free(pool, objs[id], sizes[id]);
}
size = mps_arena_committed(arena);
if (size > maxcom) maxcom=size;
}
report("maxcom", "%ld", maxcom);
mps_pool_destroy(pool);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,112 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = MV2 from af_six measuring fragmentation
language = c
link = testlib.o
stdin = af_six
parameters = MINSIZE=8 AVGSIZE=128 MAXSIZE=65536 DEPTH FRAGLIMIT
OUTPUT_SPEC
result = pass
END_HEADER
*/
#include "testlib.h"
#include "mpscmv2.h"
#include "mpsavm.h"
#define MAXOBJS (30000)
mps_addr_t objs[MAXOBJS];
size_t sizes[MAXOBJS];
size_t total_size;
size_t committed;
int fragmentation;
double fragacc;
double commacc;
double sizeacc;
double count;
void *stackpointer;
mps_arena_t arena;
static void test(void)
{
mps_thr_t thread;
mps_pool_t pool;
mps_ap_t ap;
log_event event;
int id;
char *c;
size_t size;
unsigned long maxcom;
mps_res_t res;
maxcom = 0;
fragacc = 0;
commacc = 0;
sizeacc = 0;
count = 0;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)),
"create space");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(
mps_pool_create(&pool, arena, mps_class_mv2(),
MINSIZE, AVGSIZE, MAXSIZE, DEPTH, FRAGLIMIT),
"create MV2 pool");
cdie(mps_ap_create(&ap, pool, MPS_RANK_AMBIG), "create ap");
committed = mps_arena_committed(arena);
while (read_event(&event)) {
if (event.type == EVENT_ALLOC) {
id = event.alloc.id;
asserts(id < MAXOBJS, "MAXOBJS too small");
size = event.alloc.size;
sizes[id] = size;
size = ((size+7)/8)*8;
do {
MPS_RESERVE_BLOCK(res, objs[id], ap, size);
asserts(res == MPS_RES_OK, "alloc failed");
} while (!mps_commit(ap, objs[id], size));
total_size+=sizes[id];
c = objs[id];
*c = 43;
} else if (event.type == EVENT_FREE) {
id = event.free.id;
mps_free(pool, objs[id], sizes[id]);
total_size-=sizes[id];
}
committed = mps_arena_committed(arena);
if (committed > maxcom) maxcom=committed;
fragacc += ((double) (committed-total_size))/((double) committed);
commacc += (double) committed;
sizeacc += (double) total_size;
count += 1;
}
report("maxcom", "%ld", maxcom);
report("fragavg", "%f", fragacc/count);
report("fragweighted", "%f", (commacc-sizeacc)/commacc);
report("commavg", "%f", commacc/count);
report("sizeavg", "%f", sizeacc/count);
mps_ap_destroy(ap);
mps_pool_destroy(pool);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,95 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = MVFF allocate from SW log (af_six)
language = c
link = testlib.o
stdin = af_six
parameters = EXTENDBY=65536 AVGSIZE=128 ALIGN=8 ARENAHIGH=1 SLOTHIGH=1 FIRST=1
OUTPUT_SPEC
result = pass
END_HEADER
*/
#include "testlib.h"
#include "mpscmvff.h"
#include "mpsavm.h"
#define MAXOBJS (30000)
mps_addr_t objs[MAXOBJS];
size_t sizes[MAXOBJS];
size_t total_size;
size_t committed;
int fragmentation;
int lastfrag=0;
void *stackpointer;
mps_arena_t arena;
static void test(void)
{
mps_thr_t thread;
mps_pool_t pool;
log_event event;
int id;
char *c;
size_t size;
unsigned long maxcom;
maxcom = 0;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)),
"create space");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(
mps_pool_create(&pool, arena, mps_class_mvff(),
EXTENDBY, AVGSIZE, ALIGN, ARENAHIGH, SLOTHIGH, FIRST),
"create MVFF pool");
committed = mps_arena_committed(arena);
while (read_event(&event)) {
if (event.type == EVENT_ALLOC) {
id = event.alloc.id;
asserts(id < MAXOBJS, "MAXOBJS too small");
size = event.alloc.size;
sizes[id] = size;
size = ((size+7)/8)*8;
die(mps_alloc(&objs[id], pool, size), "alloc");
if (mps_arena_committed(arena) > committed) {
fragmentation = (100*(committed-total_size)/committed);
if (fragmentation != lastfrag) {
lastfrag = fragmentation;
report("fragmentation", "%d", fragmentation);
}
}
total_size+=sizes[id];
c = objs[id];
*c = 43;
} else if (event.type == EVENT_FREE) {
id = event.free.id;
mps_free(pool, objs[id], sizes[id]);
total_size-=sizes[id];
}
committed = mps_arena_committed(arena);
if (committed > maxcom) maxcom=committed;
}
report("maxcom", "%ld", maxcom);
mps_pool_destroy(pool);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,103 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = EPDR from af_six measuring fragmentation
language = c
link = testlib.o
stdin = af_six
parameters = ALIGN=8 AVGSIZE=128 EXTENDBY=65536
OUTPUT_SPEC
result = pass
END_HEADER
*/
#include "testlib.h"
#include "mpscepdl.h"
#include "mpsavm.h"
#define MAXOBJS (30000)
mps_addr_t objs[MAXOBJS];
size_t sizes[MAXOBJS];
size_t total_size;
size_t committed;
int fragmentation;
double fragacc;
double commacc;
double sizeacc;
double count;
void *stackpointer;
mps_arena_t arena;
static void test(void)
{
mps_thr_t thread;
mps_pool_t pool;
log_event event;
int id;
char *c;
size_t size;
unsigned long maxcom;
maxcom = 0;
fragacc = 0;
commacc = 0;
sizeacc = 0;
count = 0;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)),
"create space");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(
mps_pool_create(&pool, arena, mps_class_epdr(),
EXTENDBY, AVGSIZE, ALIGN),
"create EPDR pool");
committed = mps_arena_committed(arena);
while (read_event(&event)) {
if (event.type == EVENT_ALLOC) {
id = event.alloc.id;
asserts(id < MAXOBJS, "MAXOBJS too small");
size = event.alloc.size;
sizes[id] = size;
mps_alloc(&objs[id], pool, size);
total_size+=sizes[id];
c = objs[id];
*c = 43;
} else if (event.type == EVENT_FREE) {
id = event.free.id;
mps_free(pool, objs[id], sizes[id]);
total_size-=sizes[id];
}
committed = mps_arena_committed(arena);
if (committed > maxcom) maxcom=committed;
fragacc += ((double) (committed-total_size))/((double) committed);
commacc += (double) committed;
sizeacc += (double) total_size;
count += 1;
}
report("maxcom", "%ld", maxcom);
report("fragavg", "%f", fragacc/count);
report("fragweighted", "%f", (commacc-sizeacc)/commacc);
report("commavg", "%f", commacc/count);
report("sizeavg", "%f", sizeacc/count);
mps_pool_destroy(pool);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,118 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = MV2 from af_six measuring fragmentation
language = c
link = testlib.o
stdin = af_six
parameters = COMLIMIT=(1024*1024*100) MINSIZE=8 AVGSIZE=1024 MAXSIZE=65536 LIMIT FRAGLIMIT
OUTPUT_SPEC
result = pass
END_HEADER
*/
#include "testlib.h"
#include "mpscmv2.h"
#include "mpsavm.h"
#define MAXOBJS (30000)
mps_addr_t objs[MAXOBJS];
size_t sizes[MAXOBJS];
size_t total_size;
size_t committed;
int fragmentation;
double fragacc;
double commacc;
double sizeacc;
double count;
void *stackpointer;
mps_arena_t arena;
static void test(void)
{
mps_thr_t thread;
mps_pool_t pool;
mps_ap_t ap;
log_event event;
int id;
char *c;
size_t size;
unsigned long maxcom;
unsigned long depth;
mps_res_t res;
maxcom = 0;
fragacc = 0;
commacc = 0;
sizeacc = 0;
count = 0;
depth = LIMIT*2*(MAXSIZE/AVGSIZE)*(100/FRAGLIMIT);
report("depth", "%ld", depth);
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)),
"create space");
cdie(mps_arena_commit_limit_set(arena, COMLIMIT), "commit limit");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(
mps_pool_create(&pool, arena, mps_class_mv2(),
MINSIZE, AVGSIZE, MAXSIZE,
depth,
FRAGLIMIT),
"create MV2 pool");
cdie(mps_ap_create(&ap, pool, MPS_RANK_AMBIG), "create ap");
committed = mps_arena_committed(arena);
while (read_event(&event)) {
if (event.type == EVENT_ALLOC) {
id = event.alloc.id;
asserts(id < MAXOBJS, "MAXOBJS too small");
size = event.alloc.size;
sizes[id] = size;
size = ((size+7)/8)*8;
do {
MPS_RESERVE_BLOCK(res, objs[id], ap, size);
asserts(res == MPS_RES_OK, "alloc failed");
} while (!mps_commit(ap, objs[id], size));
total_size+=sizes[id];
c = objs[id];
*c = 43;
} else if (event.type == EVENT_FREE) {
id = event.free.id;
mps_free(pool, objs[id], sizes[id]);
total_size-=sizes[id];
}
committed = mps_arena_committed(arena);
if (committed > maxcom) maxcom=committed;
fragacc += ((double) (committed-total_size))/((double) committed);
commacc += (double) committed;
sizeacc += (double) total_size;
count += 1;
}
report("maxcom", "%ld", maxcom);
report("fragavg", "%f", fragacc/count);
report("fragweighted", "%f", (commacc-sizeacc)/commacc);
report("commavg", "%f", commacc/count);
report("sizeavg", "%f", sizeacc/count);
mps_ap_destroy(ap);
mps_pool_destroy(pool);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,103 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = MVFF from af_six measuring fragmentation
language = c
link = testlib.o
stdin = af_six
parameters = ALIGN=8 AVGSIZE=128 EXTENDBY=65536 ARENAHIGH SLOTHIGH FIRSTFIT
OUTPUT_SPEC
result = pass
END_HEADER
*/
#include "testlib.h"
#include "mpscmvff.h"
#include "mpsavm.h"
#define MAXOBJS (30000)
mps_addr_t objs[MAXOBJS];
size_t sizes[MAXOBJS];
size_t total_size;
size_t committed;
int fragmentation;
double fragacc;
double commacc;
double sizeacc;
double count;
void *stackpointer;
mps_arena_t arena;
static void test(void)
{
mps_thr_t thread;
mps_pool_t pool;
log_event event;
int id;
char *c;
size_t size;
unsigned long maxcom;
maxcom = 0;
fragacc = 0;
commacc = 0;
sizeacc = 0;
count = 0;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)),
"create space");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(
mps_pool_create(&pool, arena, mps_class_mvff(),
EXTENDBY, AVGSIZE, ALIGN, ARENAHIGH, SLOTHIGH, FIRSTFIT),
"create MVFF pool");
committed = mps_arena_committed(arena);
while (read_event(&event)) {
if (event.type == EVENT_ALLOC) {
id = event.alloc.id;
asserts(id < MAXOBJS, "MAXOBJS too small");
size = event.alloc.size;
sizes[id] = size;
mps_alloc(&objs[id], pool, size);
total_size+=sizes[id];
c = objs[id];
*c = 43;
} else if (event.type == EVENT_FREE) {
id = event.free.id;
mps_free(pool, objs[id], sizes[id]);
total_size-=sizes[id];
}
committed = mps_arena_committed(arena);
if (committed > maxcom) maxcom=committed;
fragacc += ((double) (committed-total_size))/((double) committed);
commacc += (double) committed;
sizeacc += (double) total_size;
count += 1;
}
report("maxcom", "%ld", maxcom);
report("fragavg", "%f", fragacc/count);
report("fragweighted", "%f", (commacc-sizeacc)/commacc);
report("commavg", "%f", commacc/count);
report("sizeavg", "%f", sizeacc/count);
mps_pool_destroy(pool);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,162 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = MV2*3 from af_six measuring fragmentation
language = c
link = testlib.o
stdin = af_six
parameters = COMLIMIT=(1024*1024*100) MIN1=8 MIN2=256 MIN3=4096 MAX3=32768 LIMIT FRAGLIMIT
OUTPUT_SPEC
result = pass
END_HEADER
*/
#include "testlib.h"
#include "mpscmv2.h"
#include "mpsavm.h"
#define MAXOBJS (30000)
mps_addr_t objs[MAXOBJS];
size_t sizes[MAXOBJS];
mps_pool_t pools[MAXOBJS];
size_t total_size;
size_t committed;
int fragmentation;
double fragacc;
double commacc;
double sizeacc;
double count;
void *stackpointer;
mps_arena_t arena;
static void test(void)
{
mps_thr_t thread;
mps_pool_t pool1, pool2, pool3;
mps_ap_t ap1, ap2, ap3, ap;
log_event event;
int id;
char *c;
size_t size;
unsigned long maxcom;
unsigned long depth1, depth2, depth3;
size_t avg1, avg2, avg3;
mps_res_t res;
maxcom = 0;
fragacc = 0;
commacc = 0;
sizeacc = 0;
count = 0;
avg1 = MIN1;
avg2 = MIN2;
avg3 = MIN3;
depth1 = LIMIT*2*(MIN2/avg1)*(100/FRAGLIMIT);
depth2 = LIMIT*2*(MIN3/avg2)*(100/FRAGLIMIT);
depth3 = LIMIT*2*(MAX3/avg3)*(100/FRAGLIMIT);
report("avg1", "%ld", avg1);
report("depth1", "%ld", depth1);
report("avg2", "%ld", avg2);
report("depth2", "%ld", depth2);
report("avg3", "%ld", avg3);
report("depth3", "%ld", depth3);
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)),
"create space");
cdie(mps_arena_commit_limit_set(arena, COMLIMIT), "commit limit");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(
mps_pool_create(&pool1, arena, mps_class_mv2(),
MIN1, avg1, MIN2,
depth1,
FRAGLIMIT),
"create MV2 pool (small)");
cdie(mps_ap_create(&ap1, pool1, MPS_RANK_AMBIG), "create ap (small)");
cdie(
mps_pool_create(&pool2, arena, mps_class_mv2(),
MIN2, avg2, MIN3,
depth2,
FRAGLIMIT),
"create MV2 pool (medium)");
cdie(mps_ap_create(&ap2, pool2, MPS_RANK_AMBIG), "create ap (medium)");
cdie(
mps_pool_create(&pool3, arena, mps_class_mv2(),
MIN3, avg3, MAX3,
depth3,
FRAGLIMIT),
"create MV2 pool (big)");
cdie(mps_ap_create(&ap3, pool3, MPS_RANK_AMBIG), "create ap (big)");
committed = mps_arena_committed(arena);
while (read_event(&event)) {
if (event.type == EVENT_ALLOC) {
id = event.alloc.id;
asserts(id < MAXOBJS, "MAXOBJS too small");
size = event.alloc.size;
sizes[id] = size;
size = ((size+7)/8)*8;
if (size < MIN2) {
ap = ap1;
pools[id] = pool1;
} else if (size < MIN3) {
ap = ap2;
pools[id] = pool2;
} else {
ap = ap3;
pools[id] = pool3;
}
do {
MPS_RESERVE_BLOCK(res, objs[id], ap, size);
asserts(res == MPS_RES_OK, "alloc failed");
} while (!mps_commit(ap, objs[id], size));
total_size+=sizes[id];
c = objs[id];
*c = 43;
} else if (event.type == EVENT_FREE) {
id = event.free.id;
mps_free(pools[id], objs[id], sizes[id]);
total_size-=sizes[id];
}
committed = mps_arena_committed(arena);
if (committed > maxcom) maxcom=committed;
fragacc += ((double) (committed-total_size))/((double) committed);
commacc += (double) committed;
sizeacc += (double) total_size;
count += 1;
}
report("maxcom", "%ld", maxcom);
report("fragavg", "%f", fragacc/count);
report("fragweighted", "%f", (commacc-sizeacc)/commacc);
report("commavg", "%f", commacc/count);
report("sizeavg", "%f", sizeacc/count);
mps_ap_destroy(ap1);
mps_ap_destroy(ap2);
mps_ap_destroy(ap3);
mps_pool_destroy(pool1);
mps_pool_destroy(pool2);
mps_pool_destroy(pool3);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,134 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = EPDR*3 from af_six measuring fragmentation
language = c
link = testlib.o
stdin = af_six
parameters = COMLIMIT=(1024*1024*100) MIN1=8 MIN2=256 MIN3=4096 EXTENDBY=65536
OUTPUT_SPEC
result = pass
END_HEADER
*/
#include "testlib.h"
#include "mpscepdl.h"
#include "mpsavm.h"
#define MAXOBJS (30000)
#define ALIGN 8
mps_addr_t objs[MAXOBJS];
size_t sizes[MAXOBJS];
mps_pool_t pools[MAXOBJS];
size_t total_size;
size_t committed;
int fragmentation;
double fragacc;
double commacc;
double sizeacc;
double count;
void *stackpointer;
mps_arena_t arena;
static void test(void)
{
mps_thr_t thread;
mps_pool_t pool1, pool2, pool3;
log_event event;
int id;
char *c;
size_t size;
unsigned long maxcom;
size_t avg1, avg2, avg3;
maxcom = 0;
fragacc = 0;
commacc = 0;
sizeacc = 0;
count = 0;
avg1 = 4*MIN1;
avg2 = 4*MIN2;
avg3 = 4*MIN3;
report("avg1", "%ld", avg1);
report("avg2", "%ld", avg2);
report("avg3", "%ld", avg3);
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)),
"create space");
cdie(mps_arena_commit_limit_set(arena, COMLIMIT), "commit limit");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(
mps_pool_create(&pool1, arena, mps_class_epdr(),
EXTENDBY, avg1, ALIGN),
"create EPDR pool (small)");
cdie(
mps_pool_create(&pool2, arena, mps_class_epdr(),
EXTENDBY, avg2, ALIGN),
"create EPDR pool (medium)");
cdie(
mps_pool_create(&pool3, arena, mps_class_epdr(),
EXTENDBY, avg3, ALIGN),
"create EPDR pool (big)");
committed = mps_arena_committed(arena);
while (read_event(&event)) {
if (event.type == EVENT_ALLOC) {
id = event.alloc.id;
asserts(id < MAXOBJS, "MAXOBJS too small");
size = event.alloc.size;
sizes[id] = size;
if (size < MIN2) {
pools[id] = pool1;
} else if (size < MIN3) {
pools[id] = pool2;
} else {
pools[id] = pool3;
}
die(mps_alloc(&objs[id], pools[id], size), "alloc");
total_size+=sizes[id];
c = objs[id];
*c = 43;
} else if (event.type == EVENT_FREE) {
id = event.free.id;
mps_free(pools[id], objs[id], sizes[id]);
total_size-=sizes[id];
}
committed = mps_arena_committed(arena);
if (committed > maxcom) maxcom=committed;
fragacc += ((double) (committed-total_size))/((double) committed);
commacc += (double) committed;
sizeacc += (double) total_size;
count += 1;
}
report("maxcom", "%ld", maxcom);
report("fragavg", "%f", fragacc/count);
report("fragweighted", "%f", (commacc-sizeacc)/commacc);
report("commavg", "%f", commacc/count);
report("sizeavg", "%f", sizeacc/count);
mps_pool_destroy(pool1);
mps_pool_destroy(pool2);
mps_pool_destroy(pool3);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
}
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,45 +0,0 @@
/*
TEST_HEADER
id = $HopeName: MMQA_test_function!21.c(trunk.4) $
summary = EPDL allocate large promise, make it small, repeat
language = c
link = testlib.o
harness = 2.5
parameters = EXTENDBY=65536 AVGSIZE=32 ALIGN=4 PROMISE=64 ITERATE=2000
END_HEADER
*/
#include "testlib.h"
#include "mpscepdl.h"
#include "mpsavm.h"
#define VMNZSIZE ((size_t) 30*1024*1024)
static void test(void) {
mps_arena_t arena;
mps_pool_t pool;
mps_addr_t q;
int p;
die(mps_arena_create(&arena, mps_arena_class_vmnz(), VMNZSIZE), "create");
die(mps_arena_commit_limit_set(arena, VMNZSIZE), "commit limit");
die(mps_pool_create(&pool, arena, mps_class_epdl(),
EXTENDBY, AVGSIZE, ALIGN), "pool create");
for (p=0; p<ITERATE; p++) {
die(mps_alloc(&q, pool, PROMISE*1024), "alloc");
q = (mps_addr_t) ((char *) q + 8);
mps_free(pool, q, PROMISE*1024-8);
report("promise", "%i", p);
}
mps_pool_destroy(pool);
mps_arena_destroy(arena);
}
int main(void) {
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,28 +0,0 @@
TEST_HEADER
id = $HopeName$
summary = SW memory leak detection
language = english
END_HEADER
1. Check out a version of SW known to be stable and reliable. It's
best to opt for one which corresponds to an actual external release,
e.g. SW_B11, which is 4.5r1.
2. Build a release version using the new memory manager. Bear in mind
that in this context, "memory manager" means not just the mmsw library,
but the glue code. If the distance between the current SW trunk and the
branch you chose is great enough, you may need to edit the new glue code
to make it compatible with the old SW.
3. Set up device and page settings. Turn on the memory statistics
page feature. Then quit and remove LOGFILE from the SW folder.
4. Start SW, run tests, quit.
5. Look at
If time permits, try on a range of platforms with a range of ScriptWorks
settings. See other SW tests for suggestions.
rit 1998-03-13

View file

@ -1,69 +0,0 @@
TEST_HEADER
id = $HopeName$
summary = SW performance no worse than last release
language = english
END_HEADER
EP have a requirement that each release of ScriptWorks be no slower
than the last in any typical operation. EPQA test this by running
various test suites, with various combinations of settings, and
seeing if anything gets slower. It's not just the overall time
for a suite that's important, but the times for individual jobs,
because each job could be typical for a particular user.
Of course, SW performance is mostly out of our hands; however,
we should check that each release of the MM is as fast as releases
that have previously gone out to customers. Here's a performance
comparison.
1. Check out a version of SW known to be stable and reliable. It's
best to opt for one which corresponds to an actual external release,
e.g. SW_B11, which is 4.5r1.
2. Build a release version using the old memory manager and one using
the new memory manager. Bear in mind that in this context, "memory
manager" means not just the mmsw library, but the glue code. If the
distance between the current SW trunk and the branch you chose is
great enough, you may well need to edit the new glue code to make it
compatible with the old SW.
3. If on a Mac, set the memory of the two versions of SW (with
File Info) so that the RIP gets the same amount of memory in
the end (e.g. 30000K is a reasonable number).
4. Use either executable to set up device and page settings. Then
quit, remove LOGFILE from the SW folder, and backup the SW folder.
5. Start one executable, run tests, quit, keep LOGFILE. Bear in mind
that the times reported in log file are clock-on-the-wall times, and
will be affected by other processes running on your machine.
6. Delete SW folder and restore from backup.
7. Start other executable, run same tests, quit, keep LOGFILE.
8. Compare performance by running "difflogs" on the two LOGFILEs. Look for
jobs which
- used to run but now fail -- this could be serious.
- now run slower than before (total or interpretation time)
- produce unexpected differences in output, e.g. checksums.
When a job looks like it might be a problem, try running it again, both
on its own and within the suite. There is significant random variation
in the times recorded in SW LOGFILEs, so it's important to check that
what looks like a difference really is one.
If time permits, try on a range of platforms with a range of ScriptWorks
settings, including memory settings. Here are some examples of suitable
settings to try:
TestHqn capstan device. 1270 dpi, produce separations, HPS on, lots of
grey levels, single (if required) mode.
EasyTrap on.
Something with Harlequin Colour Management (make sure to use a colour
device, or produce separations).
rit 1998-03-13

View file

@ -1,140 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = EPVM save, alloc, restore in two pools
language = c
link = testlib.o epvmfmt.o
END_HEADER
*/
#include "testlib.h"
#include "mpscepvm.h"
#include "mpsavm.h"
#include "epvmfmt.h"
#define MAX_SAVE 20
#define INIT_SAVE 3
void *stackpointer;
static void test(void)
{
mps_arena_t arena;
mps_pool_t pool1, pool2;
mps_thr_t thread;
mps_root_t root;
mps_fmt_t format;
mps_ap_t ap1p, ap1s, ap2p, ap2s;
psobj *a;
int i, j;
mps_epvm_save_level_t lev1, lev2;
/* create an arena that can't grow beyond 64M */
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*64)),
"create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_root_create_reg(&root, arena, MPS_RANK_AMBIG, 0, thread,
mps_stack_scan_ambig, stackpointer, 0),
"create root");
cdie(mps_fmt_create_A(&format, arena, &fmtepvm), "create format");
cdie(mps_pool_create(&pool1, arena, mps_class_epvm(),
format, MAX_SAVE, INIT_SAVE), "create pool1");
cdie(mps_pool_create(&pool2, arena, mps_class_epvm(),
format, MAX_SAVE, INIT_SAVE), "create pool2");
cdie(mps_ap_create(&ap1p, pool1, 1), "create ap1p");
cdie(mps_ap_create(&ap1s, pool1, 0), "create ap1s");
cdie(mps_ap_create(&ap2p, pool2, 1), "create ap2p");
cdie(mps_ap_create(&ap2s, pool2, 0), "create ap2s");
lev1 = INIT_SAVE;
lev2 = INIT_SAVE;
for (i=0; i<100000; i++) {
if (i % 1000 ==0) {
comment("---------------------- Restore to zero.");
lev1 = 0;
mps_epvm_restore(pool1, lev1);
lev1++;
mps_epvm_save(pool1);
lev2 = 0;
mps_epvm_restore(pool2, lev2);
lev2++;
mps_epvm_save(pool2);
}
j = ranint(40);
switch (j) {
case 1:
if (lev1==1) break;
lev1--;
comment("Restore 1: %i", lev1);
while (ranint(2) && (lev1>1)) lev1--;
mps_epvm_restore(pool1, lev1);
break;
case 2:
if (lev2==1) break;
lev2--;
while (ranint(2) && (lev2>1)) lev2--;
comment("Restore 2: %i", lev2);
mps_epvm_restore(pool2, lev2);
break;
case 3:
case 4:
if (lev1<MAX_SAVE) {
lev1++;
comment("Save 1 to %i", lev1);
mps_epvm_save(pool1);
}
break;
case 5:
case 6:
if (lev2<MAX_SAVE) {
lev2++;
comment("Save 2 to %i", lev2);
mps_epvm_save(pool2);
}
break;
default:
if (ranint(2)==0) {
a = allocepvm(ap1p, 8*(ranint(1000)+1));
} else {
a = allocepvm(ap2p, 8*(ranint(1000)+1));
}
}
}
mps_ap_destroy(ap1p);
mps_ap_destroy(ap1s);
mps_ap_destroy(ap2p);
mps_ap_destroy(ap2s);
mps_pool_destroy(pool1);
mps_pool_destroy(pool2);
mps_fmt_destroy(format);
mps_root_destroy(root);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
comment("Destroyed arena");
}
int main(void) {
void *m;
stackpointer=&m;
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,112 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = EPVM save, alloc, restore in one pool
language = c
link = testlib.o epvmfmt.o
END_HEADER
*/
#include "testlib.h"
#include "mpscepvm.h"
#include "mpsavm.h"
#include "epvmfmt.h"
#define MAX_SAVE 20
#define INIT_SAVE 3
void *stackpointer;
static void test(void)
{
mps_arena_t arena;
mps_pool_t pool1;
mps_thr_t thread;
mps_root_t root;
mps_fmt_t format;
mps_ap_t ap1p;
psobj *a;
int i, j;
mps_epvm_save_level_t lev1;
/* create an arena that can't grow beyond 64M */
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*64)),
"create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_root_create_reg(&root, arena, MPS_RANK_AMBIG, 0, thread,
mps_stack_scan_ambig, stackpointer, 0),
"create root");
cdie(mps_fmt_create_A(&format, arena, &fmtepvm), "create format");
cdie(mps_pool_create(&pool1, arena, mps_class_epvm(),
format, MAX_SAVE, INIT_SAVE), "create pool1");
cdie(mps_ap_create(&ap1p, pool1, 1), "create ap1p");
lev1 = INIT_SAVE;
for (i=0; i<100000; i++) {
if (i % 1000 ==0) {
comment("%d of 1000", i);
lev1 = 0;
mps_epvm_restore(pool1, lev1);
lev1++;
mps_epvm_save(pool1);
}
j = ranint(40);
switch (j) {
case 1:
if (lev1==1) break;
lev1--;
while (ranint(2) && (lev1>1)) lev1--;
mps_epvm_restore(pool1, lev1);
break;
case 2:
break;
case 3:
case 4:
if (lev1<MAX_SAVE) {
lev1++;
mps_epvm_save(pool1);
}
break;
case 5:
case 6:
break;
default:
if (ranint(2)==0) {
a = allocepvm(ap1p, 8*(ranint(1000)+1));
} else {
}
}
}
mps_ap_destroy(ap1p);
mps_pool_destroy(pool1);
mps_fmt_destroy(format);
mps_root_destroy(root);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
comment("Destroyed arena");
}
int main(void) {
void *m;
stackpointer=&m;
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,119 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = EPVM save, alloc, restore (singly) in one pool
language = c
link = testlib.o epvmfmt.o
END_HEADER
*/
#include "testlib.h"
#include "mpscepvm.h"
#include "mpsavm.h"
#include "epvmfmt.h"
#define MAX_SAVE 20
#define INIT_SAVE 3
void *stackpointer;
static void test(void)
{
mps_arena_t arena;
mps_pool_t pool1;
mps_thr_t thread;
mps_root_t root;
mps_fmt_t format;
mps_ap_t ap1p;
psobj *a;
int i, j;
mps_epvm_save_level_t lev1;
/* create an arena that can't grow beyond 64M */
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*64)),
"create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_root_create_reg(&root, arena, MPS_RANK_AMBIG, 0, thread,
mps_stack_scan_ambig, stackpointer, 0),
"create root");
cdie(mps_fmt_create_A(&format, arena, &fmtepvm), "create format");
cdie(mps_pool_create(&pool1, arena, mps_class_epvm(),
format, MAX_SAVE, INIT_SAVE), "create pool1");
cdie(mps_ap_create(&ap1p, pool1, 1), "create ap1p");
lev1 = INIT_SAVE;
for (i=0; i<100000; i++) {
if (i % 1000 ==0) {
comment("---------------------- Restore to zero.");
while (lev1 > 0) {
lev1--;
mps_epvm_restore(pool1, lev1);
}
mps_epvm_save(pool1);
lev1++;
}
j = ranint(40);
switch (j) {
case 1:
if (lev1==1) break;
lev1--;
mps_epvm_restore(pool1, lev1);
comment("Restore to %i", lev1);
while (ranint(2) && (lev1>1)) {
lev1--;
mps_epvm_restore(pool1, lev1);
}
break;
case 2:
break;
case 3:
case 4:
if (lev1<MAX_SAVE) {
lev1++;
comment("Save to %i", lev1);
mps_epvm_save(pool1);
}
break;
case 5:
case 6:
break;
default:
if (ranint(2)==0) {
a = allocepvm(ap1p, 8*(ranint(1000)+1));
} else {
}
}
}
mps_ap_destroy(ap1p);
mps_pool_destroy(pool1);
mps_fmt_destroy(format);
mps_root_destroy(root);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
comment("Destroyed arena");
}
int main(void) {
void *m;
stackpointer=&m;
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,129 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = EPVM error on destroying pools
language = c
link = testlib.o epvmfmt.o
END_HEADER
*/
#include "testlib.h"
#include "mpscepvm.h"
#include "mpsavm.h"
#include "epvmfmt.h"
#define MAX_SAVE 20
#define INIT_SAVE 3
void *stackpointer;
static void test(void)
{
mps_arena_t arena;
mps_pool_t pool1, pool2;
mps_thr_t thread;
mps_root_t root;
mps_fmt_t format;
mps_ap_t ap1p, ap1s, ap2p, ap2s;
psobj *a;
int i, j;
mps_epvm_save_level_t lev1, lev2;
/* create an arena that can't grow beyond 64M */
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*64)),
"create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_root_create_reg(&root, arena, MPS_RANK_AMBIG, 0, thread,
mps_stack_scan_ambig, stackpointer, 0),
"create root");
cdie(mps_fmt_create_A(&format, arena, &fmtepvm), "create format");
cdie(mps_pool_create(&pool1, arena, mps_class_epvm(),
format, MAX_SAVE, INIT_SAVE), "create pool1");
cdie(mps_pool_create(&pool2, arena, mps_class_epvm(),
format, MAX_SAVE, INIT_SAVE), "create pool2");
cdie(mps_ap_create(&ap1p, pool1, 1), "create ap1p");
cdie(mps_ap_create(&ap1s, pool1, 0), "create ap1s");
cdie(mps_ap_create(&ap2p, pool2, 1), "create ap2p");
cdie(mps_ap_create(&ap2s, pool2, 0), "create ap2s");
lev1 = INIT_SAVE;
lev2 = INIT_SAVE;
for (i=0; i<10000; i++) {
j = ranint(40);
switch (j) {
case 1:
if (lev1==0) break;
lev1--;
comment("Restore 1: %i", lev1);
while (ranint(2) && (lev1>0)) lev1--;
mps_epvm_restore(pool1, lev1);
break;
case 2:
if (lev2==0) break;
lev2--;
while (ranint(2) && (lev2>0)) lev2--;
comment("Restore 2: %i", lev2);
mps_epvm_restore(pool2, lev2);
break;
case 3:
case 4:
if (lev1<MAX_SAVE) {
lev1++;
comment("Save 1 to %i", lev1);
mps_epvm_save(pool1);
}
break;
case 5:
case 6:
if (lev2<MAX_SAVE) {
lev2++;
comment("Save 2 to %i", lev2);
mps_epvm_save(pool2);
}
break;
default:
if (ranint(2)==0) {
a = allocepvm(ap1p, 8*(ranint(10)+1));
} else {
a = allocepvm(ap2p, 8*(ranint(10)+1));
}
}
}
mps_ap_destroy(ap1p);
mps_ap_destroy(ap1s);
mps_ap_destroy(ap2p);
mps_ap_destroy(ap2s);
mps_pool_destroy(pool1);
mps_pool_destroy(pool2);
mps_fmt_destroy(format);
mps_root_destroy(root);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
comment("Destroyed arena");
}
int main(void) {
void *m;
stackpointer=&m;
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,168 +0,0 @@
/*
TEST_HEADER
id = $HopeName: MMQA_test_function!87.c(trunk.2) $
summary = EPVM make sure objects are left intact
language = c
link = testlib.o epvmfmt.o
END_HEADER
*/
#include "testlib.h"
#include "mpscepvm.h"
#include "mpsavm.h"
#include "epvmfmt.h"
#define MAX_SAVE 1000
#define INIT_SAVE 12
void *stackpointer;
#define MAXOBJS 5000
mps_addr_t addrs[MAXOBJS];
size_t sizes[MAXOBJS] = {0};
mps_epvm_save_level_t levels[MAXOBJS];
mps_pool_t pool1;
mps_epvm_save_level_t lev1;
mps_ap_t ap1s;
static void myrestore(mps_epvm_save_level_t i) {
int j;
comment("restore to %i", i);
mps_epvm_restore(pool1, i);
for (j=0; j<MAXOBJS; j++) {
if (levels[j] > i) {
comment("free %i", j);
sizes[j] = (size_t) 0;
}
}
}
static void mycheck(psobj *addr, size_t size) {
int i;
unsigned long ob, om, pb, pm;
pb = (unsigned long) addr;
pm = pb+size;
for (i=0; i<MAXOBJS; i++) {
if (sizes[i] != 0) {
ob = (unsigned long) (addrs[i]);
om = ob + sizes[i];
asserts(om <= pb || ob >= pm,
"overlapping objects: %p, %p", addr, addrs[i]);
}
}
}
static void myalloc(int i) {
size_t s;
psobj *a;
s = 8 * (ranint(50)+1);
a = allocepvm(ap1s, s);
comment("alloc %i at %p level %i", i, a, lev1);
mycheck(a, s);
addrs[i] = a;
sizes[i] = s;
levels[i] = lev1;
}
static void mysave(void) {
if (lev1 < MAX_SAVE) {
lev1++;
comment("save to %i", lev1);
mps_epvm_save(pool1);
}
}
static int myfindblank(int *ii) {
int j;
for (j=0; j<MAXOBJS; j++) {
if (sizes[j]==0) {
*ii = j;
return 1;
}
}
return 0;
}
static void test(void)
{
mps_arena_t arena;
mps_thr_t thread;
mps_root_t root;
mps_fmt_t format;
int i, j;
/* create an arena that can't grow beyond 64M */
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*64)),
"create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_root_create_reg(&root, arena, MPS_RANK_AMBIG, 0, thread,
mps_stack_scan_ambig, stackpointer, 0),
"create root");
cdie(mps_fmt_create_A(&format, arena, &fmtepvm), "create format");
cdie(mps_pool_create(&pool1, arena, mps_class_epvm(),
format, MAX_SAVE, INIT_SAVE), "create pool1");
cdie(mps_ap_create(&ap1s, pool1, 0), "create ap1s");
lev1 = INIT_SAVE;
for (j=0; j<100000; j++) {
if (myfindblank(&i)) {
myalloc(i);
} else {
lev1--;
while(lev1>0 && ranint(100)!=0) {
lev1--;
}
myrestore(lev1);
if (lev1 == 0) {
mysave();
}
}
if (ranint(100)<20) {
mysave();
}
}
mps_ap_destroy(ap1s);
mps_pool_destroy(pool1);
mps_fmt_destroy(format);
mps_root_destroy(root);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
comment("Destroyed arena");
}
int main(void) {
void *m;
stackpointer=&m;
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,85 +0,0 @@
/*
TEST_HEADER
id = $HopeName: MMQA_test_function!88.c(trunk.2) $
summary = EPVM allocate and collect_world
language = c
link = testlib.o epvmfmt.o
END_HEADER
*/
#include "testlib.h"
#include "mpscepvm.h"
#include "mpsavm.h"
#include "epvmfmt.h"
#define MAX_SAVE 32
#define INIT_SAVE 0
void *stackpointer;
psobj *a[100];
static void test(void)
{
mps_arena_t arena;
mps_thr_t thread;
mps_root_t root;
mps_fmt_t format;
mps_pool_t pool1;
mps_epvm_save_level_t lev1;
mps_ap_t ap1s;
int i, j;
alloccomments = 1;
/* create an arena that can't grow beyond 64M */
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*64)),
"create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_root_create_table(&root, arena, MPS_RANK_AMBIG, 0,
(mps_addr_t *)&a[0], 100),
"create root");
cdie(mps_fmt_create_A(&format, arena, &fmtepvm), "create format");
cdie(mps_pool_create(&pool1, arena, mps_class_epvm(),
format, MAX_SAVE, INIT_SAVE), "create pool1");
cdie(mps_ap_create(&ap1s, pool1, 0), "create ap1s");
lev1 = INIT_SAVE;
for (i=0; i<10; i++) {
for (j=0; j<10000; j++) {
a[ranint(100)] = allocepvm(ap1s, (size_t) (8+8*ranint(16)));
}
mps_arena_collect(arena);
comment("collected %i", i);
}
mps_ap_destroy(ap1s);
mps_pool_destroy(pool1);
mps_fmt_destroy(format);
mps_root_destroy(root);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
comment("Destroyed arena");
}
int main(void) {
void *m;
stackpointer=&m;
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,79 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = EPVM allocate and epvm_collect
language = c
link = testlib.o epvmfmt.o
END_HEADER
*/
#include "testlib.h"
#include "mpscepvm.h"
#include "mpsavm.h"
#include "epvmfmt.h"
#define MAX_SAVE 1000
#define INIT_SAVE 12
void *stackpointer;
static void test(void)
{
mps_arena_t arena;
mps_thr_t thread;
mps_root_t root;
mps_fmt_t format;
mps_pool_t pool1;
mps_epvm_save_level_t lev1;
mps_ap_t ap1s;
int i, j;
psobj *a;
/* create an arena that can't grow beyond 64M */
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*64)),
"create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_fmt_create_A(&format, arena, &fmtepvm), "create format");
cdie(mps_pool_create(&pool1, arena, mps_class_epvm(),
format, MAX_SAVE, INIT_SAVE), "create pool1");
cdie(mps_ap_create(&ap1s, pool1, 0), "create ap1s");
lev1 = INIT_SAVE;
for (i=0; i<50; i++) {
for (j=0; j<3000; j++) {
a = allocepvm(ap1s, (size_t) (8+8*ranint(500)));
}
comment("collecting...");
mps_epvm_collect(pool1);
}
mps_ap_destroy(ap1s);
mps_pool_destroy(pool1);
mps_fmt_destroy(format);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
comment("Destroyed arena");
}
int main(void) {
void *m;
stackpointer=&m;
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,120 +0,0 @@
/*
TEST_HEADER
id = $HopeName: MMQA_test_function!90.c(trunk.2) $
summary = various EPVM functional tests
language = c
link = testlib.o epvmfmt.o
END_HEADER
*/
/* This test used to use ambiguous roots, but then EPVM was changed
so as not to "support" them.
*/
#include "testlib.h"
#include "mpscepvm.h"
#include "mpsavm.h"
#include "epvmfmt.h"
#define MAX_SAVE 32
#define INIT_SAVE 4
#define RT_SIZE 1000
void *stackpointer;
static void test(void)
{
mps_arena_t arena;
mps_thr_t thread;
mps_root_t root;
mps_fmt_t format;
mps_pool_t pool1;
mps_ap_t ap1s, ap1p;
unsigned int i, j, k;
psobj *a[RT_SIZE], *b;
/* create an arena that can't grow beyond 64M */
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*64)),
"create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_root_create_table(&root, arena, MPS_RANK_EXACT, 0, &a[0], RT_SIZE),
"create root");
cdie(mps_fmt_create_A(&format, arena, &fmtepvm), "create format");
cdie(mps_pool_create(&pool1, arena, mps_class_epvm(),
format, MAX_SAVE, INIT_SAVE), "create pool1");
cdie(mps_ap_create(&ap1s, pool1, 0), "create ap1s");
cdie(mps_ap_create(&ap1p, pool1, 1), "create ap1p");
asserts(sizeof(unsigned char) == 1, "surprise! -- characters too big!");
for (k=0; k<20; k++) {
comment("%i of 20", k);
comment("allocate string objects of various sizes");
for (i=0; i<256; i++) {
a[i] = allocepvm(ap1s, (size_t) (8+8*i));
for (j=0; j<(8+i*8); j++) {
*((unsigned char *) a[i]+j) = i;
}
}
comment("allocate psobjects pointing to strings");
for (i=0; i<256; i++) {
b = allocepvm(ap1p, (size_t) 8);
b->obj = a[i];
b->size = i+1;
a[i] = b;
}
comment("collect");
mps_epvm_collect(pool1);
comment("check objects are ok");
for (i=0; i<256; i++) {
b = a[i]->obj;
asserts(a[i]->size == i+1, "object %i wrong size", i);
for (j=0; j<(8+i*8); j++) {
asserts(*((unsigned char *) b+j) == i, "object %i corrupt at %i", i, j);
}
}
comment("finished");
}
mps_ap_destroy(ap1s);
mps_ap_destroy(ap1p);
mps_pool_destroy(pool1);
mps_fmt_destroy(format);
mps_root_destroy(root);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
comment("Destroyed arena");
}
int main(void) {
void *m;
stackpointer=&m;
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,90 +0,0 @@
/*
TEST_HEADER
id = $HopeName: MMQA_test_function!91.c(trunk.3) $
summary = EPVM time allocations
language = c
link = testlib.o epvmfmt.o
END_HEADER
*/
#include "testlib.h"
#include "mpscepvm.h"
#include "mpsavm.h"
#include "epvmfmt.h"
#include <time.h>
#define MAX_SAVE 1
#define INIT_SAVE 0
void *stackpointer;
static void timealloc(mps_pool_t pool, mps_ap_t ap, size_t size,
int num, int step) {
int i, j;
clock_t t0, t1;
int secs;
psobj *a;
mps_epvm_save(pool);
t0 = clock();
for (j=0; j<step; j++) {
for (i=0; i<num; i++) {
a = allocepvm(ap, size);
}
t1 = clock();
secs = 100*(t1-t0)/CLOCKS_PER_SEC;
comment("%i, %i, %i", (j+1)*num, size*8, secs);
}
mps_epvm_restore(pool, 0);
}
static void test(void)
{
mps_arena_t arena;
mps_thr_t thread;
mps_fmt_t format;
mps_pool_t pool1;
mps_ap_t ap1s;
size_t size;
asserts(clock() != -1, "processor time not available");
/* create an arena that can't grow beyond 64M */
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*64)),
"create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_fmt_create_A(&format, arena, &fmtepvm), "create format");
cdie(mps_pool_create(&pool1, arena, mps_class_epvm(),
format, MAX_SAVE, INIT_SAVE), "create pool1");
cdie(mps_ap_create(&ap1s, pool1, 0), "create ap1s");
for (size=1; size<128; size+=1) {
timealloc(pool1, ap1s, size, 1000, 50);
}
mps_ap_destroy(ap1s);
mps_pool_destroy(pool1);
mps_fmt_destroy(format);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
comment("Destroyed arena");
}
int main(void) {
void *m;
stackpointer=&m;
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,76 +0,0 @@
/*
TEST_HEADER
id = $HopeName: MMQA_test_function!92.c(trunk.4) $
summary = EPVM allocate and epvm_collect, 8--32 byte objects
language = c
link = testlib.o epvmfmt.o
END_HEADER
*/
#include "testlib.h"
#include "mpscepvm.h"
#include "mpsavm.h"
#include "epvmfmt.h"
#define MAX_SAVE 1000
#define INIT_SAVE 12
void *stackpointer;
static void test(void)
{
mps_arena_t arena;
mps_thr_t thread;
mps_fmt_t format;
mps_pool_t pool1;
mps_epvm_save_level_t lev1;
mps_ap_t ap1s;
int i, j;
psobj *a;
/* create an arena that can't grow beyond 64M */
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*64)),
"create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_fmt_create_A(&format, arena, &fmtepvm), "create format");
cdie(mps_pool_create(&pool1, arena, mps_class_epvm(),
format, MAX_SAVE, INIT_SAVE), "create pool1");
cdie(mps_ap_create(&ap1s, pool1, 0), "create ap1s");
lev1 = INIT_SAVE;
for (i=0; i<50; i++) {
for (j=0; j<10000; j++) {
a = allocepvm(ap1s, (size_t) (1+ranint(4)));
}
comment("collecting...");
mps_epvm_collect(pool1);
}
mps_ap_destroy(ap1s);
mps_pool_destroy(pool1);
mps_fmt_destroy(format);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
comment("Destroyed arena");
}
int main(void) {
void *m;
stackpointer=&m;
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,98 +0,0 @@
/*
TEST_HEADER
id = $HopeName: MMQA_test_function!93.c(trunk.3) $
summary = EPVM time allocations with checklevels
language = c
link = testlib.o epvmfmt.o
END_HEADER
*/
#include "testlib.h"
#include "mpscepvm.h"
#include "mpsavm.h"
#include "epvmfmt.h"
#include <time.h>
#define MAX_SAVE 1
#define INIT_SAVE 0
void *stackpointer;
mps_word_t CheckLevel;
#define CheckNONE 0
#define CheckSHALLOW 1
#define CheckDEEP 2
static void timealloc(mps_pool_t pool, mps_ap_t ap, size_t size, int num, int step) {
int i, j;
clock_t t0, t1;
int secs;
psobj *a;
mps_epvm_save(pool);
t0 = clock();
for (j=0; j<step; j++) {
for (i=0; i<num; i++) {
a = allocepvm(ap, size);
}
t1 = clock();
secs = 100*(t1-t0)/CLOCKS_PER_SEC;
comment("%i, %i, %i", (j+1)*num, size*8, secs);
}
mps_epvm_restore(pool, 0);
}
static void test(void)
{
mps_arena_t arena;
mps_thr_t thread;
mps_fmt_t format;
mps_pool_t pool1;
mps_ap_t ap1s;
size_t size;
asserts(clock() != -1, "processor time not available");
/* create an arena that can't grow beyond 64M */
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*64)),
"create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_fmt_create_A(&format, arena, &fmtepvm), "create format");
cdie(mps_pool_create(&pool1, arena, mps_class_epvm(),
format, MAX_SAVE, INIT_SAVE), "create pool1");
cdie(mps_ap_create(&ap1s, pool1, 0), "create ap1s");
for (size=1; size<32; size+=1) {
for (CheckLevel = CheckNONE; CheckLevel <= CheckDEEP; CheckLevel ++) {
timealloc(pool1, ap1s, size, 10000, 1);
}
CheckLevel = CheckDEEP;
}
mps_ap_destroy(ap1s);
mps_pool_destroy(pool1);
mps_fmt_destroy(format);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
comment("Destroyed arena");
}
int main(void) {
void *m;
stackpointer=&m;
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,93 +0,0 @@
/*
TEST_HEADER
id = $HopeName: MMQA_test_function!94.c(trunk.3) $
summary = EPVM time allocations
language = c
link = testlib.o epvmfmt.o
END_HEADER
*/
#include "testlib.h"
#include "mpscepvm.h"
#include "mpsavm.h"
#include "epvmfmt.h"
#include <time.h>
#define MAX_SAVE 1
#define INIT_SAVE 0
void *stackpointer;
static void timealloc(mps_pool_t pool, mps_ap_t ap, size_t size,
int num, int step) {
int i, j;
clock_t t0, t1;
int secs;
psobj *a;
mps_epvm_save(pool);
t0 = clock();
for (j=0; j<step; j++) {
for (i=0; i<num; i++) {
a = allocepvm(ap, size);
}
t1 = clock();
secs = 100*(t1-t0)/CLOCKS_PER_SEC;
comment("%i, %i, %i", (j+1)*num, size*8, secs);
}
mps_epvm_restore(pool, 0);
}
static void test(void)
{
mps_arena_t arena;
mps_thr_t thread;
mps_fmt_t format;
mps_pool_t pool1;
mps_ap_t ap1s;
size_t size;
int num;
asserts(clock() != -1, "processor time not available");
/* create an arena that can't grow beyond 64M */
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*64)),
"create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_fmt_create_A(&format, arena, &fmtepvm), "create format");
cdie(mps_pool_create(&pool1, arena, mps_class_epvm(),
format, MAX_SAVE, INIT_SAVE), "create pool1");
cdie(mps_ap_create(&ap1s, pool1, 0), "create ap1s");
for (size=1; size<128; size+=1) {
num = 5ul*1024ul*1024ul / (8*size); /* how many fit into 5M */
timealloc(pool1, ap1s, size, num, 1);
}
mps_ap_destroy(ap1s);
mps_pool_destroy(pool1);
mps_fmt_destroy(format);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
comment("Destroyed arena");
}
int main(void) {
void *m;
stackpointer=&m;
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,97 +0,0 @@
/*
TEST_HEADER
id = $HopeName$
summary = EPVM time allocations
language = c
link = testlib.o epvmfmt.o
END_HEADER
*/
#include "testlib.h"
#include "mpscepvm.h"
#include "mpsavm.h"
#include "epvmfmt.h"
#include <time.h>
#define MAX_SAVE 1
#define INIT_SAVE 0
void *stackpointer;
static void timealloc(mps_pool_t pool, mps_ap_t ap, size_t min, size_t max, size_t total) {
int i, j;
clock_t t0, t1;
int secs;
size_t size;
psobj *a;
mps_epvm_save(pool);
t0 = clock();
while (total>0) {
size = ranrange(min, max+1);
if (size > total) {
size = total;
}
a = allocepvm(ap, size);
total-=size;
}
t1 = clock();
secs = 100*(t1-t0)/CLOCKS_PER_SEC;
comment("%i, %i, %i", total*8, (max+1)*4, secs);
mps_epvm_restore(pool, 0);
};
static void test(void)
{
mps_arena_t arena;
mps_thr_t thread;
mps_fmt_t format;
mps_pool_t pool1;
mps_ap_t ap1s;
size_t size;
size_t avgsize;
asserts(clock() != -1, "processor time not available");
/* create an arena that can't grow beyond 64M */
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*64)),
"create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
cdie(mps_fmt_create_A(&format, arena, &fmtepvm), "create format");
cdie(mps_pool_create(&pool1, arena, mps_class_epvm(),
format, MAX_SAVE, INIT_SAVE), "create pool1");
cdie(mps_ap_create(&ap1s, pool1, 0), "create ap1s");
size = 1024ul*1024ul*10ul/8; /* 10 Megabytes */
for (avgsize=1; avgsize<128; avgsize+=1) {
timealloc(pool1, ap1s, 1, 2*avgsize-1, size);
}
mps_ap_destroy(ap1s);
mps_pool_destroy(pool1);
mps_fmt_destroy(format);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
comment("Destroyed arena");
}
int main(void) {
void *m;
stackpointer=&m;
easy_tramp(test);
pass();
return 0;
}

View file

@ -1,141 +0,0 @@
/* $HopeName: MMQA_harness!testlib:epvmfmt.c(trunk.6) $
*/
#include "epvmfmt.h"
#include <string.h>
int alloccomments = 0;
/* the scanning function doesn't try to fix null refs
*/
static mps_res_t epvmscan(mps_ss_t ss, mps_addr_t base, mps_addr_t limit);
static mps_addr_t epvmskip(mps_addr_t object);
static void epvmfwd(mps_addr_t object, mps_addr_t to);
static mps_addr_t epvmisfwd(mps_addr_t object);
static void epvmcopy(mps_addr_t object, mps_addr_t to);
static void epvmpad(mps_addr_t base, size_t size);
static mps_res_t epvmscan(mps_ss_t ss, mps_addr_t base, mps_addr_t limit);
mps_addr_t epvmskip(mps_addr_t object) {
/* error("skip called on EPVM object: %p", object);
*/
asserts(((unsigned long) object & 7) == 0,
"epvmskip called on unaligned object %p", object);
return (mps_addr_t) ((char *)object + 8);
}
void epvmfwd(mps_addr_t object, mps_addr_t to) {
error("fwd called on EPVM object: %p -> %p", object, to);
}
mps_addr_t epvmisfwd(mps_addr_t object) {
error("isfwd called on EPVM object: %p", object);
return NULL;
}
void epvmcopy(mps_addr_t object, mps_addr_t to) {
error("copy called on EPVM object: %p -> %p", object, to);
}
void epvmpad(mps_addr_t base, size_t size) {
error("pad called in EPVM: %p, %u", base, size);
}
struct mps_fmt_A_s fmtepvm =
{
(mps_align_t) 8,
&epvmscan,
&epvmskip,
&epvmcopy,
&epvmfwd,
&epvmisfwd,
&epvmpad
};
/* in the following, size is the number of words you want
to allocate
*/
psobj *allocepvm(mps_ap_t ap, int size) {
psobj *a;
die(allocrepvm(&a, ap, size), "Reserve: ");
return a;
}
mps_res_t allocrepvm(psobj **q, mps_ap_t ap, int size) {
mps_addr_t p;
int i;
size_t bytes;
mps_res_t res;
asserts(sizeof(struct psobj) == 8, "Aaarg! How can EPVM pools possibly work");
bytes = size*8;
asserts(size > 0, "allocepvm with zero size");
do
{
res = mps_reserve(&p, ap, bytes);
if (res != MPS_RES_OK) {
return res;
}
*q=p;
for(i=0; i<size; i+=1)
{
(*q+i)->obj = NULL;
(*q+i)->size = 0;
}
}
while (!mps_commit(ap, p, bytes));
commentif(alloccomments, "allocated %p.", q);
return MPS_RES_OK;
}
void splatepvm(psobj *obj) {
obj->size = 0;
}
mps_bool_t issplatepvm(psobj *obj) {
return (obj->size == 0);
}
static mps_res_t epvmscan(mps_ss_t ss, mps_addr_t base, mps_addr_t limit)
{
unsigned int i;
MPS_SCAN_BEGIN(ss)
{
while (base < limit)
{
psobj *obj = base;
mps_res_t res;
mps_addr_t p;
commentif(alloccomments, "scan %p", base);
asserts(obj->size > 0, "scan on splatted object at %p", obj);
p = obj->obj;
asserts(p != NULL, "NULL pointer in EPVM obj at %p", obj);
res = MPS_FIX(ss, (mps_addr_t *) &p); /* A ghastly PUN! */
if (res != MPS_RES_OK) return res;
asserts(p != NULL, "reference in EPVM fixed to NULL at %p", obj);
obj->obj = p;
for (i=1; i<obj->size; i++) {
p = obj->obj + i;
res = MPS_FIX(ss, (mps_addr_t *) &p);
if (res != MPS_RES_OK) return res;
asserts(p == obj->obj+i, "reference in EPVM changed at %p", obj);
}
base = (char *) base + 8;
}
}
MPS_SCAN_END(ss);
return MPS_RES_OK;
}

View file

@ -1,40 +0,0 @@
/* $HopeName: MMQA_harness!testlib:epvmfmt.h(trunk.4) $
epvmfmt.h
Format for objects in the EPVM pool.
*/
#ifndef epvmfmt_h
#define epvmfmt_h
#include "testlib.h"
extern int alloccomments;
/* the counters are visible so that I can check whether things
get moved etc
*/
/* the object format is visible so tests that want to
can hack around with it
*/
typedef struct psobj psobj;
struct psobj {
psobj *obj;
mps_word_t size;
};
extern struct mps_fmt_A_s fmtepvm;
psobj *allocepvm(mps_ap_t ap, int words);
mps_res_t allocrepvm(psobj **, mps_ap_t ap, int words);
void splatepvm(psobj *obj);
mps_bool_t issplatepvm(psobj *obj);
#endif

View file

@ -9,4 +9,3 @@ myfmt.c
newfmt.c
platform.c
testlib.c
epvmfmt.c