summaryrefslogtreecommitdiff
path: root/libguile/intrinsics.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2018-08-12 15:57:53 +0200
committerAndy Wingo <wingo@pobox.com>2018-08-12 15:57:53 +0200
commita20feea43e3a8cf2460c254fb65d5e3aed6bd756 (patch)
tree0db0ea0e21515d6eddc3055c4ad4a5b1613c4904 /libguile/intrinsics.c
parent939b1ae23f680365fb6fd0a78653a281aaed95b6 (diff)
downloadguile-a20feea43e3a8cf2460c254fb65d5e3aed6bd756.tar.gz
Continuations capture machine code address
* libguile/continuations.c (scm_i_continuation_to_frame): Adapt to vra field renaming. (scm_i_reinstate_continuation, grow_stack, copy_stack_and_call) (scm_dynthrow): Take mra of continuation. Set on the vp before the longjmp. * libguile/continuations.h: Update scm_i_reinstate_continuation prototype. * libguile/dynstack.h: * libguile/control.c (scm_suspendable_continuation_p): * libguile/dynstack.c (PROMPT_WORDS, PROMPT_VRA, PROMPT_MRA): (PROMPT_JMPBUF, scm_dynstack_push_prompt, scm_dynstack_find_prompt) (scm_dynstack_wind_prompt): Store both virtual and machine return addresses on the dynstack, for prompts. * libguile/eval.c (eval): Pass NULL for mra. * libguile/intrinsics.c (push_prompt): Add mra arg, and pass it to the dynstack. * libguile/intrinsics.h: Update prototypes so that continuation-related intrinsics can save and restore the MRA. * libguile/jit.h: * libguile/jit.c: Return VRA when JIT code needs to tier down. * libguile/stacks.c (find_prompt, scm_make_stack) * libguile/throw.c (catch): Adapt find-prompt calls. * libguile/vm-engine.c (instrument-entry, instrument-loop): Add logic to continue with vcode after the mcode finishes. (compose-continuation, capture-continuation, abort, prompt): Add logic to pass NULL as captured MRA, but continue with mcode from new continuations, if appropriate. * libguile/vm.c (scm_i_vm_cont_to_frame, capture_stack) (scm_i_capture_current_stack, reinstate_continuation_x) (capture_continuation, compose_continuation_inner, compose_continuation) (capture_delimited_continuation, abort_to_prompt): Adapt to plumb around machine code continuations. (scm_call_n): Check "mra_after_abort" field for machine code continuation, if any. * libguile/vm.h (struct scm_vm): Add "mra_after_abort" field. (struct scm_vm_cont): Rename "ra" field to "vra" and add "mra" field.
Diffstat (limited to 'libguile/intrinsics.c')
-rw-r--r--libguile/intrinsics.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libguile/intrinsics.c b/libguile/intrinsics.c
index 317526688..cf4833d71 100644
--- a/libguile/intrinsics.c
+++ b/libguile/intrinsics.c
@@ -349,7 +349,8 @@ current_module (scm_thread *thread)
static void
push_prompt (scm_thread *thread, uint8_t escape_only_p,
- SCM tag, const union scm_vm_stack_element *sp, uint32_t *ra)
+ SCM tag, const union scm_vm_stack_element *sp, uint32_t *vra,
+ uint8_t *mra)
{
struct scm_vm *vp = &thread->vm;
scm_t_dynstack_prompt_flags flags;
@@ -357,7 +358,7 @@ push_prompt (scm_thread *thread, uint8_t escape_only_p,
flags = escape_only_p ? SCM_F_DYNSTACK_PROMPT_ESCAPE_ONLY : 0;
scm_dynstack_push_prompt (&thread->dynstack, flags, tag,
vp->stack_top - vp->fp, vp->stack_top - sp,
- ra, thread->vm.registers);
+ vra, mra, thread->vm.registers);
}
void