1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-23 07:12:12 -07:00

Fix many mmqa test cases:

* Use commit limit to test exhaustion instead of trying to exhaust virtual memory.
* Use exact roots where possible so that we don't have to worry about local variables pinning down memory.
* Reduce sizes and iterations so that tests complete in a reasonable amount of time.
* Use "MVT" instead of "MV2".
Update the list of passing test cases.

Copied from Perforce
 Change: 186035
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2014-05-12 17:13:00 +01:00
parent 3072f03b78
commit ea61771e1a
17 changed files with 169 additions and 205 deletions

View file

@ -42,6 +42,7 @@ static void test(void)
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*30)),
"create arena");
die(mps_arena_commit_limit_set(arena, 1ul << 20), "commit_limit_set");
cdie(mps_thread_reg(&thread, arena), "register thread");

View file

@ -19,8 +19,6 @@ static mps_gen_param_s testChain[genCOUNT] = {
{ 6000, 0.90 }, { 8000, 0.65 }, { 16000, 0.50 } };
void *stackpointer;
mps_pool_t poolmv;
mps_arena_t arena;
@ -28,28 +26,18 @@ mps_arena_t arena;
static void test(void)
{
mps_pool_t pool;
mps_thr_t thread;
mps_root_t root;
mps_fmt_t format;
mps_chain_t chain;
mps_ap_t ap, ap2;
mycell *a, *b;
mycell *a[2];
mps_res_t res;
int i;
/* create an arena that can't grow beyond 30 M */
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*30)),
"create arena");
mps_arena_commit_limit_set(arena, (size_t) (1024*1024*40));
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");
die(mps_arena_commit_limit_set(arena, 1u << 20), "commit_limit_set");
cdie(mps_fmt_create_A(&format, arena, &fmtA),
"create format");
@ -64,12 +52,14 @@ static void test(void)
/* allocate until full */
i = 0;
b = NULL;
a[0] = a[1] = NULL;
cdie(mps_root_create_table(&root, arena, mps_rank_ambig(), 0, (void *)&a, 2),
"create root");
while (allocrone(&a, ap, 128, mps_rank_exact()) == MPS_RES_OK) {
while (allocrone(&a[0], ap, 128, mps_rank_exact()) == MPS_RES_OK) {
i++;
setref(a, 0, b);
b = a;
setref(a[0], 0, a[1]);
a[1] = a[0];
}
comment("%d objs allocated.", i);
@ -81,7 +71,7 @@ static void test(void)
mps_ap_destroy(ap);
for (i = 0; i < 10; i++) {
res = allocrone(&a, ap2, 128, mps_rank_exact());
res = allocrone(&a[0], ap2, 128, mps_rank_exact());
report("predie", "%s", err_text(res));
}
@ -90,18 +80,17 @@ static void test(void)
mps_root_destroy(root);
for (i = 0; i < 10; i++) {
res = allocrone(&a, ap2, 128, mps_rank_exact());
res = allocrone(&a[0], ap2, 128, mps_rank_exact());
report("postdie", "%s", err_text(res));
}
die(allocrone(&a, ap2, 128, mps_rank_exact()), "alloc failed");
die(allocrone(&a[0], ap2, 128, mps_rank_exact()), "alloc failed");
mps_arena_park(arena);
mps_ap_destroy(ap2);
mps_pool_destroy(pool);
mps_chain_destroy(chain);
mps_fmt_destroy(format);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
comment("Destroyed arena.");
}
@ -109,9 +98,6 @@ static void test(void)
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;

View file

@ -24,8 +24,6 @@ static mps_gen_param_s testChain[genCOUNT] = {
{ 6000, 0.90 }, { 8000, 0.65 }, { 16000, 0.50 } };
void *stackpointer;
mps_pool_t poolmv;
mps_arena_t arena;
@ -33,28 +31,18 @@ mps_arena_t arena;
static void test(void)
{
mps_pool_t pool;
mps_thr_t thread;
mps_root_t root;
mps_fmt_t format;
mps_chain_t chain;
mps_ap_t ap, ap2;
mycell *a, *b;
mycell *a[2];
mps_res_t res;
int i;
/* create an arena that can't grow beyond 30 M */
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*40)),
/* create an arena that can't grow beyond 1 M */
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*4)),
"create arena");
mps_arena_commit_limit_set(arena, (size_t) (1024*1024*30));
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");
mps_arena_commit_limit_set(arena, (size_t) (1024*1024*1));
cdie(
mps_fmt_create_A(&format, arena, &fmtA),
@ -71,12 +59,14 @@ static void test(void)
/* allocate until full */
i = 0;
b = NULL;
a[0] = a[1] = NULL;
cdie(mps_root_create_table(&root, arena, mps_rank_ambig(), 0, (void *)&a, 2),
"create root");
while (allocrone(&a, ap, 128, mps_rank_exact()) == MPS_RES_OK) {
while (allocrone(&a[0], ap, 128, mps_rank_exact()) == MPS_RES_OK) {
i++;
setref(a, 0, b);
b = a;
setref(a[0], 0, a[1]);
a[1] = a[0];
}
comment("%d objs allocated.", i);
@ -88,7 +78,7 @@ static void test(void)
mps_ap_destroy(ap);
for (i = 0; i < 10; i++) {
res = allocrone(&a, ap2, 128, mps_rank_exact());
res = allocrone(&a[0], ap2, 128, mps_rank_exact());
report("predie", "%s", err_text(res));
}
@ -97,7 +87,7 @@ static void test(void)
mps_root_destroy(root);
for (i = 0; i < 10; i++) {
res = allocrone(&a, ap2, 128, mps_rank_exact());
res = allocrone(&a[0], ap2, 128, mps_rank_exact());
report("postdie", "%s", err_text(res));
}
@ -106,7 +96,6 @@ static void test(void)
mps_pool_destroy(pool);
mps_chain_destroy(chain);
mps_fmt_destroy(format);
mps_thread_dereg(thread);
mps_arena_destroy(arena);
comment("Destroyed arena.");
}
@ -114,9 +103,6 @@ static void test(void)
int main(void)
{
void *m;
stackpointer=&m; /* hack to get stack pointer */
easy_tramp(test);
pass();
return 0;

View file

@ -23,8 +23,8 @@ OUTPUT_SPEC
spill5 <= 0
grow5 = 0
avail5 > 1500000
allocfail2 > 10000
failres2 = MEMORY
allocfail2 > 5000
failres2 = COMMIT_LIMIT
shrink6 > 1000000
spill6 <= 0
completed = yes

View file

@ -5,7 +5,7 @@ TEST_HEADER
language = c
link = testlib.o rankfmt.o
OUTPUT_SPEC
allocfail3 > 8000
allocfail3 > 3000
failres3 = COMMIT_LIMIT
spill8 <= 0
spill9 <= 0

View file

@ -23,8 +23,8 @@ OUTPUT_SPEC
spill5 <= 0
grow5 = 0
avail5 > 1500000
allocfail2 > 10000
failres2 = MEMORY
allocfail2 > 5000
failres2 = COMMIT_LIMIT
shrink6 > 1000000
spill6 <= 0
completed = yes

View file

@ -5,7 +5,7 @@ TEST_HEADER
language = c
link = testlib.o newfmt.o
OUTPUT_SPEC
errtext = create pool: MEMORY
errtext = create pool: COMMIT_LIMIT
END_HEADER
*/
@ -39,6 +39,7 @@ static void test(void)
cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE),
"create arena");
die(mps_arena_commit_limit_set(arena, 1ul << 30), "commit_limit_set");
die(mps_thread_reg(&thread, arena), "register thread");
die(mps_root_create_reg(&root, arena, mps_rank_ambig(), 0, thread,
mps_stack_scan_ambig, stackpointer, 0),

View file

@ -5,7 +5,7 @@ TEST_HEADER
language = c
link = testlib.o newfmt.o
OUTPUT_SPEC
errtext = create ap: MEMORY
errtext = create ap: COMMIT_LIMIT
END_HEADER
*/
@ -40,6 +40,7 @@ static void test(void)
cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE),
"create arena");
die(mps_arena_commit_limit_set(arena, 1ul << 30), "commit_limit_set");
die(mps_thread_reg(&thread, arena), "register thread");
die(mps_root_create_reg(&root, arena, mps_rank_ambig(), 0, thread,
mps_stack_scan_ambig, stackpointer, 0),

View file

@ -5,7 +5,7 @@ TEST_HEADER
language = c
link = testlib.o newfmt.o
OUTPUT_SPEC
errtext = create format: MEMORY
errtext = create format: COMMIT_LIMIT
END_HEADER
*/
@ -27,6 +27,7 @@ static void test(void) {
int p;
die(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create");
die(mps_arena_commit_limit_set(arena, 1ul << 30), "commit_limit_set");
die(mps_thread_reg(&thread, arena), "register thread");
die(mps_root_create_reg(&root, arena, mps_rank_ambig(), 0, thread,
mps_stack_scan_ambig, stackpointer, 0), "create root");

View file

@ -1,7 +1,7 @@
/*
TEST_HEADER
id = $Id$
summary = new MV2 allocation test
summary = new MVT allocation test
language = c
link = testlib.o
END_HEADER
@ -9,14 +9,10 @@ END_HEADER
#include <time.h>
#include "testlib.h"
#include "mpscmv2.h"
#include "mpscmvt.h"
#include "mpsavm.h"
#define MAXNUMBER 1000000
/* this shouldn't be necessary, but it's not provided anywhere */
typedef MPS_T_WORD mps_count_t;
#define MAXNUMBER 100000
void *stackpointer;
mps_arena_t arena;
@ -42,7 +38,7 @@ static void setobj(mps_addr_t a, size_t size, unsigned char val)
}
}
static mps_res_t mv2_alloc(mps_addr_t *ref, mps_ap_t ap, size_t size) {
static mps_res_t mvt_alloc(mps_addr_t *ref, mps_ap_t ap, size_t size) {
mps_res_t res;
size = ((size+7)/8)*8;
@ -73,7 +69,7 @@ static int chkobj(mps_addr_t a, size_t size, unsigned char val)
static void dt(int kind,
size_t minSize, size_t avgSize, size_t maxSize,
mps_count_t depth, mps_count_t fragLimit,
mps_word_t depth, mps_word_t fragLimit,
size_t mins, size_t maxs, int number, int iter)
{
mps_pool_t pool;
@ -89,9 +85,9 @@ static void dt(int kind,
asserts(time0 != -1, "processor time not available");
die(
mps_pool_create(&pool, arena, mps_class_mv2(),
mps_pool_create(&pool, arena, mps_class_mvt(),
minSize, avgSize, maxSize, depth, fragLimit),
"create MV2 pool");
"create MVT pool");
die(mps_ap_create(&ap, pool, mps_rank_ambig()), "create ap");
@ -104,7 +100,7 @@ static void dt(int kind,
}
else
{
die(mv2_alloc(&queue[hd].addr, ap, size), "alloc");
die(mvt_alloc(&queue[hd].addr, ap, size), "alloc");
setobj(queue[hd].addr, size, (unsigned char) (hd%256));
queue[hd].size = size;
}
@ -136,12 +132,13 @@ static void dt(int kind,
}
else
{
die(mv2_alloc(&queue[hd].addr, ap, size),"alloc");
die(mvt_alloc(&queue[hd].addr, ap, size),"alloc");
setobj(queue[hd].addr, size, (unsigned char) (hd%256));
queue[hd].size = size;
}
}
mps_ap_destroy(ap);
mps_pool_destroy(pool);
time1=clock();
@ -157,7 +154,7 @@ static void test(void)
{
mps_thr_t thread;
size_t mins;
mps_count_t dep, frag;
mps_word_t dep, frag;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)), "create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
@ -170,34 +167,34 @@ static void test(void)
comment("Frag: %i", frag);
dt(SEQ, 8, 8, 9, dep, frag, 8, 9, 5, 1000);
dt(RANGAP, 64, 64, 64, dep, frag, 8, 128, 100, 100000);
dt(SEQ, 8, 8, 9, dep, frag, 8, 9, 5, 100);
dt(RANGAP, 64, 64, 64, dep, frag, 8, 128, 100, 10000);
dt(DUMMY, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000);
dt(SEQ, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000);
dt(RAN, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000);
dt(SEQGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000);
dt(RANGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000);
dt(DUMMY, 8, 32, 64, dep, frag, 8, 64, 1000, 100000);
dt(SEQ, 8, 32, 64, dep, frag, 8, 64, 1000, 100000);
dt(RAN, 8, 32, 64, dep, frag, 8, 64, 1000, 100000);
dt(SEQGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 100000);
dt(RANGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 100000);
dt(DUMMY, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000);
dt(SEQ, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000);
dt(RAN, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000);
dt(SEQGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000);
dt(RANGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000);
dt(DUMMY, 100, 116, 132, dep, frag, 100, 132, 1000, 100000);
dt(SEQ, 100, 116, 132, dep, frag, 100, 132, 1000, 100000);
dt(RAN, 100, 116, 132, dep, frag, 100, 132, 1000, 100000);
dt(SEQGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 100000);
dt(RANGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 100000);
dt(DUMMY, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(SEQ, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(RAN, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(SEQGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(RANGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(DUMMY, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(SEQ, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(RAN, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(SEQGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(RANGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000);
/* try again using exceptional obj for anything over 16K */
dt(DUMMY, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(SEQ, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(RAN, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(SEQGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(RANGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(DUMMY, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(SEQ, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(RAN, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(SEQGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(RANGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000);
}

View file

@ -1,7 +1,7 @@
/*
TEST_HEADER
id = $Id$
summary = new MV2 allocation test, extra shallow
summary = new MVT allocation test, extra shallow
language = c
link = testlib.o
END_HEADER
@ -9,15 +9,11 @@ END_HEADER
#include <time.h>
#include "testlib.h"
#include "mpscmv2.h"
#include "mpscmvt.h"
#include "mpsavm.h"
#define MAXNUMBER 1000000
/* this shouldn't be necessary, but it's not provided anywhere */
typedef MPS_T_WORD mps_count_t;
void *stackpointer;
mps_arena_t arena;
@ -42,7 +38,7 @@ static void setobj(mps_addr_t a, size_t size, unsigned char val)
}
}
static mps_res_t mv2_alloc(mps_addr_t *ref, mps_ap_t ap, size_t size) {
static mps_res_t mvt_alloc(mps_addr_t *ref, mps_ap_t ap, size_t size) {
mps_res_t res;
size = ((size+7)/8)*8;
@ -73,7 +69,7 @@ static int chkobj(mps_addr_t a, size_t size, unsigned char val)
static void dt(int kind,
size_t minSize, size_t avgSize, size_t maxSize,
mps_count_t depth, mps_count_t fragLimit,
mps_word_t depth, mps_word_t fragLimit,
size_t mins, size_t maxs, int number, int iter)
{
mps_pool_t pool;
@ -89,9 +85,9 @@ static void dt(int kind,
asserts(time0 != -1, "processor time not available");
die(
mps_pool_create(&pool, arena, mps_class_mv2(),
mps_pool_create(&pool, arena, mps_class_mvt(),
minSize, avgSize, maxSize, depth, fragLimit),
"create MV2 pool");
"create MVT pool");
die(mps_ap_create(&ap, pool, mps_rank_ambig()), "create ap");
@ -104,7 +100,7 @@ static void dt(int kind,
}
else
{
die(mv2_alloc(&queue[hd].addr, ap, size), "alloc");
die(mvt_alloc(&queue[hd].addr, ap, size), "alloc");
setobj(queue[hd].addr, size, (unsigned char) (hd%256));
queue[hd].size = size;
}
@ -136,12 +132,13 @@ static void dt(int kind,
}
else
{
die(mv2_alloc(&queue[hd].addr, ap, size),"alloc");
die(mvt_alloc(&queue[hd].addr, ap, size),"alloc");
setobj(queue[hd].addr, size, (unsigned char) (hd%256));
queue[hd].size = size;
}
}
mps_ap_destroy(ap);
mps_pool_destroy(pool);
time1=clock();
@ -157,7 +154,7 @@ static void test(void)
{
mps_thr_t thread;
size_t mins;
mps_count_t dep, frag;
mps_word_t dep, frag;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)), "create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
@ -170,34 +167,34 @@ static void test(void)
comment("Frag: %i", frag);
dt(SEQ, 8, 8, 9, dep, frag, 8, 9, 5, 1000);
dt(RANGAP, 64, 64, 64, dep, frag, 8, 128, 100, 100000);
dt(SEQ, 8, 8, 9, dep, frag, 8, 9, 5, 100);
dt(RANGAP, 64, 64, 64, dep, frag, 8, 128, 100, 10000);
dt(DUMMY, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000);
dt(SEQ, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000);
dt(RAN, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000);
dt(SEQGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000);
dt(RANGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000);
dt(DUMMY, 8, 32, 64, dep, frag, 8, 64, 1000, 100000);
dt(SEQ, 8, 32, 64, dep, frag, 8, 64, 1000, 100000);
dt(RAN, 8, 32, 64, dep, frag, 8, 64, 1000, 100000);
dt(SEQGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 100000);
dt(RANGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 100000);
dt(DUMMY, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000);
dt(SEQ, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000);
dt(RAN, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000);
dt(SEQGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000);
dt(RANGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000);
dt(DUMMY, 100, 116, 132, dep, frag, 100, 132, 1000, 100000);
dt(SEQ, 100, 116, 132, dep, frag, 100, 132, 1000, 100000);
dt(RAN, 100, 116, 132, dep, frag, 100, 132, 1000, 100000);
dt(SEQGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 100000);
dt(RANGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 100000);
dt(DUMMY, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(SEQ, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(RAN, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(SEQGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(RANGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(DUMMY, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(SEQ, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(RAN, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(SEQGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(RANGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000);
/* try again using exceptional obj for anything over 16K */
dt(DUMMY, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(SEQ, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(RAN, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(SEQGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(RANGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(DUMMY, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(SEQ, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(RAN, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(SEQGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(RANGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000);
}

View file

@ -1,7 +1,7 @@
/*
TEST_HEADER
id = $Id$
summary = new MV2 allocation test, extra deep
summary = new MVT allocation test, extra deep
language = c
link = testlib.o
END_HEADER
@ -9,15 +9,11 @@ END_HEADER
#include <time.h>
#include "testlib.h"
#include "mpscmv2.h"
#include "mpscmvt.h"
#include "mpsavm.h"
#define MAXNUMBER 1000000
/* this shouldn't be necessary, but it's not provided anywhere */
typedef MPS_T_WORD mps_count_t;
void *stackpointer;
mps_arena_t arena;
@ -42,7 +38,7 @@ static void setobj(mps_addr_t a, size_t size, unsigned char val)
}
}
static mps_res_t mv2_alloc(mps_addr_t *ref, mps_ap_t ap, size_t size) {
static mps_res_t mvt_alloc(mps_addr_t *ref, mps_ap_t ap, size_t size) {
mps_res_t res;
size = ((size+7)/8)*8;
@ -73,7 +69,7 @@ static int chkobj(mps_addr_t a, size_t size, unsigned char val)
static void dt(int kind,
size_t minSize, size_t avgSize, size_t maxSize,
mps_count_t depth, mps_count_t fragLimit,
mps_word_t depth, mps_word_t fragLimit,
size_t mins, size_t maxs, int number, int iter)
{
mps_pool_t pool;
@ -89,9 +85,9 @@ static void dt(int kind,
asserts(time0 != -1, "processor time not available");
die(
mps_pool_create(&pool, arena, mps_class_mv2(),
mps_pool_create(&pool, arena, mps_class_mvt(),
minSize, avgSize, maxSize, depth, fragLimit),
"create MV2 pool");
"create MVT pool");
die(mps_ap_create(&ap, pool, mps_rank_ambig()), "create ap");
@ -104,7 +100,7 @@ static void dt(int kind,
}
else
{
die(mv2_alloc(&queue[hd].addr, ap, size), "alloc");
die(mvt_alloc(&queue[hd].addr, ap, size), "alloc");
setobj(queue[hd].addr, size, (unsigned char) (hd%256));
queue[hd].size = size;
}
@ -136,12 +132,13 @@ static void dt(int kind,
}
else
{
die(mv2_alloc(&queue[hd].addr, ap, size),"alloc");
die(mvt_alloc(&queue[hd].addr, ap, size),"alloc");
setobj(queue[hd].addr, size, (unsigned char) (hd%256));
queue[hd].size = size;
}
}
mps_ap_destroy(ap);
mps_pool_destroy(pool);
time1=clock();
@ -157,7 +154,7 @@ static void test(void)
{
mps_thr_t thread;
size_t mins;
mps_count_t dep, frag;
mps_word_t dep, frag;
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)), "create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
@ -170,34 +167,34 @@ static void test(void)
comment("Frag: %i", frag);
dt(SEQ, 8, 8, 9, dep, frag, 8, 9, 5, 1000);
dt(RANGAP, 64, 64, 64, dep, frag, 8, 128, 100, 100000);
dt(SEQ, 8, 8, 9, dep, frag, 8, 9, 5, 100);
dt(RANGAP, 64, 64, 64, dep, frag, 8, 128, 100, 10000);
dt(DUMMY, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000);
dt(SEQ, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000);
dt(RAN, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000);
dt(SEQGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000);
dt(RANGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 1000000);
dt(DUMMY, 8, 32, 64, dep, frag, 8, 64, 1000, 100000);
dt(SEQ, 8, 32, 64, dep, frag, 8, 64, 1000, 100000);
dt(RAN, 8, 32, 64, dep, frag, 8, 64, 1000, 100000);
dt(SEQGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 100000);
dt(RANGAP, 8, 32, 64, dep, frag, 8, 64, 1000, 100000);
dt(DUMMY, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000);
dt(SEQ, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000);
dt(RAN, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000);
dt(SEQGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000);
dt(RANGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 1000000);
dt(DUMMY, 100, 116, 132, dep, frag, 100, 132, 1000, 100000);
dt(SEQ, 100, 116, 132, dep, frag, 100, 132, 1000, 100000);
dt(RAN, 100, 116, 132, dep, frag, 100, 132, 1000, 100000);
dt(SEQGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 100000);
dt(RANGAP, 100, 116, 132, dep, frag, 100, 132, 1000, 100000);
dt(DUMMY, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(SEQ, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(RAN, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(SEQGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(RANGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(DUMMY, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(SEQ, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(RAN, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(SEQGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(RANGAP, mins, 60*1024, 120*1024, dep, frag, mins, 128*1024, 100, 1000);
/* try again using exceptional obj for anything over 16K */
dt(DUMMY, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(SEQ, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(RAN, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(SEQGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(RANGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 10000);
dt(DUMMY, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(SEQ, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(RAN, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(SEQGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000);
dt(RANGAP, mins, 8*1024, 16*1024, dep, frag, mins, 128*1024, 100, 1000);
}

View file

@ -1,7 +1,7 @@
/*
TEST_HEADER
id = $Id$
summary = MV2 greed test
summary = MVT greed test
language = c
link = testlib.o
parameters = OBJECTS=1000 OBJSIZE=8192 DEPTH=2 FRAGLIMIT=50
@ -9,19 +9,15 @@ END_HEADER
*/
#include "testlib.h"
#include "mpscmv2.h"
#include "mpscmvt.h"
#include "mpsavm.h"
/* this shouldn't be necessary, but it's not provided anywhere */
typedef MPS_T_WORD mps_count_t;
void *stackpointer;
mps_arena_t arena;
static mps_addr_t objs[OBJECTS];
static mps_res_t mv2_alloc(mps_addr_t *ref, mps_ap_t ap, size_t size) {
static mps_res_t mvt_alloc(mps_addr_t *ref, mps_ap_t ap, size_t size) {
mps_res_t res;
size = ((size+7)/8)*8;
@ -43,20 +39,20 @@ static void test (void) {
cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*100)), "create arena");
cdie(mps_thread_reg(&thread, arena), "register thread");
die(
mps_pool_create(&pool, arena, mps_class_mv2(),
mps_pool_create(&pool, arena, mps_class_mvt(),
OBJSIZE, OBJSIZE, OBJSIZE, DEPTH, FRAGLIMIT),
"create MV2 pool");
"create MVT pool");
die(mps_ap_create(&ap, pool, mps_rank_ambig()), "create ap");
for (i = 0; i < OBJECTS; i++) {
die(mv2_alloc(&objs[i], ap, OBJSIZE), "alloc");
die(mvt_alloc(&objs[i], ap, OBJSIZE), "alloc");
}
report("size1", "%ld", mps_arena_committed(arena));
for (i = 0; i < OBJECTS; i+=2) {
mps_free(pool, objs[i], OBJSIZE);
die(mv2_alloc(&objs[i], ap, OBJSIZE), "alloc");
die(mvt_alloc(&objs[i], ap, OBJSIZE), "alloc");
}
report("size2", "%ld", mps_arena_committed(arena));

View file

@ -24,7 +24,7 @@ END_HEADER
#define BACKITER (32)
#define RAMPSIZE (128)
#define ITERATIONS (1000000ul)
#define ITERATIONS (100000ul)
#define RAMP_INTERFACE
/*
@ -97,7 +97,7 @@ static void test(void) {
mps_ap_create(&apamc, poolamc, mps_rank_exact()),
"create ap");
mps_message_type_enable(arena, mps_message_type_collection_stats());
mps_message_type_enable(arena, mps_message_type_gc());
inramp = 0;
@ -138,14 +138,13 @@ static void test(void) {
rsize = 0;
}
}
if(mps_message_get(&message, arena, mps_message_type_collection_stats())) {
if(mps_message_get(&message, arena, mps_message_type_gc())) {
unsigned long live, condemned, notCondemned;
live = mps_message_collection_stats_live_size(arena, message);
condemned = mps_message_collection_stats_condemned_size(arena, message);
notCondemned =
mps_message_collection_stats_not_condemned_size(arena, message);
live = mps_message_gc_live_size(arena, message);
condemned = mps_message_gc_condemned_size(arena, message);
notCondemned = mps_message_gc_not_condemned_size(arena, message);
comment("Collection: live=%ld, condemned=%ld, not condemned = %ld",
live, condemned, notCondemned);
live, condemned, notCondemned);
mps_message_discard(arena, message);
}
}

View file

@ -6,6 +6,8 @@ TEST_HEADER
link = testlib.o
harness = 2.5
parameters = EXTENDBY=65536 AVGSIZE=32 PROMISE=64 ITERATE=2000
OUTPUT_SPEC
errtext = alloc: COMMIT_LIMIT
END_HEADER
This one is supposed to fail, telling us that MV is badly fragmented.
@ -16,7 +18,7 @@ This one is supposed to fail, telling us that MV is badly fragmented.
#include "mpsavm.h"
#define VMNZSIZE ((size_t) 30*1024*1024)
#define VMSIZE ((size_t) 30*1024*1024)
static void test(void)
@ -26,8 +28,8 @@ static void test(void)
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_arena_create(&arena, mps_arena_class_vm(), VMSIZE), "create");
die(mps_arena_commit_limit_set(arena, VMSIZE), "commit limit");
die(mps_pool_create(&pool, arena, mps_class_mv(),
EXTENDBY, AVGSIZE, EXTENDBY),

View file

@ -69,8 +69,8 @@ static void test(void)
b = allocone(apamc, 1, mps_rank_exact());
for (j=1; j<100; j++) {
comment("%i of 100.", j);
for (j=1; j<=10; j++) {
comment("%i of 10.", j);
a = allocone(apamc, 5, mps_rank_exact());
b = a;
c = a;

View file

@ -20,9 +20,9 @@ function/14.c
function/15.c
function/16.c
function/17.c
% function/18.c -- tries to exhaust memory by mps_alloc
% function/19.c -- tries to exhaust memory by mps_alloc
% function/20.c -- tries to exhaust memory by mps_alloc
function/18.c
function/19.c
function/20.c
function/21.c
function/22.c
% function/23.c -- interactive test, can't run unattended
@ -77,7 +77,7 @@ function/73.c
function/74.c
function/75.c
function/76.c
% function/77.c -- slow
function/77.c
function/78.c
function/79.c
function/80.c
@ -104,7 +104,7 @@ function/112.c
function/113.c
function/114.c
% 115 -- no such test
% function/116.c -- tries to exhaust memory by mps_alloc
function/116.c
function/117.c
function/118.c
function/119.c
@ -118,10 +118,10 @@ function/126.c
function/127.c
function/128.c
function/129.c
% function/130.c -- tries to exhaust memory by mps_alloc
% function/131.c -- tries to exhaust memory by mps_alloc
% function/132.c -- failed on allocfail2: wanted > 10000, was 6840 @@@@
% function/133.c -- failed on allocfail3: wanted > 8000, was 3060 @@@@
% function/130.c -- job003789
% function/131.c -- job003789
function/132.c
function/133.c
function/134.c
function/135.c
function/136.c
@ -134,7 +134,7 @@ function/144.c
% 145-146 -- no such test
function/147.c
% function/148.c -- failed on inc4: wanted = 1, was 0 @@@@
% function/149.c -- failed on allocfail2: wanted > 10000, was 6858 @@@@
function/149.c
function/150.c
function/151.c
function/152.c
@ -155,15 +155,15 @@ function/167.c
% function/171.c -- job003495
function/200.c
% 201-202 -- no such test
% function/203.c -- requires mps_count_t and mps_class_mv2
% function/204.c -- requires mps_count_t and mps_class_mv2
% function/205.c -- requires mps_count_t and mps_class_mv2
function/203.c
function/204.c
function/205.c
function/206.c
function/207.c
% 208-213 -- no such test
% function/214.c -- requires mps_count_t and mps_class_mv2
function/214.c
function/215.c
% function/223.c -- requires mps_message_type_collection_stats
% function/224.c -- COMMIT_LIMIT @@@@
function/223.c
function/224.c
% 225 -- no such test
function/226.c