summaryrefslogtreecommitdiff
path: root/libguile/control.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2018-06-17 13:03:39 +0200
committerAndy Wingo <wingo@pobox.com>2018-06-17 13:41:03 +0200
commitf84ce5442e2602b6a41c48f596728d32d0aa8e47 (patch)
tree0679134bc6d2581d3eb7ddab8c009dcf7c0fa300 /libguile/control.c
parent574f67d1b6e3b89171c7df8f043fc3891bd8a870 (diff)
downloadguile-f84ce5442e2602b6a41c48f596728d32d0aa8e47.tar.gz
Refactor handling of auxiliary stacks and setjmp/longjmp
* libguile/__scm.h (scm_i_jmp_buf): Remove definition, which was a shim for ia64. Instead, always use setjmp/longjmp and jmp_buf. * libguile/_scm.h (SCM_I_SETJMP, SCM_I_LONGJMP): Remove; instead use setjmp and longjmp. * libguile/continuations.c (capture_auxiliary_stack): (restore_auxiliary_stack): New helpers. (scm_i_make_continuation): Use capture_auxiliary_stack. (copy_stack_and_call): Use restore_auxiliary_stack. No need to stash the aux stack on the thread, either. * libguile/continuations.h (scm_t_contregs): Use SCM_HAVE_AUXILIARY_STACK to flag when to have an auxiliary_stack member. * libguile/control.h: * libguile/control.c (reify_partial_continuation, scm_c_abort): (scm_suspendable_continuation_p): Adapt to use setjmp/longjmp directly. * libguile/deprecated.h: Add deprecated scm_i_jmp_buf define. * libguile/dynstack.h: * libguile/dynstack.c (PROMPT_JMPBUF): (scm_dynstack_push_prompt, scm_dynstack_find_prompt): (scm_dynstack_wind_prompt): Adapt to jmp_buf type. * libguile/eval.c (eval): Use jmp_buf and setjmp directly. * libguile/gc-malloc.c: No need for ia64-specific things. * libguile/gc.c: No need for ia64-specific things. * libguile/gc.h: No need to declare scm_ia64_ar_bsp. * libguile/init.c: Remove typedef of setjmp_type for Cray, unused. * libguile/threads.c (guilify_self_1): No more pending_rbs_continuation in scm_i_thread, and register_backing_store_base is handled by libgc. (scm_ia64_ar_bsp): Remove definitions; inlined into continuations.c's capture_auxiliary_stack. * libguile/threads.h (scm_i_thread): jmpbuf member is plain jmp_buf. * libguile/throw.c (catch): Just use jmp_buf and setjmp. * libguile/vm-engine.c (VM_NAME): Adapt prototype to take jmp_buf pointer. * libguile/vm.c (vm_abort): Adapt jmp_buf types. (scm_call_n): Use setjmp.
Diffstat (limited to 'libguile/control.c')
-rw-r--r--libguile/control.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libguile/control.c b/libguile/control.c
index 968876823..552a10061 100644
--- a/libguile/control.c
+++ b/libguile/control.c
@@ -38,7 +38,7 @@
-/* Only to be called if the SCM_I_SETJMP returns 1 */
+/* Only to be called if the setjmp returns 1 */
SCM
scm_i_prompt_pop_abort_args_x (struct scm_vm *vp,
scm_t_ptrdiff saved_stack_depth)
@@ -86,9 +86,9 @@ reify_partial_continuation (struct scm_vm *vp,
union scm_vm_stack_element *saved_fp,
union scm_vm_stack_element *saved_sp,
scm_t_uint32 *saved_ip,
- scm_i_jmp_buf *saved_registers,
+ jmp_buf *saved_registers,
scm_t_dynstack *dynstack,
- scm_i_jmp_buf *current_registers)
+ jmp_buf *current_registers)
{
SCM vm_cont;
scm_t_uint32 flags;
@@ -125,7 +125,7 @@ reify_partial_continuation (struct scm_vm *vp,
void
scm_c_abort (struct scm_vm *vp, SCM tag, size_t n, SCM *argv,
- scm_i_jmp_buf *current_registers)
+ jmp_buf *current_registers)
{
SCM cont;
scm_t_dynstack *dynstack = &SCM_I_CURRENT_THREAD->dynstack;
@@ -134,7 +134,7 @@ scm_c_abort (struct scm_vm *vp, SCM tag, size_t n, SCM *argv,
scm_t_ptrdiff fp_offset, sp_offset;
union scm_vm_stack_element *fp, *sp;
scm_t_uint32 *ip;
- scm_i_jmp_buf *registers;
+ jmp_buf *registers;
size_t i;
prompt = scm_dynstack_find_prompt (dynstack, tag,
@@ -177,7 +177,7 @@ scm_c_abort (struct scm_vm *vp, SCM tag, size_t n, SCM *argv,
vp->sp[n - i - 1].as_scm = argv[i];
/* Jump! */
- SCM_I_LONGJMP (*registers, 1);
+ longjmp (*registers, 1);
/* Shouldn't get here */
abort ();
@@ -213,7 +213,7 @@ scm_suspendable_continuation_p (SCM tag)
{
scm_t_dynstack_prompt_flags flags;
scm_i_thread *thread = SCM_I_CURRENT_THREAD;
- scm_i_jmp_buf *registers;
+ jmp_buf *registers;
if (scm_dynstack_find_prompt (&thread->dynstack, tag, &flags,
NULL, NULL, NULL, &registers))