diff options
author | Andy Wingo <wingo@pobox.com> | 2013-11-15 15:39:38 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2013-11-15 15:39:38 +0100 |
commit | 840ec33422e7ccae5ac158584e5587d88ff42d85 (patch) | |
tree | e6e4b743559e02f309628b20107751206827d872 | |
parent | 0c247a2fb6a9872b262eb7558e62481ac1967063 (diff) | |
download | guile-840ec33422e7ccae5ac158584e5587d88ff42d85.tar.gz |
Remove MVRA accessors in libguile
* libguile/vm.c (scm_i_vm_capture_stack): Remove MVRA argument, in
preparation for removing MVRA from frames.
(scm_i_capture_current_stack): Adapt to scm_i_vm_capture_stack
change.
(vm_reinstate_partial_continuation): Remove references to MVRA.
* libguile/vm.h (struct scm_vm_cont): Remove mvra member.
* libguile/vm-engine.c (call): Set MVRA to 0. Will remove later.
(return-values): Return to RA.
(call/cc): Remove MVRA from capture call.
* libguile/frames.c:
* libguile/frames.h (SCM_FRAME_MV_RETURN_ADDRESS)
(SCM_FRAME_RTL_MV_RETURN_ADDRESS, scm_frame_mv_return_address): Remove
accessors.
* libguile/control.c (reify_partial_continuation): Adapt to
scm_i_vm_capture_stack change.
-rw-r--r-- | libguile/control.c | 4 | ||||
-rw-r--r-- | libguile/frames.c | 12 | ||||
-rw-r--r-- | libguile/frames.h | 7 | ||||
-rw-r--r-- | libguile/vm-engine.c | 5 | ||||
-rw-r--r-- | libguile/vm.c | 21 | ||||
-rw-r--r-- | libguile/vm.h | 4 |
6 files changed, 11 insertions, 42 deletions
diff --git a/libguile/control.c b/libguile/control.c index 7120ffee9..aad5aba5f 100644 --- a/libguile/control.c +++ b/libguile/control.c @@ -108,12 +108,10 @@ reify_partial_continuation (SCM vm, if (SCM_FRAME_DYNAMIC_LINK (bottom_fp) != saved_fp) abort(); - /* Capture from the top of the thunk application frame up to the end. Set an - MVRA only, as the post-abort code is in an MV context. */ + /* Capture from the top of the thunk application frame up to the end. */ vm_cont = scm_i_vm_capture_stack (bottom_fp - 1, SCM_VM_DATA (vm)->fp, SCM_VM_DATA (vm)->sp, - NULL, SCM_VM_DATA (vm)->ip, dynstack, flags); diff --git a/libguile/frames.c b/libguile/frames.c index ce671b889..979468e75 100644 --- a/libguile/frames.c +++ b/libguile/frames.c @@ -245,18 +245,6 @@ SCM_DEFINE (scm_frame_return_address, "frame-return-address", 1, 0, 0, } #undef FUNC_NAME -SCM_DEFINE (scm_frame_mv_return_address, "frame-mv-return-address", 1, 0, 0, - (SCM frame), - "") -#define FUNC_NAME s_scm_frame_mv_return_address -{ - SCM_VALIDATE_VM_FRAME (1, frame); - return scm_from_uintptr_t ((scm_t_uintptr) - (SCM_FRAME_MV_RETURN_ADDRESS - (SCM_VM_FRAME_FP (frame)))); -} -#undef FUNC_NAME - SCM_DEFINE (scm_frame_dynamic_link, "frame-dynamic-link", 1, 0, 0, (SCM frame), "") diff --git a/libguile/frames.h b/libguile/frames.h index 9105311f1..084f051d4 100644 --- a/libguile/frames.h +++ b/libguile/frames.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -85,8 +85,6 @@ struct scm_vm_frame (SCM_FRAME_STRUCT (fp)->return_address) #define SCM_FRAME_SET_RETURN_ADDRESS(fp, ra) \ SCM_FRAME_STRUCT (fp)->return_address = (ra) -#define SCM_FRAME_MV_RETURN_ADDRESS(fp) \ - (SCM_FRAME_STRUCT (fp)->mv_return_address) #define SCM_FRAME_SET_MV_RETURN_ADDRESS(fp, mvra) \ SCM_FRAME_STRUCT (fp)->mv_return_address = (mvra) #define SCM_FRAME_DYNAMIC_LINK(fp) \ @@ -124,8 +122,6 @@ struct scm_vm_frame #define SCM_FRAME_SET_RTL_RETURN_ADDRESS(fp, ip) \ SCM_FRAME_SET_RETURN_ADDRESS (fp, (scm_t_uint8 *) (ip)) -#define SCM_FRAME_RTL_MV_RETURN_ADDRESS(fp) \ - ((scm_t_uint32 *) SCM_FRAME_MV_RETURN_ADDRESS (fp)) #define SCM_FRAME_SET_RTL_MV_RETURN_ADDRESS(fp, ip) \ SCM_FRAME_SET_MV_RETURN_ADDRESS (fp, (scm_t_uint8 *) (ip)) @@ -165,7 +161,6 @@ SCM_API SCM scm_frame_address (SCM frame); SCM_API SCM scm_frame_stack_pointer (SCM frame); SCM_API SCM scm_frame_instruction_pointer (SCM frame); SCM_API SCM scm_frame_return_address (SCM frame); -SCM_API SCM scm_frame_mv_return_address (SCM frame); SCM_API SCM scm_frame_dynamic_link (SCM frame); SCM_API SCM scm_frame_previous (SCM frame); diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c index 7e66f4387..2c75a2a49 100644 --- a/libguile/vm-engine.c +++ b/libguile/vm-engine.c @@ -574,7 +574,7 @@ RTL_VM_NAME (SCM vm, SCM program, SCM *argv, size_t nargs_) fp = vp->fp = old_fp + proc; SCM_FRAME_SET_DYNAMIC_LINK (fp, old_fp); - SCM_FRAME_SET_RTL_MV_RETURN_ADDRESS (fp, ip + 2); + SCM_FRAME_SET_RTL_MV_RETURN_ADDRESS (fp, 0); SCM_FRAME_SET_RTL_RETURN_ADDRESS (fp, ip + 2); RESET_FRAME (nlocals); @@ -711,7 +711,7 @@ RTL_VM_NAME (SCM vm, SCM program, SCM *argv, size_t nargs_) SCM *base = fp; VM_HANDLE_INTERRUPTS; - ip = SCM_FRAME_RTL_MV_RETURN_ADDRESS (fp); + ip = SCM_FRAME_RTL_RETURN_ADDRESS (fp); fp = vp->fp = SCM_FRAME_DYNAMIC_LINK (fp); /* Clear stack frame. */ @@ -954,7 +954,6 @@ RTL_VM_NAME (SCM vm, SCM program, SCM *argv, size_t nargs_) SCM_FRAME_DYNAMIC_LINK (fp), SCM_FRAME_LOWER_ADDRESS (fp) - 1, SCM_FRAME_RETURN_ADDRESS (fp), - SCM_FRAME_MV_RETURN_ADDRESS (fp), dynstack, 0); /* FIXME: Seems silly to capture the registers here, when they are diff --git a/libguile/vm.c b/libguile/vm.c index 5b3263993..07500e3ca 100644 --- a/libguile/vm.c +++ b/libguile/vm.c @@ -104,8 +104,7 @@ scm_i_vm_cont_print (SCM x, SCM port, scm_print_state *pstate) */ SCM scm_i_vm_capture_stack (SCM *stack_base, SCM *fp, SCM *sp, scm_t_uint8 *ra, - scm_t_uint8 *mvra, scm_t_dynstack *dynstack, - scm_t_uint32 flags) + scm_t_dynstack *dynstack, scm_t_uint32 flags) { struct scm_vm_cont *p; @@ -123,7 +122,6 @@ scm_i_vm_capture_stack (SCM *stack_base, SCM *fp, SCM *sp, scm_t_uint8 *ra, memset (p->stack_base, 0, p->stack_size * sizeof (SCM)); #endif p->ra = ra; - p->mvra = mvra; p->sp = sp; p->fp = fp; memcpy (p->stack_base, stack_base, (sp + 1 - stack_base) * sizeof (SCM)); @@ -146,10 +144,6 @@ vm_return_to_continuation (SCM vm, SCM cont, size_t n, SCM *argv) vp = SCM_VM_DATA (vm); cp = SCM_VM_CONT_DATA (cont); - if (n == 0 && !cp->mvra) - scm_misc_error (NULL, "Too few values returned to continuation", - SCM_EOL); - if (vp->stack_size < cp->stack_size + n + 4) scm_misc_error ("vm-engine", "not enough space to reinstate continuation", scm_list_2 (vm, cont)); @@ -183,7 +177,7 @@ vm_return_to_continuation (SCM vm, SCM cont, size_t n, SCM *argv) vp->sp++; *vp->sp = argv_copy[i]; } - vp->ip = cp->mvra; + vp->ip = cp->ra; } } @@ -198,7 +192,7 @@ scm_i_capture_current_stack (void) vm = scm_the_vm (); vp = SCM_VM_DATA (vm); - return scm_i_vm_capture_stack (vp->stack_base, vp->fp, vp->sp, vp->ip, NULL, + return scm_i_vm_capture_stack (vp->stack_base, vp->fp, vp->sp, vp->ip, scm_dynstack_capture_all (&thread->dynstack), 0); } @@ -342,19 +336,14 @@ vm_reinstate_partial_continuation (SCM vm, SCM cont, size_t n, SCM *argv, vp->sp = base - 1 + cp->stack_size; vp->fp = RELOC (cp->fp); - vp->ip = cp->mvra; + vp->ip = cp->ra; - /* now push args. ip is in a MV context. */ + /* Push the arguments. */ for (i = 0; i < n; i++) { vp->sp++; *vp->sp = argv_copy[i]; } -#if 0 - /* The number-of-values marker, only used by the stack VM. */ - vp->sp++; - *vp->sp = scm_from_size_t (n); -#endif /* The prompt captured a slice of the dynamic stack. Here we wind those entries onto the current thread's stack. We also have to diff --git a/libguile/vm.h b/libguile/vm.h index 80423ece4..7012eef25 100644 --- a/libguile/vm.h +++ b/libguile/vm.h @@ -88,7 +88,7 @@ SCM_API void scm_c_set_default_vm_engine_x (int engine); struct scm_vm_cont { SCM *sp; SCM *fp; - scm_t_uint8 *ra, *mvra; + scm_t_uint8 *ra; scm_t_ptrdiff stack_size; SCM *stack_base; scm_t_ptrdiff reloc; @@ -110,7 +110,7 @@ SCM_INTERNAL void scm_i_vm_print (SCM x, SCM port, SCM_INTERNAL SCM scm_i_call_with_current_continuation (SCM proc); SCM_INTERNAL SCM scm_i_capture_current_stack (void); SCM_INTERNAL SCM scm_i_vm_capture_stack (SCM *stack_base, SCM *fp, SCM *sp, - scm_t_uint8 *ra, scm_t_uint8 *mvra, + scm_t_uint8 *ra, scm_t_dynstack *dynstack, scm_t_uint32 flags); SCM_INTERNAL void scm_i_vm_cont_print (SCM x, SCM port, |