guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 04/41: Identify boot continuations by code, not closure


From: Andy Wingo
Subject: [Guile-commits] 04/41: Identify boot continuations by code, not closure
Date: Wed, 02 Dec 2015 08:06:45 +0000

wingo pushed a commit to branch master
in repository guile.

commit 02fc5a772bc95bbd70a81b8589bf261a3822f9bd
Author: Andy Wingo <address@hidden>
Date:   Thu Nov 26 16:36:22 2015 +0100

    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.
---
 libguile/frames.c |    7 ++-----
 libguile/stacks.c |    3 +--
 libguile/vm.c     |    6 ++++++
 libguile/vm.h     |    1 +
 4 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/libguile/frames.c b/libguile/frames.c
index 48e963a..312d53b 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 366176b..958103a 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 5ea6b2b..014ee65 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 936633d..2ca4f2a 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);
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]