diff options
author | Andy Wingo <wingo@pobox.com> | 2015-11-26 16:36:22 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2015-12-01 10:57:20 +0100 |
commit | 02fc5a772bc95bbd70a81b8589bf261a3822f9bd (patch) | |
tree | 36504315d7c2622762acb9744360eeef5c07f83e | |
parent | d729a0dc757943c2bafb0cb300fc1ae7b3f56e91 (diff) | |
download | guile-02fc5a772bc95bbd70a81b8589bf261a3822f9bd.tar.gz |
Identify boot continuations by code, not closure
* libguile/vm.h:
* libguile/vm.c (scm_i_vm_is_boot_continuation_code): New internal
procedure.
* libguile/stacks.c (scm_make_stack):
* libguile/frames.c (scm_c_frame_previous): Use new helper to identify
boot frames.
-rw-r--r-- | libguile/frames.c | 7 | ||||
-rw-r--r-- | libguile/stacks.c | 3 | ||||
-rw-r--r-- | libguile/vm.c | 6 | ||||
-rw-r--r-- | libguile/vm.h | 1 |
4 files changed, 10 insertions, 7 deletions
diff --git a/libguile/frames.c b/libguile/frames.c index 48e963a0f..312d53b00 100644 --- a/libguile/frames.c +++ b/libguile/frames.c @@ -388,11 +388,8 @@ scm_c_frame_previous (enum scm_vm_frame_kind kind, struct scm_frame *frame) frame->sp_offset = stack_top - new_sp; frame->ip = SCM_FRAME_RETURN_ADDRESS (this_fp); - { - SCM proc = scm_c_frame_closure (kind, frame); - if (SCM_PROGRAM_P (proc) && SCM_PROGRAM_IS_BOOT (proc)) - goto again; - } + if (scm_i_vm_is_boot_continuation_code (frame->ip)) + goto again; return 1; } diff --git a/libguile/stacks.c b/libguile/stacks.c index 366176b10..958103ad6 100644 --- a/libguile/stacks.c +++ b/libguile/stacks.c @@ -361,8 +361,7 @@ SCM_DEFINE (scm_make_stack, "make-stack", 1, 0, 1, /* Skip initial boot frame, if any. This is possible if the frame originates from a captured continuation. */ - if (SCM_PROGRAM_P (scm_c_frame_closure (kind, &frame)) - && SCM_PROGRAM_IS_BOOT (scm_c_frame_closure (kind, &frame)) + if (scm_i_vm_is_boot_continuation_code (frame.ip) && !scm_c_frame_previous (kind, &frame)) return SCM_BOOL_F; diff --git a/libguile/vm.c b/libguile/vm.c index 5ea6b2bd4..014ee65f5 100644 --- a/libguile/vm.c +++ b/libguile/vm.c @@ -661,6 +661,12 @@ static const scm_t_uint32 vm_builtin_call_with_current_continuation_code[] = { }; +int +scm_i_vm_is_boot_continuation_code (scm_t_uint32 *ip) +{ + return ip == vm_boot_continuation_code; +} + static SCM scm_vm_builtin_ref (unsigned idx) { diff --git a/libguile/vm.h b/libguile/vm.h index 936633d21..2ca4f2ab4 100644 --- a/libguile/vm.h +++ b/libguile/vm.h @@ -106,6 +106,7 @@ SCM_INTERNAL SCM scm_i_vm_capture_stack (union scm_vm_stack_element *stack_top, SCM_INTERNAL int scm_i_vm_cont_to_frame (SCM cont, struct scm_frame *frame); SCM_INTERNAL void scm_i_vm_cont_print (SCM x, SCM port, scm_print_state *pstate); +SCM_INTERNAL int scm_i_vm_is_boot_continuation_code (scm_t_uint32 *ip); SCM_INTERNAL void scm_bootstrap_vm (void); SCM_INTERNAL void scm_init_vm (void); |