summaryrefslogtreecommitdiff
path: root/libguile/frames.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2015-10-18 22:59:23 +0200
committerAndy Wingo <wingo@pobox.com>2015-10-21 11:49:20 +0200
commit72353de77d0a06f158d8af66a2540015658e2574 (patch)
tree01347b554843ae90551d63f5240e21dce8b57072 /libguile/frames.c
parent8f027385db228d68193ad7316cf0b79489ac038b (diff)
downloadguile-72353de77d0a06f158d8af66a2540015658e2574.tar.gz
Replace dynamic link on stack with previous frame size
* libguile/frames.h (SCM_FRAME_DYNAMIC_LINK) (SCM_FRAME_SET_DYNAMIC_LINK): Instead of storing the absolute value of the previous FP, store its offset from the current FP. This allows us to avoid relinking when composing continuations or when relocating the stack. * libguile/frames.c (scm_frame_dynamic_link, scm_c_frame_previous): No need to relocate the dynamic link. * libguile/vm.c (vm_return_to_continuation_inner): (vm_reinstate_partial_continuation_inner, vm_expand_stack_inner): Don't relocate the frame pointer chain. (scm_i_vm_mark_stack): Terminate when FP is above stack_top, not when 0. (make_vm): Init FP to stack_top.
Diffstat (limited to 'libguile/frames.c')
-rw-r--r--libguile/frames.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/libguile/frames.c b/libguile/frames.c
index f89b0fd5b..a1c7f3e71 100644
--- a/libguile/frames.c
+++ b/libguile/frames.c
@@ -309,8 +309,6 @@ SCM_DEFINE (scm_frame_return_address, "frame-return-address", 1, 0, 0,
}
#undef FUNC_NAME
-#define RELOC(kind, frame, val) ((val) + frame_offset (kind, frame))
-
SCM_DEFINE (scm_frame_dynamic_link, "frame-dynamic-link", 1, 0, 0,
(SCM frame),
"")
@@ -320,8 +318,7 @@ SCM_DEFINE (scm_frame_dynamic_link, "frame-dynamic-link", 1, 0, 0,
/* fixme: munge fp if holder is a continuation */
return scm_from_uintptr_t
((scm_t_uintptr)
- RELOC (SCM_VM_FRAME_KIND (frame), SCM_VM_FRAME_DATA (frame),
- SCM_FRAME_DYNAMIC_LINK (SCM_VM_FRAME_FP (frame))));
+ SCM_FRAME_DYNAMIC_LINK (SCM_VM_FRAME_FP (frame)));
}
#undef FUNC_NAME
@@ -339,12 +336,7 @@ scm_c_frame_previous (enum scm_vm_frame_kind kind, struct scm_frame *frame)
new_fp = SCM_FRAME_DYNAMIC_LINK (this_fp);
- if (!new_fp)
- return 0;
-
- new_fp = RELOC (kind, frame, new_fp);
-
- if (new_fp > stack_top)
+ if (new_fp >= stack_top)
return 0;
new_sp = SCM_FRAME_PREVIOUS_SP (this_fp);