mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
VM continuations store FP/SP by offset
* libguile/continuations.c (scm_i_continuation_to_frame): * libguile/stacks.c (scm_make_stack): * libguile/vm.c (scm_i_vm_cont_to_frame, scm_i_vm_capture_stack): (vm_return_to_continuation_inner) (struct vm_reinstate_partial_continuation_data): (vm_reinstate_partial_continuation_inner): (vm_reinstate_partial_continuation): * libguile/vm.h (sstruct scm_vm_cont): Simplify VM continuations by recording the top FP by offset, not value + reloc. * libguile/frames.c (frame_offset, scm_i_vm_frame_offset): Remove unused functions. * libguile/frames.h (SCM_VALIDATE_VM_FRAME, scm_i_vm_frame_offset): Remove. * libguile/control.c (reify_partial_continuation): Once we know the base_fp, relocate the dynamic stack. * libguile/dynstack.h: * libguile/dynstack.c (scm_dynstack_relocate_prompts): New function. (scm_dynstack_wind_prompt): Adapt to add new fp offset.
This commit is contained in:
parent
5048a8afbc
commit
00ed4043c2
9 changed files with 49 additions and 64 deletions
|
@ -37,7 +37,9 @@
|
|||
#define PROMPT_WORDS 5
|
||||
#define PROMPT_KEY(top) (SCM_PACK ((top)[0]))
|
||||
#define PROMPT_FP(top) ((scm_t_ptrdiff) ((top)[1]))
|
||||
#define SET_PROMPT_FP(top, fp) do { top[1] = (scm_t_bits)(fp); } while (0)
|
||||
#define PROMPT_SP(top) ((scm_t_ptrdiff) ((top)[2]))
|
||||
#define SET_PROMPT_SP(top, sp) do { top[2] = (scm_t_bits)(sp); } while (0)
|
||||
#define PROMPT_IP(top) ((scm_t_uint32 *) ((top)[3]))
|
||||
#define PROMPT_JMPBUF(top) ((scm_i_jmp_buf *) ((top)[4]))
|
||||
|
||||
|
@ -287,6 +289,24 @@ scm_dynstack_capture (scm_t_dynstack *dynstack, scm_t_bits *item)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
scm_dynstack_relocate_prompts (scm_t_dynstack *dynstack, scm_t_ptrdiff base)
|
||||
{
|
||||
scm_t_bits *walk;
|
||||
|
||||
/* Relocate prompts. */
|
||||
for (walk = dynstack->top; walk; walk = SCM_DYNSTACK_PREV (walk))
|
||||
{
|
||||
scm_t_bits tag = SCM_DYNSTACK_TAG (walk);
|
||||
|
||||
if (SCM_DYNSTACK_TAG_TYPE (tag) == SCM_DYNSTACK_TYPE_PROMPT)
|
||||
{
|
||||
SET_PROMPT_FP (walk, PROMPT_FP (walk) - base);
|
||||
SET_PROMPT_SP (walk, PROMPT_SP (walk) - base);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
scm_dynstack_wind_1 (scm_t_dynstack *dynstack, scm_t_bits *item)
|
||||
{
|
||||
|
@ -556,7 +576,8 @@ scm_dynstack_find_old_fluid_value (scm_t_dynstack *dynstack, SCM fluid,
|
|||
|
||||
void
|
||||
scm_dynstack_wind_prompt (scm_t_dynstack *dynstack, scm_t_bits *item,
|
||||
scm_t_ptrdiff reloc, scm_i_jmp_buf *registers)
|
||||
scm_t_ptrdiff base_fp_offset,
|
||||
scm_i_jmp_buf *registers)
|
||||
{
|
||||
scm_t_bits tag = SCM_DYNSTACK_TAG (item);
|
||||
|
||||
|
@ -566,8 +587,8 @@ scm_dynstack_wind_prompt (scm_t_dynstack *dynstack, scm_t_bits *item,
|
|||
scm_dynstack_push_prompt (dynstack,
|
||||
SCM_DYNSTACK_TAG_FLAGS (tag),
|
||||
PROMPT_KEY (item),
|
||||
PROMPT_FP (item) - reloc,
|
||||
PROMPT_SP (item) - reloc,
|
||||
PROMPT_FP (item) + base_fp_offset,
|
||||
PROMPT_SP (item) + base_fp_offset,
|
||||
PROMPT_IP (item),
|
||||
registers);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue