mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
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.
This commit is contained in:
parent
0c247a2fb6
commit
840ec33422
6 changed files with 11 additions and 42 deletions
|
@ -108,12 +108,10 @@ reify_partial_continuation (SCM vm,
|
||||||
if (SCM_FRAME_DYNAMIC_LINK (bottom_fp) != saved_fp)
|
if (SCM_FRAME_DYNAMIC_LINK (bottom_fp) != saved_fp)
|
||||||
abort();
|
abort();
|
||||||
|
|
||||||
/* Capture from the top of the thunk application frame up to the end. Set an
|
/* Capture from the top of the thunk application frame up to the end. */
|
||||||
MVRA only, as the post-abort code is in an MV context. */
|
|
||||||
vm_cont = scm_i_vm_capture_stack (bottom_fp - 1,
|
vm_cont = scm_i_vm_capture_stack (bottom_fp - 1,
|
||||||
SCM_VM_DATA (vm)->fp,
|
SCM_VM_DATA (vm)->fp,
|
||||||
SCM_VM_DATA (vm)->sp,
|
SCM_VM_DATA (vm)->sp,
|
||||||
NULL,
|
|
||||||
SCM_VM_DATA (vm)->ip,
|
SCM_VM_DATA (vm)->ip,
|
||||||
dynstack,
|
dynstack,
|
||||||
flags);
|
flags);
|
||||||
|
|
|
@ -245,18 +245,6 @@ SCM_DEFINE (scm_frame_return_address, "frame-return-address", 1, 0, 0,
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#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_DEFINE (scm_frame_dynamic_link, "frame-dynamic-link", 1, 0, 0,
|
||||||
(SCM frame),
|
(SCM frame),
|
||||||
"")
|
"")
|
||||||
|
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* 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)
|
(SCM_FRAME_STRUCT (fp)->return_address)
|
||||||
#define SCM_FRAME_SET_RETURN_ADDRESS(fp, ra) \
|
#define SCM_FRAME_SET_RETURN_ADDRESS(fp, ra) \
|
||||||
SCM_FRAME_STRUCT (fp)->return_address = (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) \
|
#define SCM_FRAME_SET_MV_RETURN_ADDRESS(fp, mvra) \
|
||||||
SCM_FRAME_STRUCT (fp)->mv_return_address = (mvra)
|
SCM_FRAME_STRUCT (fp)->mv_return_address = (mvra)
|
||||||
#define SCM_FRAME_DYNAMIC_LINK(fp) \
|
#define SCM_FRAME_DYNAMIC_LINK(fp) \
|
||||||
|
@ -124,8 +122,6 @@ struct scm_vm_frame
|
||||||
#define SCM_FRAME_SET_RTL_RETURN_ADDRESS(fp, ip) \
|
#define SCM_FRAME_SET_RTL_RETURN_ADDRESS(fp, ip) \
|
||||||
SCM_FRAME_SET_RETURN_ADDRESS (fp, (scm_t_uint8 *) (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) \
|
#define SCM_FRAME_SET_RTL_MV_RETURN_ADDRESS(fp, ip) \
|
||||||
SCM_FRAME_SET_MV_RETURN_ADDRESS (fp, (scm_t_uint8 *) (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_stack_pointer (SCM frame);
|
||||||
SCM_API SCM scm_frame_instruction_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_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_dynamic_link (SCM frame);
|
||||||
SCM_API SCM scm_frame_previous (SCM frame);
|
SCM_API SCM scm_frame_previous (SCM frame);
|
||||||
|
|
||||||
|
|
|
@ -574,7 +574,7 @@ RTL_VM_NAME (SCM vm, SCM program, SCM *argv, size_t nargs_)
|
||||||
|
|
||||||
fp = vp->fp = old_fp + proc;
|
fp = vp->fp = old_fp + proc;
|
||||||
SCM_FRAME_SET_DYNAMIC_LINK (fp, old_fp);
|
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);
|
SCM_FRAME_SET_RTL_RETURN_ADDRESS (fp, ip + 2);
|
||||||
|
|
||||||
RESET_FRAME (nlocals);
|
RESET_FRAME (nlocals);
|
||||||
|
@ -711,7 +711,7 @@ RTL_VM_NAME (SCM vm, SCM program, SCM *argv, size_t nargs_)
|
||||||
SCM *base = fp;
|
SCM *base = fp;
|
||||||
|
|
||||||
VM_HANDLE_INTERRUPTS;
|
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);
|
fp = vp->fp = SCM_FRAME_DYNAMIC_LINK (fp);
|
||||||
|
|
||||||
/* Clear stack frame. */
|
/* 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_DYNAMIC_LINK (fp),
|
||||||
SCM_FRAME_LOWER_ADDRESS (fp) - 1,
|
SCM_FRAME_LOWER_ADDRESS (fp) - 1,
|
||||||
SCM_FRAME_RETURN_ADDRESS (fp),
|
SCM_FRAME_RETURN_ADDRESS (fp),
|
||||||
SCM_FRAME_MV_RETURN_ADDRESS (fp),
|
|
||||||
dynstack,
|
dynstack,
|
||||||
0);
|
0);
|
||||||
/* FIXME: Seems silly to capture the registers here, when they are
|
/* FIXME: Seems silly to capture the registers here, when they are
|
||||||
|
|
|
@ -104,8 +104,7 @@ scm_i_vm_cont_print (SCM x, SCM port, scm_print_state *pstate)
|
||||||
*/
|
*/
|
||||||
SCM
|
SCM
|
||||||
scm_i_vm_capture_stack (SCM *stack_base, SCM *fp, SCM *sp, scm_t_uint8 *ra,
|
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_dynstack *dynstack, scm_t_uint32 flags)
|
||||||
scm_t_uint32 flags)
|
|
||||||
{
|
{
|
||||||
struct scm_vm_cont *p;
|
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));
|
memset (p->stack_base, 0, p->stack_size * sizeof (SCM));
|
||||||
#endif
|
#endif
|
||||||
p->ra = ra;
|
p->ra = ra;
|
||||||
p->mvra = mvra;
|
|
||||||
p->sp = sp;
|
p->sp = sp;
|
||||||
p->fp = fp;
|
p->fp = fp;
|
||||||
memcpy (p->stack_base, stack_base, (sp + 1 - stack_base) * sizeof (SCM));
|
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);
|
vp = SCM_VM_DATA (vm);
|
||||||
cp = SCM_VM_CONT_DATA (cont);
|
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)
|
if (vp->stack_size < cp->stack_size + n + 4)
|
||||||
scm_misc_error ("vm-engine", "not enough space to reinstate continuation",
|
scm_misc_error ("vm-engine", "not enough space to reinstate continuation",
|
||||||
scm_list_2 (vm, cont));
|
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++;
|
||||||
*vp->sp = argv_copy[i];
|
*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 ();
|
vm = scm_the_vm ();
|
||||||
vp = SCM_VM_DATA (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),
|
scm_dynstack_capture_all (&thread->dynstack),
|
||||||
0);
|
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->sp = base - 1 + cp->stack_size;
|
||||||
vp->fp = RELOC (cp->fp);
|
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++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
vp->sp++;
|
vp->sp++;
|
||||||
*vp->sp = argv_copy[i];
|
*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
|
/* The prompt captured a slice of the dynamic stack. Here we wind
|
||||||
those entries onto the current thread's stack. We also have to
|
those entries onto the current thread's stack. We also have to
|
||||||
|
|
|
@ -88,7 +88,7 @@ SCM_API void scm_c_set_default_vm_engine_x (int engine);
|
||||||
struct scm_vm_cont {
|
struct scm_vm_cont {
|
||||||
SCM *sp;
|
SCM *sp;
|
||||||
SCM *fp;
|
SCM *fp;
|
||||||
scm_t_uint8 *ra, *mvra;
|
scm_t_uint8 *ra;
|
||||||
scm_t_ptrdiff stack_size;
|
scm_t_ptrdiff stack_size;
|
||||||
SCM *stack_base;
|
SCM *stack_base;
|
||||||
scm_t_ptrdiff reloc;
|
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_call_with_current_continuation (SCM proc);
|
||||||
SCM_INTERNAL SCM scm_i_capture_current_stack (void);
|
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_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_dynstack *dynstack,
|
||||||
scm_t_uint32 flags);
|
scm_t_uint32 flags);
|
||||||
SCM_INTERNAL void scm_i_vm_cont_print (SCM x, SCM port,
|
SCM_INTERNAL void scm_i_vm_cont_print (SCM x, SCM port,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue