summaryrefslogtreecommitdiff
path: root/libguile/dynstack.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/dynstack.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/dynstack.c')
-rw-r--r--libguile/dynstack.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libguile/dynstack.c b/libguile/dynstack.c
index 7448a9ab5..56a7b1efb 100644
--- a/libguile/dynstack.c
+++ b/libguile/dynstack.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012, 2013 Free Software Foundation, Inc.
+/* Copyright (C) 2012-2013,2018 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
@@ -24,6 +24,7 @@
#endif
#include <assert.h>
+#include <setjmp.h>
#include "libguile/_scm.h"
#include "libguile/control.h"
@@ -41,7 +42,7 @@
#define PROMPT_SP(top) ((scm_t_ptrdiff) ((top)[2]))
#define SET_PROMPT_SP(top, sp) do { top[2] = (scm_t_bits)(sp); } while (0)
#define PROMPT_IP(top) ((scm_t_uint32 *) ((top)[3]))
-#define PROMPT_JMPBUF(top) ((scm_i_jmp_buf *) ((top)[4]))
+#define PROMPT_JMPBUF(top) ((jmp_buf *) ((top)[4]))
#define WINDER_WORDS 2
#define WINDER_PROC(top) ((scm_t_guard) ((top)[0]))
@@ -193,7 +194,7 @@ scm_dynstack_push_prompt (scm_t_dynstack *dynstack,
scm_t_dynstack_prompt_flags flags,
SCM key,
scm_t_ptrdiff fp_offset, scm_t_ptrdiff sp_offset,
- scm_t_uint32 *ip, scm_i_jmp_buf *registers)
+ scm_t_uint32 *ip, jmp_buf *registers)
{
scm_t_bits *words;
@@ -496,7 +497,7 @@ scm_t_bits*
scm_dynstack_find_prompt (scm_t_dynstack *dynstack, SCM key,
scm_t_dynstack_prompt_flags *flags,
scm_t_ptrdiff *fp_offset, scm_t_ptrdiff *sp_offset,
- scm_t_uint32 **ip, scm_i_jmp_buf **registers)
+ scm_t_uint32 **ip, jmp_buf **registers)
{
scm_t_bits *walk;
@@ -577,7 +578,7 @@ scm_dynstack_find_old_fluid_value (scm_t_dynstack *dynstack, SCM fluid,
void
scm_dynstack_wind_prompt (scm_t_dynstack *dynstack, scm_t_bits *item,
scm_t_ptrdiff base_fp_offset,
- scm_i_jmp_buf *registers)
+ jmp_buf *registers)
{
scm_t_bits tag = SCM_DYNSTACK_TAG (item);