summaryrefslogtreecommitdiff
path: root/libguile/frames.h
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.h
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.h')
-rw-r--r--libguile/frames.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/libguile/frames.h b/libguile/frames.h
index 870477d53..e1130e94b 100644
--- a/libguile/frames.h
+++ b/libguile/frames.h
@@ -88,7 +88,7 @@
/* Each element on the stack occupies the same amount of space. */
union scm_vm_stack_element
{
- union scm_vm_stack_element *as_fp;
+ scm_t_uintptr as_uint;
scm_t_uint32 *as_ip;
SCM as_scm;
@@ -100,8 +100,8 @@ union scm_vm_stack_element
#define SCM_FRAME_PREVIOUS_SP(fp) ((fp) + 2)
#define SCM_FRAME_RETURN_ADDRESS(fp) ((fp)[0].as_ip)
#define SCM_FRAME_SET_RETURN_ADDRESS(fp, ra) ((fp)[0].as_ip = (ra))
-#define SCM_FRAME_DYNAMIC_LINK(fp) ((fp)[1].as_fp)
-#define SCM_FRAME_SET_DYNAMIC_LINK(fp, dl) ((fp)[1].as_fp = (dl))
+#define SCM_FRAME_DYNAMIC_LINK(fp) ((fp) + (fp)[1].as_uint)
+#define SCM_FRAME_SET_DYNAMIC_LINK(fp, dl) ((fp)[1].as_uint = ((dl) - (fp)))
#define SCM_FRAME_SLOT(fp,i) ((fp) - (i) - 1)
#define SCM_FRAME_LOCAL(fp,i) (SCM_FRAME_SLOT (fp, i)->as_scm)
#define SCM_FRAME_NUM_LOCALS(fp, sp) ((fp) - (sp))