summaryrefslogtreecommitdiff
path: root/libguile/vm.h
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2017-02-12 18:22:44 +0100
committerAndy Wingo <wingo@pobox.com>2017-02-12 20:31:14 +0100
commit00ed4043c258b35d9200b9be3070c24355e46b63 (patch)
tree332112a2bbd70ef49c11e708d99dfc9c49e55da1 /libguile/vm.h
parent5048a8afbc00e3e0a65a5d2ffccfec666ec5a68b (diff)
downloadguile-00ed4043c258b35d9200b9be3070c24355e46b63.tar.gz
VM continuations store FP/SP by offset
* libguile/continuations.c (scm_i_continuation_to_frame): * libguile/stacks.c (scm_make_stack): * libguile/vm.c (scm_i_vm_cont_to_frame, scm_i_vm_capture_stack): (vm_return_to_continuation_inner) (struct vm_reinstate_partial_continuation_data): (vm_reinstate_partial_continuation_inner): (vm_reinstate_partial_continuation): * libguile/vm.h (sstruct scm_vm_cont): Simplify VM continuations by recording the top FP by offset, not value + reloc. * libguile/frames.c (frame_offset, scm_i_vm_frame_offset): Remove unused functions. * libguile/frames.h (SCM_VALIDATE_VM_FRAME, scm_i_vm_frame_offset): Remove. * libguile/control.c (reify_partial_continuation): Once we know the base_fp, relocate the dynamic stack. * libguile/dynstack.h: * libguile/dynstack.c (scm_dynstack_relocate_prompts): New function. (scm_dynstack_wind_prompt): Adapt to add new fp offset.
Diffstat (limited to 'libguile/vm.h')
-rw-r--r--libguile/vm.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/libguile/vm.h b/libguile/vm.h
index b26f7f406..a1cac391f 100644
--- a/libguile/vm.h
+++ b/libguile/vm.h
@@ -80,12 +80,19 @@ SCM_INTERNAL void scm_i_vm_free_stack (struct scm_vm *vp);
#define SCM_F_VM_CONT_REWINDABLE 0x2
struct scm_vm_cont {
- union scm_vm_stack_element *fp;
+ /* IP of newest frame. */
scm_t_uint32 *ra;
+ /* Offset of FP of newest frame, relative to stack top. */
+ scm_t_ptrdiff fp_offset;
+ /* Besides being the stack size, this is also the offset of the SP of
+ the newest frame. */
scm_t_ptrdiff stack_size;
+ /* Stack bottom, which also keeps saved stack alive for GC. */
union scm_vm_stack_element *stack_bottom;
- scm_t_ptrdiff reloc;
+ /* Saved dynamic stack, with prompts relocated to record saved SP/FP
+ offsets from the stack top of this scm_vm_cont. */
scm_t_dynstack *dynstack;
+ /* See the continuation is partial and/or rewindable. */
scm_t_uint32 flags;
};