* libguile/control.h:
* libguile/control.c (reify_partial_continuation, scm_c_abort): Take
struct scm_vm *vp as an arg.
* libguile/dynstack.h: Remove control.h include.
* libguile/vm.c (vm_abort): Take struct scm_vm *vp as an arg.
* libguile/vm-engine.c (abort): Adapt to vm_abort change.
-reify_partial_continuation (SCM vm,
+reify_partial_continuation (struct scm_vm *vp,
SCM *saved_fp,
SCM *saved_sp,
scm_t_uint32 *saved_ip,
SCM *saved_fp,
SCM *saved_sp,
scm_t_uint32 *saved_ip,
could determine the stack bottom in O(1) time, but that's no longer
the case, since the thunk application doesn't occur where the
prompt is saved. */
could determine the stack bottom in O(1) time, but that's no longer
the case, since the thunk application doesn't occur where the
prompt is saved. */
- for (bottom_fp = SCM_VM_DATA (vm)->fp;
+ for (bottom_fp = vp->fp;
SCM_FRAME_DYNAMIC_LINK (bottom_fp) > saved_fp;
bottom_fp = SCM_FRAME_DYNAMIC_LINK (bottom_fp));
SCM_FRAME_DYNAMIC_LINK (bottom_fp) > saved_fp;
bottom_fp = SCM_FRAME_DYNAMIC_LINK (bottom_fp));
/* Capture from the top of the thunk application frame up to the end. */
vm_cont = scm_i_vm_capture_stack (&SCM_FRAME_LOCAL (bottom_fp, 0),
/* Capture from the top of the thunk application frame up to the end. */
vm_cont = scm_i_vm_capture_stack (&SCM_FRAME_LOCAL (bottom_fp, 0),
- SCM_VM_DATA (vm)->fp,
- SCM_VM_DATA (vm)->sp,
- SCM_VM_DATA (vm)->ip,
+ vp->fp,
+ vp->sp,
+ vp->ip,
-scm_c_abort (SCM vm, SCM tag, size_t n, SCM *argv,
+scm_c_abort (struct scm_vm *vp, SCM tag, size_t n, SCM *argv,
scm_i_jmp_buf *current_registers)
{
SCM cont;
scm_i_jmp_buf *current_registers)
{
SCM cont;
if (!prompt)
scm_misc_error ("abort", "Abort to unknown prompt", scm_list_1 (tag));
if (!prompt)
scm_misc_error ("abort", "Abort to unknown prompt", scm_list_1 (tag));
- fp = SCM_VM_DATA (vm)->stack_base + fp_offset;
- sp = SCM_VM_DATA (vm)->stack_base + sp_offset;
+ fp = vp->stack_base + fp_offset;
+ sp = vp->stack_base + sp_offset;
/* Only reify if the continuation referenced in the handler. */
if (flags & SCM_F_DYNSTACK_PROMPT_ESCAPE_ONLY)
/* Only reify if the continuation referenced in the handler. */
if (flags & SCM_F_DYNSTACK_PROMPT_ESCAPE_ONLY)
scm_t_dynstack *captured;
captured = scm_dynstack_capture (dynstack, SCM_DYNSTACK_NEXT (prompt));
scm_t_dynstack *captured;
captured = scm_dynstack_capture (dynstack, SCM_DYNSTACK_NEXT (prompt));
- cont = reify_partial_continuation (vm, fp, sp, ip, registers, captured,
+ cont = reify_partial_continuation (vp, fp, sp, ip, registers, captured,
current_registers);
}
/* Unwind. */
scm_dynstack_unwind (dynstack, prompt);
current_registers);
}
/* Unwind. */
scm_dynstack_unwind (dynstack, prompt);
- /* Unwinding may have changed the current thread's VM, so use the
- new one. */
- vm = scm_the_vm ();
-
- SCM_VM_DATA (vm)->fp = fp;
- SCM_VM_DATA (vm)->sp = sp;
- SCM_VM_DATA (vm)->ip = ip;
+ vp->fp = fp;
+ vp->sp = sp;
+ vp->ip = ip;
/* Since we're jumping down, we should always have enough space. */
/* Since we're jumping down, we should always have enough space. */
- if (SCM_VM_DATA (vm)->sp + n + 1 >= SCM_VM_DATA (vm)->stack_limit)
+ if (vp->sp + n + 1 >= vp->stack_limit)
abort ();
/* Push vals */
abort ();
/* Push vals */
- *(++(SCM_VM_DATA (vm)->sp)) = cont;
- *(++(SCM_VM_DATA (vm)->sp)) = argv[i];
+ *(++(vp->sp)) = argv[i];
if (flags & SCM_F_DYNSTACK_PROMPT_PUSH_NARGS)
if (flags & SCM_F_DYNSTACK_PROMPT_PUSH_NARGS)
- *(++(SCM_VM_DATA (vm)->sp)) = scm_from_size_t (n+1); /* +1 for continuation */
+ *(++(vp->sp)) = scm_from_size_t (n+1); /* +1 for continuation */
/* Jump! */
SCM_I_LONGJMP (*registers, 1);
/* Jump! */
SCM_I_LONGJMP (*registers, 1);
for (i = 0; i < n; i++, args = scm_cdr (args))
argv[i] = scm_car (args);
for (i = 0; i < n; i++, args = scm_cdr (args))
argv[i] = scm_car (args);
- scm_c_abort (scm_the_vm (), tag, n, argv, NULL);
+ scm_c_abort (SCM_VM_DATA (scm_the_vm ()), tag, n, argv, NULL);
/* Oh, what, you're still here? The abort must have been reinstated. Actually,
that's quite impossible, given that we're already in C-land here, so...
/* Oh, what, you're still here? The abort must have been reinstated. Actually,
that's quite impossible, given that we're already in C-land here, so...
#ifndef SCM_CONTROL_H
#define SCM_CONTROL_H
#ifndef SCM_CONTROL_H
#define SCM_CONTROL_H
+#include "libguile/vm.h"
+
SCM_INTERNAL SCM scm_i_prompt_pop_abort_args_x (SCM vm);
SCM_INTERNAL SCM scm_i_prompt_pop_abort_args_x (SCM vm);
-SCM_INTERNAL void scm_c_abort (SCM vm, SCM tag, size_t n, SCM *argv,
+SCM_INTERNAL void scm_c_abort (struct scm_vm *vp, SCM tag, size_t n, SCM *argv,
scm_i_jmp_buf *registers) SCM_NORETURN;
SCM_INTERNAL SCM scm_abort_to_prompt_star (SCM tag, SCM args) SCM_NORETURN;
scm_i_jmp_buf *registers) SCM_NORETURN;
SCM_INTERNAL SCM scm_abort_to_prompt_star (SCM tag, SCM args) SCM_NORETURN;
\f
#include "libguile/__scm.h"
\f
#include "libguile/__scm.h"
-#include "libguile/control.h"
it continues with the next instruction. */
ip++;
SYNC_IP ();
it continues with the next instruction. */
ip++;
SYNC_IP ();
- vm_abort (vm, LOCAL_REF (1), nlocals - 2, LOCAL_ADDRESS (2),
+ vm_abort (vp, LOCAL_REF (1), nlocals - 2, LOCAL_ADDRESS (2),
SCM_EOL, LOCAL_ADDRESS (0), ®isters);
/* vm_abort should not return */
SCM_EOL, LOCAL_ADDRESS (0), ®isters);
/* vm_abort should not return */
-vm_abort (SCM vm, SCM tag, size_t nstack, SCM *stack_args, SCM tail, SCM *sp,
+vm_abort (struct scm_vm *vp, SCM tag,
+ size_t nstack, SCM *stack_args, SCM tail, SCM *sp,
scm_i_jmp_buf *current_registers) SCM_NORETURN;
static void
scm_i_jmp_buf *current_registers) SCM_NORETURN;
static void
-vm_abort (SCM vm, SCM tag, size_t nstack, SCM *stack_args, SCM tail, SCM *sp,
+vm_abort (struct scm_vm *vp, SCM tag,
+ size_t nstack, SCM *stack_args, SCM tail, SCM *sp,
scm_i_jmp_buf *current_registers)
{
size_t i;
scm_i_jmp_buf *current_registers)
{
size_t i;
argv[i] = scm_car (tail);
/* FIXME: NULLSTACK (SCM_VM_DATA (vp)->sp - sp) */
argv[i] = scm_car (tail);
/* FIXME: NULLSTACK (SCM_VM_DATA (vp)->sp - sp) */
- SCM_VM_DATA (vm)->sp = sp;
- scm_c_abort (vm, tag, nstack + tail_len, argv, current_registers);
+ scm_c_abort (vp, tag, nstack + tail_len, argv, current_registers);