mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-22 21:50:45 -08:00
Lifting stack and register area scanner into mps interface to allow generalisation of stack format.
Copied from Perforce Change: 189195 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
9d0ae49fc9
commit
2ad27f73b1
14 changed files with 40 additions and 19 deletions
|
|
@ -128,7 +128,8 @@ static void test_main(void *marker, int interior, int stack)
|
|||
|
||||
if (stack) {
|
||||
res = mps_root_create_stack(®_root, scheme_arena, mps_rank_ambig(),
|
||||
0, thread, sizeof(mps_word_t) - 1, 0, marker);
|
||||
0, thread, mps_scan_area_tagged,
|
||||
sizeof(mps_word_t) - 1, 0, marker);
|
||||
if (res != MPS_RES_OK)
|
||||
error("Couldn't create root");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,7 +140,8 @@ static void *kid_thread(void *arg)
|
|||
|
||||
die(mps_thread_reg(&thread, (mps_arena_t)arena), "thread_reg");
|
||||
die(mps_root_create_stack(®_root, arena, mps_rank_ambig(),
|
||||
0, thread, sizeof(mps_word_t) - 1, 0, marker),
|
||||
0, thread, mps_scan_area_tagged,
|
||||
sizeof(mps_word_t) - 1, 0, marker),
|
||||
"root_create");
|
||||
|
||||
die(mps_ap_create(&ap, cl->pool, mps_rank_exact()), "BufferCreate(fooey)");
|
||||
|
|
@ -318,7 +319,8 @@ static void test_arena(int mode)
|
|||
"root_create_table(ambig)");
|
||||
die(mps_thread_reg(&thread, arena), "thread_reg");
|
||||
die(mps_root_create_stack(®_root, arena, mps_rank_ambig(),
|
||||
0, thread, sizeof(mps_word_t) - 1, 0, marker),
|
||||
0, thread, mps_scan_area_tagged,
|
||||
sizeof(mps_word_t) - 1, 0, marker),
|
||||
"root_create");
|
||||
|
||||
die(mps_pool_create(&amc_pool, arena, mps_class_amc(), format, chain),
|
||||
|
|
|
|||
|
|
@ -268,7 +268,8 @@ static void *setup(void *v, size_t s)
|
|||
thr = guff->thr;
|
||||
|
||||
die(mps_root_create_stack(&stack, arena, mps_rank_ambig(),
|
||||
0, thr, sizeof(mps_word_t) - 1, 0, v),
|
||||
0, thr, mps_scan_area_tagged,
|
||||
sizeof(mps_word_t) - 1, 0, v),
|
||||
"Root Create\n");
|
||||
die(mps_fmt_create_A(&dylanfmt, arena, dylan_fmt_A()),
|
||||
"Format Create\n");
|
||||
|
|
|
|||
|
|
@ -272,7 +272,8 @@ static void *setup(void *v, size_t s)
|
|||
thr = guff->thr;
|
||||
|
||||
die(mps_root_create_stack(&stack, arena, mps_rank_ambig(),
|
||||
0, thr, sizeof(mps_word_t) - 1, 0, v),
|
||||
0, thr, mps_scan_area_tagged,
|
||||
sizeof(mps_word_t) - 1, 0, v),
|
||||
"Root Create\n");
|
||||
die(EnsureHeaderFormat(&dylanfmt, arena), "EnsureHeaderFormat");
|
||||
die(EnsureHeaderWeakFormat(&dylanweakfmt, arena), "EnsureHeaderWeakFormat");
|
||||
|
|
|
|||
|
|
@ -255,7 +255,8 @@ static void *setup(void *v, size_t s)
|
|||
thr = guff->thr;
|
||||
|
||||
die(mps_root_create_stack(&stack, arena, mps_rank_ambig(),
|
||||
0, thr, sizeof(mps_word_t) - 1, 0, v),
|
||||
0, thr, mps_scan_area_tagged,
|
||||
sizeof(mps_word_t) - 1, 0, v),
|
||||
"Root Create\n");
|
||||
die(mps_fmt_create_A(&dylanfmt, arena, dylan_fmt_A()),
|
||||
"Format Create\n");
|
||||
|
|
|
|||
|
|
@ -178,6 +178,7 @@ static void *start(void *p) {
|
|||
RESMUST(mps_thread_reg(&thread->mps_thread, arena));
|
||||
RESMUST(mps_root_create_stack(&thread->reg_root, arena, mps_rank_ambig(),
|
||||
(mps_rm_t)0, thread->mps_thread,
|
||||
mps_scan_area_tagged,
|
||||
sizeof(mps_word_t) - 1, 0, &marker));
|
||||
RESMUST(mps_ap_create_k(&thread->ap, pool, mps_args_none));
|
||||
thread->fn(thread);
|
||||
|
|
|
|||
|
|
@ -963,6 +963,7 @@ extern Res RootCreateReg(Root *rootReturn, Arena arena,
|
|||
void *p, size_t s);
|
||||
extern Res RootCreateRegMasked(Root *rootReturn, Arena arena,
|
||||
Rank rank, Thread thread,
|
||||
mps_area_scan_t scan_area,
|
||||
Word mask, Word pattern,
|
||||
Word *stackBot);
|
||||
extern Res RootCreateFmt(Root *rootReturn, Arena arena,
|
||||
|
|
|
|||
|
|
@ -693,6 +693,7 @@ extern mps_res_t mps_root_create_reg(mps_root_t *, mps_arena_t,
|
|||
mps_reg_scan_t, void *, size_t);
|
||||
extern mps_res_t mps_root_create_stack(mps_root_t *, mps_arena_t,
|
||||
mps_rank_t, mps_rm_t, mps_thr_t,
|
||||
mps_area_scan_t,
|
||||
mps_word_t, mps_word_t,
|
||||
void *);
|
||||
extern void mps_root_destroy(mps_root_t);
|
||||
|
|
|
|||
|
|
@ -1450,10 +1450,13 @@ mps_res_t mps_root_create_reg(mps_root_t *mps_root_o, mps_arena_t arena,
|
|||
}
|
||||
|
||||
|
||||
/* FIXME: re-document */
|
||||
mps_res_t mps_root_create_stack(mps_root_t *mps_root_o, mps_arena_t arena,
|
||||
mps_rank_t mps_rank, mps_rm_t mps_rm,
|
||||
mps_thr_t thread, mps_word_t mask,
|
||||
mps_word_t pattern, void *reg_scan_p)
|
||||
mps_thr_t thread,
|
||||
mps_area_scan_t scan_area,
|
||||
mps_word_t mask, mps_word_t pattern,
|
||||
void *stack)
|
||||
{
|
||||
Rank rank = (Rank)mps_rank;
|
||||
Root root;
|
||||
|
|
@ -1462,15 +1465,16 @@ mps_res_t mps_root_create_stack(mps_root_t *mps_root_o, mps_arena_t arena,
|
|||
ArenaEnter(arena);
|
||||
|
||||
AVER(mps_root_o != NULL);
|
||||
AVER(reg_scan_p != NULL); /* stackBot */
|
||||
AVER(AddrIsAligned(reg_scan_p, sizeof(Word)));
|
||||
AVER(stack != NULL); /* stackBot */
|
||||
AVER(AddrIsAligned(stack, sizeof(Word)));
|
||||
AVER(rank == mps_rank_ambig());
|
||||
AVER(mps_rm == (mps_rm_t)0);
|
||||
AVER((~mask & pattern) == 0);
|
||||
|
||||
/* See .root-mode. */
|
||||
res = RootCreateRegMasked(&root, arena, rank, thread,
|
||||
mask, pattern, (Word *)reg_scan_p);
|
||||
scan_area, mask, pattern,
|
||||
(Word *)stack);
|
||||
|
||||
ArenaLeave(arena);
|
||||
|
||||
|
|
|
|||
|
|
@ -604,7 +604,8 @@ int main(int argc, char *argv[])
|
|||
} else {
|
||||
die(mps_root_create_stack(®_root, arena,
|
||||
mps_rank_ambig(), (mps_rm_t)0,
|
||||
thread, sizeof(mps_word_t) - 1, 0, marker),
|
||||
thread, mps_scan_area_tagged,
|
||||
sizeof(mps_word_t) - 1, 0, marker),
|
||||
"root_create_stack");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -352,7 +352,9 @@ Res RootCreateReg(Root *rootReturn, Arena arena,
|
|||
|
||||
Res RootCreateRegMasked(Root *rootReturn, Arena arena,
|
||||
Rank rank, Thread thread,
|
||||
Word mask, Word pattern, Word *stackBot)
|
||||
mps_area_scan_t scan_area,
|
||||
Word mask, Word pattern,
|
||||
Word *stackBot)
|
||||
{
|
||||
union RootUnion theUnion;
|
||||
|
||||
|
|
@ -364,7 +366,7 @@ Res RootCreateRegMasked(Root *rootReturn, Arena arena,
|
|||
AVER((~mask & pattern) == 0);
|
||||
|
||||
theUnion.regMasked.thread = thread;
|
||||
theUnion.regMasked.scan_area = mps_scan_area_tagged;
|
||||
theUnion.regMasked.scan_area = scan_area;
|
||||
theUnion.regMasked.tag.mask = mask;
|
||||
theUnion.regMasked.tag.pattern = pattern;
|
||||
theUnion.regMasked.stackBot = stackBot;
|
||||
|
|
|
|||
|
|
@ -209,13 +209,15 @@ static void test(int mode, void *marker)
|
|||
case MODE_CONS:
|
||||
/* Scan words tagged "cons" -- everything will live. */
|
||||
die(mps_root_create_stack(&root, arena, mps_rank_ambig(), 0, thread,
|
||||
TAG_MASK, tag_cons, marker), "root");
|
||||
mps_scan_area_tagged, TAG_MASK, tag_cons,
|
||||
marker), "root");
|
||||
expected = 0;
|
||||
break;
|
||||
case MODE_INVALID:
|
||||
/* Scan words tagged "invalid" -- everything will die. */
|
||||
die(mps_root_create_stack(&root, arena, mps_rank_ambig(), 0, thread,
|
||||
TAG_MASK, tag_invalid, marker), "root");
|
||||
mps_scan_area_tagged, TAG_MASK, tag_invalid,
|
||||
marker), "root");
|
||||
expected = OBJCOUNT;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -576,6 +576,7 @@ static void StackScan(mps_arena_t arena, int on)
|
|||
Insist(root_stackreg == NULL);
|
||||
die(mps_root_create_stack(&root_stackreg, arena,
|
||||
mps_rank_ambig(), (mps_rm_t)0, stack_thr,
|
||||
mps_scan_area_tagged,
|
||||
sizeof(mps_word_t) - 1, 0, stack_start),
|
||||
"root_stackreg");
|
||||
Insist(root_stackreg != NULL);
|
||||
|
|
@ -764,6 +765,7 @@ static void *testscriptB(void *arg, size_t s)
|
|||
stack_thr = thr;
|
||||
die(mps_root_create_stack(&root_stackreg, arena,
|
||||
mps_rank_ambig(), (mps_rm_t)0, stack_thr,
|
||||
mps_scan_area_tagged,
|
||||
sizeof(mps_word_t) - 1, 0, stack_start),
|
||||
"root_stackreg");
|
||||
|
||||
|
|
|
|||
|
|
@ -332,6 +332,7 @@ static void *testscriptB(void *arg, size_t s)
|
|||
/* root_stackreg: stack & registers are ambiguous roots = mutator's workspace */
|
||||
die(mps_root_create_stack(&root_stackreg, arena,
|
||||
mps_rank_ambig(), (mps_rm_t)0, thr,
|
||||
mps_scan_area_tagged,
|
||||
sizeof(mps_word_t) - 1, 0, &stack_starts_here),
|
||||
"root_stackreg");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue