mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Amc/amcz subclass test needs to be other way round now.
Smoke tests for AMCZ -- add it to amcss, amcsshe, amcssth, finaltest and walkt0. Smoke tests for LO -- add it to walkt0. Fix finaltest for AMC and AWL -- need to allocate in generation 0 to get prompt finalization. (Also fix MMQA test function/51.c.) Copied from Perforce Change: 185327 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
47c110129f
commit
b86947796e
8 changed files with 156 additions and 118 deletions
|
|
@ -106,7 +106,7 @@ static void report(mps_arena_t arena)
|
|||
|
||||
/* make -- create one new object */
|
||||
|
||||
static mps_addr_t make(void)
|
||||
static mps_addr_t make(size_t rootsCount)
|
||||
{
|
||||
size_t length = rnd() % (2*avLEN);
|
||||
size_t size = (length+2) * sizeof(mps_word_t);
|
||||
|
|
@ -117,7 +117,7 @@ static mps_addr_t make(void)
|
|||
MPS_RESERVE_BLOCK(res, p, ap, size);
|
||||
if (res)
|
||||
die(res, "MPS_RESERVE_BLOCK");
|
||||
res = dylan_init(p, size, exactRoots, exactRootsCOUNT);
|
||||
res = dylan_init(p, size, exactRoots, rootsCount);
|
||||
if (res)
|
||||
die(res, "dylan_init");
|
||||
} while(!mps_commit(ap, p, size));
|
||||
|
|
@ -139,7 +139,7 @@ static void test_stepper(mps_addr_t object, mps_fmt_t fmt, mps_pool_t pool,
|
|||
|
||||
/* test -- the body of the test */
|
||||
|
||||
static void test(mps_arena_t arena)
|
||||
static void test(mps_arena_t arena, mps_class_t pool_class, size_t roots_count)
|
||||
{
|
||||
mps_fmt_t format;
|
||||
mps_chain_t chain;
|
||||
|
|
@ -155,7 +155,7 @@ static void test(mps_arena_t arena)
|
|||
die(dylan_fmt(&format, arena), "fmt_create");
|
||||
die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create");
|
||||
|
||||
die(mps_pool_create(&pool, arena, mps_class_amc(), format, chain),
|
||||
die(mps_pool_create(&pool, arena, pool_class, format, chain),
|
||||
"pool_create(amc)");
|
||||
|
||||
die(mps_ap_create(&ap, pool, mps_rank_exact()), "BufferCreate");
|
||||
|
|
@ -267,13 +267,13 @@ static void test(mps_arena_t arena)
|
|||
i = (r >> 1) % exactRootsCOUNT;
|
||||
if (exactRoots[i] != objNULL)
|
||||
cdie(dylan_check(exactRoots[i]), "dying root check");
|
||||
exactRoots[i] = make();
|
||||
exactRoots[i] = make(roots_count);
|
||||
if (exactRoots[(exactRootsCOUNT-1) - i] != objNULL)
|
||||
dylan_write(exactRoots[(exactRootsCOUNT-1) - i],
|
||||
exactRoots, exactRootsCOUNT);
|
||||
} else {
|
||||
i = (r >> 1) % ambigRootsCOUNT;
|
||||
ambigRoots[(ambigRootsCOUNT-1) - i] = make();
|
||||
ambigRoots[(ambigRootsCOUNT-1) - i] = make(roots_count);
|
||||
/* Create random interior pointers */
|
||||
ambigRoots[i] = (mps_addr_t)((char *)(ambigRoots[i/2]) + 1);
|
||||
}
|
||||
|
|
@ -317,7 +317,8 @@ int main(int argc, char *argv[])
|
|||
*/
|
||||
/*die(mps_arena_commit_limit_set(arena, testArenaSIZE), "set limit");*/
|
||||
die(mps_thread_reg(&thread, arena), "thread_reg");
|
||||
test(arena);
|
||||
test(arena, mps_class_amc(), exactRootsCOUNT);
|
||||
test(arena, mps_class_amcz(), 0);
|
||||
mps_thread_dereg(thread);
|
||||
report(arena);
|
||||
mps_arena_destroy(arena);
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ static mps_addr_t exactRoots[exactRootsCOUNT];
|
|||
static mps_addr_t ambigRoots[ambigRootsCOUNT];
|
||||
static mps_addr_t bogusRoots[bogusRootsCOUNT];
|
||||
|
||||
static mps_addr_t make(void)
|
||||
static mps_addr_t make(size_t roots_count)
|
||||
{
|
||||
size_t length = rnd() % (2*avLEN);
|
||||
size_t size = (length+2) * sizeof(mps_word_t);
|
||||
|
|
@ -61,7 +61,7 @@ static mps_addr_t make(void)
|
|||
if (res)
|
||||
die(res, "MPS_RESERVE_BLOCK");
|
||||
userP = (mps_addr_t)((char*)p + headerSIZE);
|
||||
res = dylan_init(userP, size, exactRoots, exactRootsCOUNT);
|
||||
res = dylan_init(userP, size, exactRoots, roots_count);
|
||||
if (res)
|
||||
die(res, "dylan_init");
|
||||
((int*)p)[0] = realHeader;
|
||||
|
|
@ -110,9 +110,8 @@ static void report(mps_arena_t arena)
|
|||
|
||||
/* test -- the body of the test */
|
||||
|
||||
static void *test(void *arg, size_t s)
|
||||
static void *test(mps_arena_t arena, mps_class_t pool_class, size_t roots_count)
|
||||
{
|
||||
mps_arena_t arena;
|
||||
mps_fmt_t format;
|
||||
mps_chain_t chain;
|
||||
mps_root_t exactRoot, ambigRoot, bogusRoot;
|
||||
|
|
@ -123,13 +122,10 @@ static void *test(void *arg, size_t s)
|
|||
mps_ap_t busy_ap;
|
||||
mps_addr_t busy_init;
|
||||
|
||||
arena = (mps_arena_t)arg;
|
||||
(void)s; /* unused */
|
||||
|
||||
die(EnsureHeaderFormat(&format, arena), "fmt_create");
|
||||
die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create");
|
||||
|
||||
die(mps_pool_create(&pool, arena, mps_class_amc(), format, chain),
|
||||
die(mps_pool_create(&pool, arena, pool_class, format, chain),
|
||||
"pool_create(amc)");
|
||||
|
||||
die(mps_ap_create(&ap, pool, mps_rank_exact()), "BufferCreate");
|
||||
|
|
@ -218,13 +214,13 @@ static void *test(void *arg, size_t s)
|
|||
i = (r >> 1) % exactRootsCOUNT;
|
||||
if (exactRoots[i] != objNULL)
|
||||
die(HeaderFormatCheck(exactRoots[i]), "wrapper check");
|
||||
exactRoots[i] = make();
|
||||
exactRoots[i] = make(roots_count);
|
||||
if (exactRoots[(exactRootsCOUNT-1) - i] != objNULL)
|
||||
dylan_write(exactRoots[(exactRootsCOUNT-1) - i],
|
||||
exactRoots, exactRootsCOUNT);
|
||||
} else {
|
||||
i = (r >> 1) % ambigRootsCOUNT;
|
||||
ambigRoots[(ambigRootsCOUNT-1) - i] = make();
|
||||
ambigRoots[(ambigRootsCOUNT-1) - i] = make(roots_count);
|
||||
/* Create random interior pointers */
|
||||
ambigRoots[i] = (mps_addr_t)((char *)(ambigRoots[i/2]) + 1);
|
||||
}
|
||||
|
|
@ -259,7 +255,6 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
mps_arena_t arena;
|
||||
mps_thr_t thread;
|
||||
void *r;
|
||||
|
||||
testlib_init(argc, argv);
|
||||
|
||||
|
|
@ -272,7 +267,8 @@ int main(int argc, char *argv[])
|
|||
*/
|
||||
/*die(mps_arena_commit_limit_set(arena, testArenaSIZE), "set limit");*/
|
||||
die(mps_thread_reg(&thread, arena), "thread_reg");
|
||||
mps_tramp(&r, test, arena, 0);
|
||||
test(arena, mps_class_amc(), exactRootsCOUNT);
|
||||
test(arena, mps_class_amcz(), 0);
|
||||
mps_thread_dereg(thread);
|
||||
mps_arena_destroy(arena);
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ static mps_gen_param_s testChain[genCOUNT] = {
|
|||
#define objNULL ((mps_addr_t)MPS_WORD_CONST(0xDECEA5ED))
|
||||
|
||||
|
||||
static mps_pool_t pool;
|
||||
static mps_addr_t exactRoots[exactRootsCOUNT];
|
||||
static mps_addr_t ambigRoots[ambigRootsCOUNT];
|
||||
|
||||
|
|
@ -86,7 +85,7 @@ unsigned long objs = 0;
|
|||
|
||||
/* make -- create one new object */
|
||||
|
||||
static mps_addr_t make(mps_ap_t ap)
|
||||
static mps_addr_t make(mps_ap_t ap, size_t roots_count)
|
||||
{
|
||||
size_t length = rnd() % (2*avLEN);
|
||||
size_t size = (length+2) * sizeof(mps_word_t);
|
||||
|
|
@ -97,7 +96,7 @@ static mps_addr_t make(mps_ap_t ap)
|
|||
MPS_RESERVE_BLOCK(res, p, ap, size);
|
||||
if (res)
|
||||
die(res, "MPS_RESERVE_BLOCK");
|
||||
res = dylan_init(p, size, exactRoots, exactRootsCOUNT);
|
||||
res = dylan_init(p, size, exactRoots, roots_count);
|
||||
if (res)
|
||||
die(res, "dylan_init");
|
||||
} while(!mps_commit(ap, p, size));
|
||||
|
|
@ -108,16 +107,16 @@ static mps_addr_t make(mps_ap_t ap)
|
|||
|
||||
/* test_stepper -- stepping function for walk */
|
||||
|
||||
static void test_stepper(mps_addr_t object, mps_fmt_t fmt, mps_pool_t pol,
|
||||
static void test_stepper(mps_addr_t object, mps_fmt_t fmt, mps_pool_t pool,
|
||||
void *p, size_t s)
|
||||
{
|
||||
testlib_unused(object); testlib_unused(fmt); testlib_unused(pol);
|
||||
testlib_unused(object); testlib_unused(fmt); testlib_unused(pool);
|
||||
testlib_unused(s);
|
||||
(*(unsigned long *)p)++;
|
||||
}
|
||||
|
||||
|
||||
/* init -- initialize pool and roots */
|
||||
/* init -- initialize roots and chain */
|
||||
|
||||
static void init(void)
|
||||
{
|
||||
|
|
@ -126,9 +125,6 @@ static void init(void)
|
|||
die(dylan_fmt(&format, arena), "fmt_create");
|
||||
die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create");
|
||||
|
||||
die(mps_pool_create(&pool, arena, mps_class_amc(), format, chain),
|
||||
"pool_create(amc)");
|
||||
|
||||
for(i = 0; i < exactRootsCOUNT; ++i)
|
||||
exactRoots[i] = objNULL;
|
||||
for(i = 0; i < ambigRootsCOUNT; ++i)
|
||||
|
|
@ -146,13 +142,12 @@ static void init(void)
|
|||
}
|
||||
|
||||
|
||||
/* finish -- finish pool and roots */
|
||||
/* finish -- finish roots and chain */
|
||||
|
||||
static void finish(void)
|
||||
{
|
||||
mps_root_destroy(exactRoot);
|
||||
mps_root_destroy(ambigRoot);
|
||||
mps_pool_destroy(pool);
|
||||
mps_chain_destroy(chain);
|
||||
mps_fmt_destroy(format);
|
||||
}
|
||||
|
|
@ -160,7 +155,7 @@ static void finish(void)
|
|||
|
||||
/* churn -- create an object and install into roots */
|
||||
|
||||
static void churn(mps_ap_t ap)
|
||||
static void churn(mps_ap_t ap, size_t roots_count)
|
||||
{
|
||||
size_t i;
|
||||
size_t r;
|
||||
|
|
@ -171,22 +166,52 @@ static void churn(mps_ap_t ap)
|
|||
i = (r >> 1) % exactRootsCOUNT;
|
||||
if (exactRoots[i] != objNULL)
|
||||
cdie(dylan_check(exactRoots[i]), "dying root check");
|
||||
exactRoots[i] = make(ap);
|
||||
exactRoots[i] = make(ap, roots_count);
|
||||
if (exactRoots[(exactRootsCOUNT-1) - i] != objNULL)
|
||||
dylan_write(exactRoots[(exactRootsCOUNT-1) - i],
|
||||
exactRoots, exactRootsCOUNT);
|
||||
} else {
|
||||
i = (r >> 1) % ambigRootsCOUNT;
|
||||
ambigRoots[(ambigRootsCOUNT-1) - i] = make(ap);
|
||||
ambigRoots[(ambigRootsCOUNT-1) - i] = make(ap, roots_count);
|
||||
/* Create random interior pointers */
|
||||
ambigRoots[i] = (mps_addr_t)((char *)(ambigRoots[i/2]) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
typedef struct closure_s {
|
||||
mps_pool_t pool;
|
||||
size_t roots_count;
|
||||
} closure_s, *closure_t;
|
||||
|
||||
static void *kid_thread(void *arg)
|
||||
{
|
||||
void *marker = ▮
|
||||
mps_thr_t thread;
|
||||
mps_root_t reg_root;
|
||||
mps_ap_t ap;
|
||||
closure_t cl = arg;
|
||||
|
||||
die(mps_thread_reg(&thread, (mps_arena_t)arena), "thread_reg");
|
||||
die(mps_root_create_reg(®_root, arena, mps_rank_ambig(), 0, thread,
|
||||
mps_stack_scan_ambig, marker, 0), "root_create");
|
||||
|
||||
die(mps_ap_create(&ap, cl->pool, mps_rank_exact()), "BufferCreate(fooey)");
|
||||
while(mps_collections(arena) < collectionsCOUNT) {
|
||||
churn(ap, cl->roots_count);
|
||||
}
|
||||
mps_ap_destroy(ap);
|
||||
|
||||
mps_root_destroy(reg_root);
|
||||
mps_thread_dereg(thread);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* test -- the body of the test */
|
||||
|
||||
static void *test(void *arg, size_t s)
|
||||
static void *test(mps_class_t pool_class, size_t roots_count)
|
||||
{
|
||||
size_t i;
|
||||
mps_word_t collections, rampSwitch;
|
||||
|
|
@ -194,9 +219,21 @@ static void *test(void *arg, size_t s)
|
|||
int ramping;
|
||||
mps_ap_t ap, busy_ap;
|
||||
mps_addr_t busy_init;
|
||||
mps_pool_t pool;
|
||||
pthread_t kids[10];
|
||||
closure_s cl;
|
||||
|
||||
arena = (mps_arena_t)arg;
|
||||
(void)s; /* unused */
|
||||
die(mps_pool_create(&pool, arena, pool_class, format, chain),
|
||||
"pool_create(amc)");
|
||||
|
||||
cl.pool = pool;
|
||||
cl.roots_count = roots_count;
|
||||
|
||||
for (i = 0; i < sizeof(kids)/sizeof(kids[0]); ++i) {
|
||||
int err = pthread_create(&kids[i], NULL, kid_thread, &cl);
|
||||
if (err != 0)
|
||||
error("pthread_create returned %d", err);
|
||||
}
|
||||
|
||||
die(mps_ap_create(&ap, pool, mps_rank_exact()), "BufferCreate");
|
||||
die(mps_ap_create(&busy_ap, pool, mps_rank_exact()), "BufferCreate 2");
|
||||
|
|
@ -258,7 +295,7 @@ static void *test(void *arg, size_t s)
|
|||
}
|
||||
}
|
||||
|
||||
churn(ap);
|
||||
churn(ap, roots_count);
|
||||
|
||||
r = (size_t)rnd();
|
||||
|
||||
|
|
@ -276,51 +313,22 @@ static void *test(void *arg, size_t s)
|
|||
mps_ap_destroy(busy_ap);
|
||||
mps_ap_destroy(ap);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static void *fooey2(void *arg, size_t s)
|
||||
{
|
||||
mps_ap_t ap;
|
||||
|
||||
(void)arg; (void)s; /* unused */
|
||||
die(mps_ap_create(&ap, pool, mps_rank_exact()), "BufferCreate(fooey)");
|
||||
while(mps_collections(arena) < collectionsCOUNT) {
|
||||
churn(ap);
|
||||
for (i = 0; i < sizeof(kids)/sizeof(kids[0]); ++i) {
|
||||
int err = pthread_join(kids[i], NULL);
|
||||
if (err != 0)
|
||||
error("pthread_join returned %d", err);
|
||||
}
|
||||
mps_ap_destroy(ap);
|
||||
|
||||
mps_pool_destroy(pool);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static void *fooey(void* childIsFinishedReturn)
|
||||
{
|
||||
void *r;
|
||||
mps_thr_t thread;
|
||||
void *marker = ▮
|
||||
mps_root_t reg_root;
|
||||
|
||||
die(mps_thread_reg(&thread, (mps_arena_t)arena), "thread_reg");
|
||||
die(mps_root_create_reg(®_root, arena, mps_rank_ambig(), 0, thread,
|
||||
mps_stack_scan_ambig, marker, 0), "root_create");
|
||||
mps_tramp(&r, fooey2, NULL, 0);
|
||||
mps_root_destroy(reg_root);
|
||||
mps_thread_dereg(thread);
|
||||
*(int *)childIsFinishedReturn = 1;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
mps_thr_t thread;
|
||||
mps_root_t reg_root;
|
||||
void *marker = ▮
|
||||
pthread_t kids[10];
|
||||
unsigned i;
|
||||
void *r;
|
||||
int childIsFinished = 0;
|
||||
|
||||
testlib_init(argc, argv);
|
||||
|
||||
|
|
@ -331,20 +339,12 @@ int main(int argc, char *argv[])
|
|||
die(mps_thread_reg(&thread, arena), "thread_reg");
|
||||
die(mps_root_create_reg(®_root, arena, mps_rank_ambig(), 0, thread,
|
||||
mps_stack_scan_ambig, marker, 0), "root_create");
|
||||
for (i = 0; i < sizeof(kids)/sizeof(kids[0]); ++i) {
|
||||
int err = pthread_create(&kids[i], NULL, fooey, (void *)&childIsFinished);
|
||||
if (err != 0)
|
||||
error("pthread_create returned %d", err);
|
||||
}
|
||||
mps_tramp(&r, test, arena, 0);
|
||||
|
||||
test(mps_class_amc(), exactRootsCOUNT);
|
||||
test(mps_class_amcz(), 0);
|
||||
|
||||
mps_root_destroy(reg_root);
|
||||
mps_thread_dereg(thread);
|
||||
|
||||
for (i = 0; i < sizeof(kids)/sizeof(kids[0]); ++i) {
|
||||
int err = pthread_join(kids[i], NULL);
|
||||
if (err != 0)
|
||||
error("pthread_join returned %d", err);
|
||||
}
|
||||
|
||||
finish();
|
||||
report(arena);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include "mpscamc.h"
|
||||
#include "mpscams.h"
|
||||
#include "mpscawl.h"
|
||||
#include "mpsclo.h"
|
||||
#include "mpsavm.h"
|
||||
#include "fmtdy.h"
|
||||
#include "fmtdytst.h"
|
||||
|
|
@ -158,9 +159,8 @@ static void test_trees(const char *name, mps_arena_t arena, mps_ap_t ap,
|
|||
while (mps_message_poll(arena)) {
|
||||
mps_message_t message;
|
||||
mps_addr_t objaddr;
|
||||
cdie(mps_message_get(&message, arena,
|
||||
mps_message_type_finalization()),
|
||||
"get");
|
||||
cdie(mps_message_get(&message, arena, mps_message_type_finalization()),
|
||||
"message_get");
|
||||
mps_message_finalization_ref(&objaddr, arena, message);
|
||||
mps_message_discard(arena, message);
|
||||
++ final_this_time;
|
||||
|
|
@ -181,6 +181,8 @@ static void *test(mps_arena_t arena, mps_class_t pool_class)
|
|||
|
||||
die(mps_fmt_create_A(&fmt, arena, dylan_fmt_A()), "fmt_create\n");
|
||||
MPS_ARGS_BEGIN(args) {
|
||||
/* Allocate into generation 0 so that they get finalized quickly. */
|
||||
MPS_ARGS_ADD(args, MPS_KEY_GEN, 0);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, fmt);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_AWL_FIND_DEPENDENT, test_awl_find_dependent);
|
||||
die(mps_pool_create_k(&pool, arena, pool_class, args),
|
||||
|
|
@ -219,8 +221,10 @@ int main(int argc, char *argv[])
|
|||
die(mps_thread_reg(&thread, arena), "thread_reg\n");
|
||||
|
||||
test(arena, mps_class_amc());
|
||||
/* TODO: test(arena, mps_class_ams()); */
|
||||
/* TODO: test(arena, mps_class_awl()); */
|
||||
test(arena, mps_class_amcz());
|
||||
test(arena, mps_class_ams());
|
||||
test(arena, mps_class_awl());
|
||||
/* TODO: test(arena, mps_class_lo()); */
|
||||
|
||||
mps_thread_dereg(thread);
|
||||
mps_arena_destroy(arena);
|
||||
|
|
|
|||
|
|
@ -73,8 +73,12 @@ mps_res_t dylan_make_wrappers(void)
|
|||
* If the raw memory is large enough, initialises it to a dylan-vector,
|
||||
* whose slots are initialised to either dylan-ints, or valid refs, at
|
||||
* random.
|
||||
* Caller must supply an array of (at least 1) valid refs to copy, via
|
||||
* the "refs" and "nr_refs" arguments.
|
||||
*
|
||||
* Caller must supply an array of valid refs to copy, via the "refs"
|
||||
* and "nr_refs" arguments. If "nr_refs" is 0, all slots are
|
||||
* initialized to dylan-ints: this may be useful for making leaf
|
||||
* objects.
|
||||
*
|
||||
* (Makes a pad if the raw memory is too small to hold a dylan-vector)
|
||||
*/
|
||||
|
||||
|
|
@ -100,7 +104,7 @@ mps_res_t dylan_init(mps_addr_t addr, size_t size,
|
|||
for(i = 0; i < t; ++i) {
|
||||
mps_word_t r = rnd();
|
||||
|
||||
if(r & 1)
|
||||
if(nr_refs == 0 || (r & 1))
|
||||
p[2+i] = ((r & ~(mps_word_t)3) | 1); /* random int */
|
||||
else
|
||||
p[2+i] = (mps_word_t)refs[(r >> 1) % nr_refs]; /* random ptr */
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ static Nailboard amcSegNailboard(Seg seg);
|
|||
static Bool AMCCheck(AMC amc);
|
||||
static Res AMCFix(Pool pool, ScanState ss, Seg seg, Ref *refIO);
|
||||
static Res AMCHeaderFix(Pool pool, ScanState ss, Seg seg, Ref *refIO);
|
||||
extern PoolClass AMCPoolClassGet(void);
|
||||
extern PoolClass AMCZPoolClassGet(void);
|
||||
extern BufferClass amcBufClassGet(void);
|
||||
extern SegClass amcSegClassGet(void);
|
||||
|
||||
|
|
@ -2164,7 +2164,7 @@ static void amcWalkAll(Pool pool, FormattedObjectsStepMethod f,
|
|||
Arena arena;
|
||||
Ring ring, next, node;
|
||||
|
||||
AVER(IsSubclassPoly(pool->class, AMCPoolClassGet()));
|
||||
AVER(IsSubclassPoly(pool->class, AMCZPoolClassGet()));
|
||||
|
||||
arena = PoolArena(pool);
|
||||
ring = PoolSegRing(pool);
|
||||
|
|
@ -2449,7 +2449,7 @@ static Bool AMCCheck(AMC amc)
|
|||
{
|
||||
CHECKS(AMC, amc);
|
||||
CHECKD(Pool, &amc->poolStruct);
|
||||
CHECKL(IsSubclassPoly(amc->poolStruct.class, EnsureAMCPoolClass()));
|
||||
CHECKL(IsSubclassPoly(amc->poolStruct.class, AMCZPoolClassGet()));
|
||||
CHECKL(RankSetCheck(amc->rankSet));
|
||||
CHECKD_NOSIG(Ring, &amc->genRing);
|
||||
CHECKL(BoolCheck(amc->gensBooted));
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include "mpscamc.h"
|
||||
#include "mpscams.h"
|
||||
#include "mpscawl.h"
|
||||
#include "mpsclo.h"
|
||||
#include "mpsavm.h"
|
||||
#include "mpstd.h"
|
||||
#include "mps.h"
|
||||
|
|
@ -213,8 +214,10 @@ int main(int argc, char *argv[])
|
|||
die(mps_thread_reg(&thread, arena), "thread_reg");
|
||||
|
||||
test(arena, mps_class_amc());
|
||||
test(arena, mps_class_awl());
|
||||
test(arena, mps_class_amcz());
|
||||
/* TODO: test(arena, mps_class_ams()); -- see job003738 */
|
||||
test(arena, mps_class_awl());
|
||||
test(arena, mps_class_lo());
|
||||
|
||||
mps_thread_dereg(thread);
|
||||
mps_arena_destroy(arena);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ END_HEADER
|
|||
#include "testlib.h"
|
||||
#include "mpscawl.h"
|
||||
#include "mpscamc.h"
|
||||
#include "mpscams.h"
|
||||
#include "mpsclo.h"
|
||||
#include "mpsavm.h"
|
||||
#include "rankfmt.h"
|
||||
|
|
@ -94,15 +95,15 @@ static void finalpoll(mycell **ref, int faction)
|
|||
|
||||
static void test(void)
|
||||
{
|
||||
mps_pool_t poolamc, poolawl, poollo;
|
||||
mps_pool_t poolamc, poolamcz, poolams, poolawl, poollo;
|
||||
mps_thr_t thread;
|
||||
mps_root_t root0, root1;
|
||||
|
||||
mps_fmt_t format;
|
||||
mps_chain_t chain;
|
||||
mps_ap_t apamc, apawl, aplo;
|
||||
mps_ap_t apamc, apamcz, apams, apawl, aplo;
|
||||
|
||||
mycell *a, *b, *c, *d, *z;
|
||||
mycell *a, *b, *c, *d, *e, *z;
|
||||
|
||||
long int i,j;
|
||||
|
||||
|
|
@ -126,20 +127,39 @@ static void test(void)
|
|||
die(mmqa_pool_create_chain(&poolamc, arena, mps_class_amc(), format, chain),
|
||||
"create pool");
|
||||
|
||||
cdie(mps_pool_create(&poolawl, arena, mps_class_awl(), format, getassociated),
|
||||
"create pool");
|
||||
die(mmqa_pool_create_chain(&poolamcz, arena, mps_class_amcz(), format, chain),
|
||||
"create pool");
|
||||
|
||||
cdie(mps_pool_create(&poollo, arena, mps_class_lo(), format),
|
||||
"create pool");
|
||||
MPS_ARGS_BEGIN(args) {
|
||||
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, format);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_CHAIN, chain);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_GEN, 0);
|
||||
cdie(mps_pool_create_k(&poolams, arena, mps_class_ams(), args),
|
||||
"create pool");
|
||||
} MPS_ARGS_END(args);
|
||||
|
||||
cdie(mps_ap_create(&apawl, poolawl, mps_rank_weak()),
|
||||
"create ap");
|
||||
MPS_ARGS_BEGIN(args) {
|
||||
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, format);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_CHAIN, chain);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_GEN, 0);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_AWL_FIND_DEPENDENT, getassociated);
|
||||
cdie(mps_pool_create_k(&poolawl, arena, mps_class_awl(), args),
|
||||
"create pool");
|
||||
} MPS_ARGS_END(args);
|
||||
|
||||
cdie(mps_ap_create(&apamc, poolamc, mps_rank_exact()),
|
||||
"create ap");
|
||||
|
||||
cdie(mps_ap_create(&aplo, poollo, mps_rank_exact()),
|
||||
"create ap");
|
||||
MPS_ARGS_BEGIN(args) {
|
||||
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, format);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_CHAIN, chain);
|
||||
MPS_ARGS_ADD(args, MPS_KEY_GEN, 0);
|
||||
cdie(mps_pool_create_k(&poollo, arena, mps_class_lo(), args),
|
||||
"create pool");
|
||||
} MPS_ARGS_END(args);
|
||||
|
||||
cdie(mps_ap_create(&apawl, poolawl, mps_rank_weak()), "create ap");
|
||||
cdie(mps_ap_create(&apamc, poolamc, mps_rank_exact()), "create ap");
|
||||
cdie(mps_ap_create(&apamcz, poolamcz, mps_rank_exact()), "create ap");
|
||||
cdie(mps_ap_create(&apams, poolams, mps_rank_exact()), "create ap");
|
||||
cdie(mps_ap_create(&aplo, poollo, mps_rank_exact()), "create ap");
|
||||
|
||||
mps_message_type_enable(arena, mps_message_type_finalization());
|
||||
|
||||
|
|
@ -150,13 +170,17 @@ static void test(void)
|
|||
|
||||
for (j=0; j<1000; j++) {
|
||||
a = allocone(apamc, 2, mps_rank_exact());
|
||||
c = allocone(apawl, 2, mps_rank_weak());
|
||||
d = allocone(aplo, 2, mps_rank_exact()); /* rank irrelevant here! */
|
||||
b = allocone(apamcz, 2, mps_rank_exact()); /* rank irrelevant here! */
|
||||
c = allocone(apams, 2, mps_rank_exact());
|
||||
d = allocone(apawl, 2, mps_rank_weak());
|
||||
e = allocone(aplo, 2, mps_rank_exact()); /* rank irrelevant here! */
|
||||
mps_finalize(arena, (mps_addr_t*)&a);
|
||||
mps_finalize(arena, (mps_addr_t*)&b);
|
||||
mps_finalize(arena, (mps_addr_t*)&c);
|
||||
mps_finalize(arena, (mps_addr_t*)&d);
|
||||
mps_finalize(arena, (mps_addr_t*)&d);
|
||||
final_count += 4;
|
||||
mps_finalize(arena, (mps_addr_t*)&e);
|
||||
mps_finalize(arena, (mps_addr_t*)&e);
|
||||
final_count += 6;
|
||||
}
|
||||
|
||||
/* throw them all away and collect everything */
|
||||
|
|
@ -176,10 +200,12 @@ static void test(void)
|
|||
|
||||
while (final_count != 0 && i < 10) {
|
||||
finalpoll(&z, FINAL_DISCARD);
|
||||
if (mps_message_poll(arena) == 0) {
|
||||
if (final_count != 0 && mps_message_poll(arena) == 0) {
|
||||
i++;
|
||||
a = allocdumb(apawl, 1024, mps_rank_weak());
|
||||
a = allocdumb(apamc, 1024, mps_rank_exact());
|
||||
a = allocdumb(apamcz, 1024, mps_rank_exact());
|
||||
a = allocdumb(apams, 1024, mps_rank_exact());
|
||||
a = allocdumb(apawl, 1024, mps_rank_weak());
|
||||
a = allocdumb(aplo, 1024, mps_rank_exact());
|
||||
mps_arena_collect(arena);
|
||||
comment(" %i", final_count);
|
||||
|
|
@ -193,12 +219,16 @@ static void test(void)
|
|||
|
||||
/* now to test leaving messages open for a long time! */
|
||||
|
||||
mps_ap_destroy(apawl);
|
||||
mps_ap_destroy(apamc);
|
||||
mps_ap_destroy(apamcz);
|
||||
mps_ap_destroy(apams);
|
||||
mps_ap_destroy(apawl);
|
||||
mps_ap_destroy(aplo);
|
||||
comment("Destroyed aps.");
|
||||
|
||||
mps_pool_destroy(poolamc);
|
||||
mps_pool_destroy(poolamcz);
|
||||
mps_pool_destroy(poolams);
|
||||
mps_pool_destroy(poolawl);
|
||||
mps_pool_destroy(poollo);
|
||||
comment("Destroyed pools.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue