1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

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.
This commit is contained in:
Andy Wingo 2015-11-26 16:36:22 +01:00
parent d729a0dc75
commit 02fc5a772b
4 changed files with 10 additions and 7 deletions

View file

@ -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->sp_offset = stack_top - new_sp;
frame->ip = SCM_FRAME_RETURN_ADDRESS (this_fp); frame->ip = SCM_FRAME_RETURN_ADDRESS (this_fp);
{ if (scm_i_vm_is_boot_continuation_code (frame->ip))
SCM proc = scm_c_frame_closure (kind, frame); goto again;
if (SCM_PROGRAM_P (proc) && SCM_PROGRAM_IS_BOOT (proc))
goto again;
}
return 1; return 1;
} }

View file

@ -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 /* Skip initial boot frame, if any. This is possible if the frame
originates from a captured continuation. */ originates from a captured continuation. */
if (SCM_PROGRAM_P (scm_c_frame_closure (kind, &frame)) if (scm_i_vm_is_boot_continuation_code (frame.ip)
&& SCM_PROGRAM_IS_BOOT (scm_c_frame_closure (kind, &frame))
&& !scm_c_frame_previous (kind, &frame)) && !scm_c_frame_previous (kind, &frame))
return SCM_BOOL_F; return SCM_BOOL_F;

View file

@ -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 static SCM
scm_vm_builtin_ref (unsigned idx) scm_vm_builtin_ref (unsigned idx)
{ {

View file

@ -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 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_INTERNAL void scm_i_vm_cont_print (SCM x, SCM port,
scm_print_state *pstate); 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_bootstrap_vm (void);
SCM_INTERNAL void scm_init_vm (void); SCM_INTERNAL void scm_init_vm (void);