[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 11/11: Refactor handling of auxiliary stacks and setjmp/
From: |
Andy Wingo |
Subject: |
[Guile-commits] 11/11: Refactor handling of auxiliary stacks and setjmp/longjmp |
Date: |
Sun, 17 Jun 2018 07:46:23 -0400 (EDT) |
wingo pushed a commit to branch master
in repository guile.
commit f84ce5442e2602b6a41c48f596728d32d0aa8e47
Author: Andy Wingo <address@hidden>
Date: Sun Jun 17 13:03:39 2018 +0200
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.
---
libguile/__scm.h | 21 -----------
libguile/_scm.h | 18 ----------
libguile/continuations.c | 90 ++++++++++++++++++++++++++++--------------------
libguile/continuations.h | 19 +++++-----
libguile/control.c | 14 ++++----
libguile/control.h | 6 ++--
libguile/deprecated.h | 4 ++-
libguile/dynstack.c | 11 +++---
libguile/dynstack.h | 10 +++---
libguile/eval.c | 4 +--
libguile/gc-malloc.c | 10 ++----
libguile/gc.c | 9 ++---
libguile/gc.h | 4 ---
libguile/init.c | 6 ----
libguile/threads.c | 36 -------------------
libguile/threads.h | 12 +++----
libguile/throw.c | 7 ++--
libguile/vm-engine.c | 2 +-
libguile/vm.c | 12 +++----
19 files changed, 109 insertions(+), 186 deletions(-)
diff --git a/libguile/__scm.h b/libguile/__scm.h
index 06e2e4e..518a3f4 100644
--- a/libguile/__scm.h
+++ b/libguile/__scm.h
@@ -414,27 +414,6 @@ typedef void *scm_t_subr;
typedef struct scm_dynamic_state scm_t_dynamic_state;
-
-
-/* scm_i_jmp_buf
- *
- * The corresponding SCM_I_SETJMP and SCM_I_LONGJMP are defined in the
- * _scm.h private header.
- */
-
-#if defined (__ia64__)
-# include <signal.h>
-# include <ucontext.h>
-typedef struct {
- ucontext_t ctx;
- int fresh;
-} scm_i_jmp_buf;
-
-#else
-# include <setjmp.h>
-typedef jmp_buf scm_i_jmp_buf;
-#endif
-
diff --git a/libguile/_scm.h b/libguile/_scm.h
index 0aac316..d68e9c7 100644
--- a/libguile/_scm.h
+++ b/libguile/_scm.h
@@ -158,24 +158,6 @@
-#if defined (__ia64__)
-/* IA64: Implement SCM_I_SETJMP in terms of getcontext. */
-# define SCM_I_SETJMP(JB) \
- ( (JB).fresh = 1, \
- getcontext (&((JB).ctx)), \
- ((JB).fresh ? ((JB).fresh = 0, 0) : 1) )
-# define SCM_I_LONGJMP(JB,VAL) scm_ia64_longjmp (&(JB), VAL)
-void scm_ia64_longjmp (scm_i_jmp_buf *, int);
-
-#else
-/* All other systems just use setjmp and longjmp. */
-
-#define SCM_I_SETJMP setjmp
-#define SCM_I_LONGJMP longjmp
-#endif
-
-
-
#if (defined __GNUC__)
# define SCM_NOINLINE __attribute__ ((__noinline__))
#else
diff --git a/libguile/continuations.c b/libguile/continuations.c
index b917f60..84cd2ee 100644
--- a/libguile/continuations.c
+++ b/libguile/continuations.c
@@ -26,6 +26,10 @@
#include <string.h>
#include <stdio.h>
+#if SCM_HAVE_AUXILIARY_STACK
+#include <ucontext.h>
+#endif
+
#include "libguile/_scm.h"
#include "libguile/async.h"
#include "libguile/backtrace.h"
@@ -112,6 +116,49 @@ continuation_print (SCM obj, SCM port, scm_print_state
*state SCM_UNUSED)
# define SCM_FLUSH_REGISTER_WINDOWS /* empty */
#endif
+static void
+capture_auxiliary_stack (scm_i_thread *thread, scm_t_contregs *continuation)
+{
+#if SCM_HAVE_AUXILIARY_STACK
+# ifndef __ia64__
+# error missing auxiliary stack implementation for architecture
+# endif
+ char *top;
+ ucontext_t ctx;
+
+ if (getcontext (&ctx) != 0)
+ abort ();
+
+#if defined __hpux
+ __uc_get_ar_bsp (ctx, (uint64_t *) &top);
+#elif defined linux
+ top = (char *) ctx->uc_mcontext.sc_ar_bsp;
+#elif defined __FreeBSD__
+ top = (char *)(ctx->uc_mcontext.mc_special.bspstore
+ + ctx->uc_mcontext.mc_special.ndirty);
+#else
+#error missing auxiliary stack implementation for ia64 on this OS
+#endif
+
+ continuation->auxiliary_stack_size =
+ top - (char *) thread->auxiliary_stack_base;
+ continuation->auxiliary_stack =
+ scm_gc_malloc (continuation->auxiliary_stack_size,
+ "continuation auxiliary stack");
+ memcpy (continuation->auxiliary_stack, thread->auxiliary_stack_base,
+ continuation->auxiliary_stack_size);
+#endif /* SCM_HAVE_AUXILIARY_STACK */
+}
+
+static void
+restore_auxiliary_stack (scm_i_thread *thread, scm_t_contregs *continuation)
+{
+#if SCM_HAVE_AUXILIARY_STACK
+ memcpy (thread->auxiliary_stack_base, continuation->auxiliary_stack,
+ continuation->auxiliary_stack_size);
+#endif
+}
+
/* this may return more than once: the first time with the escape
procedure, then subsequently with SCM_UNDEFINED (the vals already having
been
placed on the VM stack). */
@@ -142,27 +189,13 @@ scm_i_make_continuation (int *first, struct scm_vm *vp,
SCM vm_cont)
continuation->vp = vp;
continuation->vm_cont = vm_cont;
saved_cookie = vp->resumable_prompt_cookie;
+ capture_auxiliary_stack (thread, continuation);
SCM_NEWSMOB (cont, tc16_continuation, continuation);
- *first = !SCM_I_SETJMP (continuation->jmpbuf);
+ *first = !setjmp (continuation->jmpbuf);
if (*first)
- {
-#ifdef __ia64__
- continuation->backing_store_size =
- (char *) scm_ia64_ar_bsp(&continuation->jmpbuf.ctx)
- -
- (char *) thread->register_backing_store_base;
- continuation->backing_store = NULL;
- continuation->backing_store =
- scm_gc_malloc (continuation->backing_store_size,
- "continuation backing store");
- memcpy (continuation->backing_store,
- (void *) thread->register_backing_store_base,
- continuation->backing_store_size);
-#endif /* __ia64__ */
- return make_continuation_trampoline (cont);
- }
+ return make_continuation_trampoline (cont);
else
{
vp->resumable_prompt_cookie = saved_cookie;
@@ -264,31 +297,12 @@ copy_stack_and_call (scm_t_contregs *continuation,
memcpy (dst, continuation->stack,
sizeof (SCM_STACKITEM) * continuation->num_stack_items);
-#ifdef __ia64__
- thread->pending_rbs_continuation = continuation;
-#endif
+ restore_auxiliary_stack (thread, continuation);
scm_dynstack_wind (&thread->dynstack, joint);
- SCM_I_LONGJMP (continuation->jmpbuf, 1);
-}
-
-#ifdef __ia64__
-void
-scm_ia64_longjmp (scm_i_jmp_buf *JB, int VAL)
-{
- scm_i_thread *t = SCM_I_CURRENT_THREAD;
-
- if (t->pending_rbs_continuation)
- {
- memcpy (t->register_backing_store_base,
- t->pending_rbs_continuation->backing_store,
- t->pending_rbs_continuation->backing_store_size);
- t->pending_rbs_continuation = NULL;
- }
- setcontext (&JB->ctx);
+ longjmp (continuation->jmpbuf, 1);
}
-#endif
/* Call grow_stack until the stack space is large enough, then, as the current
* stack frame might get overwritten, let copy_stack_and_call perform the
diff --git a/libguile/continuations.h b/libguile/continuations.h
index ec12b46..e8be755 100644
--- a/libguile/continuations.h
+++ b/libguile/continuations.h
@@ -3,7 +3,8 @@
#ifndef SCM_CONTINUATIONS_H
#define SCM_CONTINUATIONS_H
-/* Copyright (C) 1995,1996,2000,2001, 2006, 2008, 2009, 2010, 2012, 2013, 2014
Free Software Foundation, Inc.
+/* Copyright (C) 1995-1996,2000-2001,2006,2008-2010,2012-2014,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
@@ -23,12 +24,10 @@
+#include <setjmp.h>
+
#include "libguile/__scm.h"
-#ifdef __ia64__
-#include <signal.h>
-#include <ucontext.h>
-#endif /* __ia64__ */
#define SCM_CONTINUATIONP(x) \
@@ -44,11 +43,11 @@
typedef struct
{
- scm_i_jmp_buf jmpbuf;
-#ifdef __ia64__
- void *backing_store;
- unsigned long backing_store_size;
-#endif /* __ia64__ */
+ jmp_buf jmpbuf;
+#if SCM_HAVE_AUXILIARY_STACK
+ void *auxiliary_stack;
+ unsigned long auxiliary_stack_size;
+#endif
size_t num_stack_items; /* size of the saved stack. */
SCM root; /* continuation root identifier. */
struct scm_vm *vp; /* vm */
diff --git a/libguile/control.c b/libguile/control.c
index 9688768..552a100 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, ®isters))
diff --git a/libguile/control.h b/libguile/control.h
index 84990ab..63ac3b9 100644
--- a/libguile/control.h
+++ b/libguile/control.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+/* Copyright (C) 2010-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
@@ -19,6 +19,8 @@
#ifndef SCM_CONTROL_H
#define SCM_CONTROL_H
+#include <setjmp.h>
+
#include "libguile/vm.h"
@@ -26,7 +28,7 @@ SCM_INTERNAL SCM scm_i_prompt_pop_abort_args_x (struct scm_vm
*vp,
scm_t_ptrdiff
saved_stack_depth);
SCM_INTERNAL void scm_c_abort (struct scm_vm *vp, SCM tag, size_t n, SCM *argv,
- scm_i_jmp_buf *registers) SCM_NORETURN;
+ jmp_buf *registers) SCM_NORETURN;
SCM_INTERNAL SCM scm_abort_to_prompt_star (SCM tag, SCM args) SCM_NORETURN;
diff --git a/libguile/deprecated.h b/libguile/deprecated.h
index af5e901..88b86df 100644
--- a/libguile/deprecated.h
+++ b/libguile/deprecated.h
@@ -1,7 +1,7 @@
#ifndef SCM_DEPRECATED_H
#define SCM_DEPRECATED_H
-/* Copyright (C) 2003-2007, 2009-2017 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2007, 2009-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
@@ -25,6 +25,8 @@
/* Deprecated declarations go here. */
+#define scm_i_jmp_buf scm_i_jmp_buf_GONE__USE_JMP_BUF_INSTEAD
+
void scm_i_init_deprecated (void);
#endif
diff --git a/libguile/dynstack.c b/libguile/dynstack.c
index 7448a9a..56a7b1e 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);
diff --git a/libguile/dynstack.h b/libguile/dynstack.h
index bd34d25..66a9907 100644
--- a/libguile/dynstack.h
+++ b/libguile/dynstack.h
@@ -3,7 +3,7 @@
#ifndef SCM_DYNSTACK_H
#define SCM_DYNSTACK_H
-/* 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
@@ -23,6 +23,8 @@
+#include <signal.h>
+
#include "libguile/__scm.h"
@@ -159,7 +161,7 @@ SCM_INTERNAL void scm_dynstack_push_prompt (scm_t_dynstack
*,
scm_t_ptrdiff fp_offset,
scm_t_ptrdiff sp_offset,
scm_t_uint32 *ip,
- scm_i_jmp_buf *registers);
+ jmp_buf *registers);
SCM_INTERNAL void scm_dynstack_push_dynwind (scm_t_dynstack *,
SCM enter, SCM leave);
@@ -199,7 +201,7 @@ SCM_INTERNAL scm_t_bits* scm_dynstack_find_prompt
(scm_t_dynstack *, SCM,
scm_t_ptrdiff *,
scm_t_ptrdiff *,
scm_t_uint32 **,
- scm_i_jmp_buf **);
+ jmp_buf **);
SCM_INTERNAL SCM scm_dynstack_find_old_fluid_value (scm_t_dynstack *,
SCM, size_t, SCM);
@@ -208,7 +210,7 @@ SCM_INTERNAL void scm_dynstack_relocate_prompts
(scm_t_dynstack *,
scm_t_ptrdiff);
SCM_INTERNAL void scm_dynstack_wind_prompt (scm_t_dynstack *, scm_t_bits *,
- scm_t_ptrdiff, scm_i_jmp_buf *);
+ scm_t_ptrdiff, jmp_buf *);
#endif /* SCM_DYNSTACK_H */
diff --git a/libguile/eval.c b/libguile/eval.c
index 8f71b87..8bfe465 100644
--- a/libguile/eval.c
+++ b/libguile/eval.c
@@ -429,7 +429,7 @@ eval (SCM x, SCM env)
{
struct scm_vm *vp;
SCM k, handler, res;
- scm_i_jmp_buf registers;
+ jmp_buf registers;
const void *prev_cookie;
scm_t_ptrdiff saved_stack_depth;
@@ -449,7 +449,7 @@ eval (SCM x, SCM env)
®isters);
prev_cookie = vp->resumable_prompt_cookie;
- if (SCM_I_SETJMP (registers))
+ if (setjmp (registers))
{
/* The prompt exited nonlocally. */
vp->resumable_prompt_cookie = prev_cookie;
diff --git a/libguile/gc-malloc.c b/libguile/gc-malloc.c
index 586bf17..0bf13f8 100644
--- a/libguile/gc-malloc.c
+++ b/libguile/gc-malloc.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- * 2004, 2006, 2008, 2009, 2010, 2011, 2012, 2013,
- * 2014 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2004,2006,2008-2014,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
@@ -29,11 +28,6 @@
#include <string.h>
#include <stdlib.h>
-#ifdef __ia64__
-#include <ucontext.h>
-extern unsigned long * __libc_ia64_register_backing_store_base;
-#endif
-
#include "libguile/_scm.h"
#include "libguile/eval.h"
#include "libguile/stime.h"
diff --git a/libguile/gc.c b/libguile/gc.c
index b9064b3..cf81b3c 100644
--- a/libguile/gc.c
+++ b/libguile/gc.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2006,
- * 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2017 Free Software
Foundation, Inc.
+/* Copyright (C) 1995-2003,2006,2008-2014,2016-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
@@ -31,11 +31,6 @@
#include <stdlib.h>
#include <math.h>
-#ifdef __ia64__
-#include <ucontext.h>
-extern unsigned long * __libc_ia64_register_backing_store_base;
-#endif
-
#include "libguile/_scm.h"
#include "libguile/eval.h"
#include "libguile/stime.h"
diff --git a/libguile/gc.h b/libguile/gc.h
index 7945f61..728bb07 100644
--- a/libguile/gc.h
+++ b/libguile/gc.h
@@ -93,10 +93,6 @@ SCM_INTERNAL scm_i_pthread_mutex_t scm_i_gc_admin_mutex;
#define scm_gc_running_p 0
SCM_INTERNAL scm_i_pthread_mutex_t scm_i_sweep_mutex;
-#ifdef __ia64__
-void *scm_ia64_ar_bsp (const void *);
-#endif
-
SCM_API unsigned long scm_gc_ports_collected;
diff --git a/libguile/init.c b/libguile/init.c
index 146e841..cd5e675 100644
--- a/libguile/init.c
+++ b/libguile/init.c
@@ -263,12 +263,6 @@ scm_load_startup_files ()
/* The main init code. */
-#ifdef _UNICOS
-typedef int setjmp_type;
-#else
-typedef long setjmp_type;
-#endif
-
/* All the data needed to invoke the main function. */
struct main_func_closure
{
diff --git a/libguile/threads.c b/libguile/threads.c
index a099eef..449d6fb 100644
--- a/libguile/threads.c
+++ b/libguile/threads.c
@@ -393,10 +393,6 @@ guilify_self_1 (struct GC_stack_base *base, int
needs_unregister)
t.pending_asyncs = SCM_EOL;
t.block_asyncs = 1;
t.base = base->mem_base;
-#ifdef __ia64__
- t.register_backing_store_base = base->reg_base;
- t.pending_rbs_continuation = 0;
-#endif
t.continuation_root = SCM_EOL;
t.continuation_base = t.base;
scm_i_pthread_cond_init (&t.sleep_cond, NULL);
@@ -1850,38 +1846,6 @@ scm_init_threads_default_dynamic_state ()
}
-/* IA64-specific things. */
-
-#ifdef __ia64__
-# ifdef __hpux
-void *
-scm_ia64_ar_bsp (const void *ctx)
-{
- uint64_t bsp;
- __uc_get_ar_bsp (ctx, &bsp);
- return (void *) bsp;
-}
-# endif /* hpux */
-# ifdef linux
-# include <ucontext.h>
-void *
-scm_ia64_ar_bsp (const void *opaque)
-{
- const ucontext_t *ctx = opaque;
- return (void *) ctx->uc_mcontext.sc_ar_bsp;
-}
-# endif /* linux */
-# ifdef __FreeBSD__
-# include <ucontext.h>
-void *
-scm_ia64_ar_bsp (const void *opaque)
-{
- const ucontext_t *ctx = opaque;
- return (void *)(ctx->uc_mcontext.mc_special.bspstore
- + ctx->uc_mcontext.mc_special.ndirty);
-}
-# endif /* __FreeBSD__ */
-#endif /* __ia64__ */
/*
diff --git a/libguile/threads.h b/libguile/threads.h
index 55c566d..e56994c 100644
--- a/libguile/threads.h
+++ b/libguile/threads.h
@@ -3,8 +3,8 @@
#ifndef SCM_THREADS_H
#define SCM_THREADS_H
-/* Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2006,
- * 2007, 2008, 2009, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1998,2000-2004,2006-2009,2011-2014,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,8 @@
+#include <setjmp.h>
+
#include "libguile/__scm.h"
#include "libguile/procs.h"
#include "libguile/throw.h"
@@ -104,11 +106,7 @@ typedef struct scm_i_thread {
/* For keeping track of the stack and registers. */
struct scm_vm *vp;
SCM_STACKITEM *base;
- scm_i_jmp_buf regs;
-#ifdef __ia64__
- void *register_backing_store_base;
- scm_t_contregs *pending_rbs_continuation;
-#endif
+ jmp_buf regs;
} scm_i_thread;
#define SCM_I_IS_THREAD(x) SCM_SMOB_PREDICATE (scm_tc16_thread, x)
diff --git a/libguile/throw.c b/libguile/throw.c
index a3adc42..7ef6dfd 100644
--- a/libguile/throw.c
+++ b/libguile/throw.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2003, 2004, 2006, 2008, 2009,
2010, 2011, 2012, 2013, 2014, 2017 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1998,2000-2001,2003-2004,2006,2008,2009-2014,2017-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
@@ -77,7 +78,7 @@ catch (SCM tag, SCM thunk, SCM handler, SCM
pre_unwind_handler)
SCM res;
scm_t_dynstack *dynstack = &SCM_I_CURRENT_THREAD->dynstack;
scm_t_dynamic_state *dynamic_state = SCM_I_CURRENT_THREAD->dynamic_state;
- scm_i_jmp_buf registers;
+ jmp_buf registers;
const void *prev_cookie;
scm_t_ptrdiff saved_stack_depth;
@@ -116,7 +117,7 @@ catch (SCM tag, SCM thunk, SCM handler, SCM
pre_unwind_handler)
scm_dynstack_push_fluid (dynstack, exception_handler_fluid, eh,
dynamic_state);
- if (SCM_I_SETJMP (registers))
+ if (setjmp (registers))
{
/* A non-local return. */
SCM args;
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c
index abfa1fb..71dad53 100644
--- a/libguile/vm-engine.c
+++ b/libguile/vm-engine.c
@@ -269,7 +269,7 @@
static SCM
VM_NAME (scm_i_thread *thread, struct scm_vm *vp,
- scm_i_jmp_buf *registers, int resume)
+ jmp_buf *registers, int resume)
{
/* Instruction pointer: A pointer to the opcode that is currently
running. */
diff --git a/libguile/vm.c b/libguile/vm.c
index 629b69e..a5e7214 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -337,11 +337,11 @@ static void vm_dispatch_abort_hook (struct scm_vm *vp)
static void
vm_abort (struct scm_vm *vp, SCM tag, size_t nargs,
- scm_i_jmp_buf *current_registers) SCM_NORETURN;
+ jmp_buf *current_registers) SCM_NORETURN;
static void
vm_abort (struct scm_vm *vp, SCM tag, size_t nargs,
- scm_i_jmp_buf *current_registers)
+ jmp_buf *current_registers)
{
size_t i;
SCM *argv;
@@ -381,7 +381,7 @@ vm_reinstate_partial_continuation_inner (void *data_ptr)
static void
vm_reinstate_partial_continuation (struct scm_vm *vp, SCM cont, size_t nargs,
scm_t_dynstack *dynstack,
- scm_i_jmp_buf *registers)
+ jmp_buf *registers)
{
struct vm_reinstate_partial_continuation_data data;
struct scm_vm_cont *cp;
@@ -721,7 +721,7 @@ scm_i_call_with_current_continuation (SCM proc)
#undef VM_NAME
typedef SCM (*scm_t_vm_engine) (scm_i_thread *current_thread, struct scm_vm
*vp,
- scm_i_jmp_buf *registers, int resume);
+ jmp_buf *registers, int resume);
static const scm_t_vm_engine vm_engines[SCM_VM_NUM_ENGINES] =
{ vm_regular_engine, vm_debug_engine };
@@ -1193,12 +1193,12 @@ scm_call_n (SCM proc, SCM *argv, size_t nargs)
SCM_FRAME_LOCAL (call_fp, i + 1) = argv[i];
{
- scm_i_jmp_buf registers;
+ jmp_buf registers;
int resume;
const void *prev_cookie = vp->resumable_prompt_cookie;
SCM ret;
- resume = SCM_I_SETJMP (registers);
+ resume = setjmp (registers);
if (SCM_UNLIKELY (resume))
{
scm_gc_after_nonlocal_exit ();
- [Guile-commits] branch master updated (601d0ea -> f84ce54), Andy Wingo, 2018/06/17
- [Guile-commits] 01/11: Remove unused macro in vm-engine, Andy Wingo, 2018/06/17
- [Guile-commits] 02/11: Remove unused vm_error_unbound, Andy Wingo, 2018/06/17
- [Guile-commits] 06/11: Simplify definition of SCM_SYSCALL., Andy Wingo, 2018/06/17
- [Guile-commits] 09/11: Remove unused getters for register backing store base, Andy Wingo, 2018/06/17
- [Guile-commits] 10/11: Add configure check for auxiliary stacks, Andy Wingo, 2018/06/17
- [Guile-commits] 03/11: Call out to expand_stack through new VM intrinsic, Andy Wingo, 2018/06/17
- [Guile-commits] 08/11: Remove #ifdef cases for VMS and Cray., Andy Wingo, 2018/06/17
- [Guile-commits] 05/11: Move some definitions out of _scm.h, Andy Wingo, 2018/06/17
- [Guile-commits] 07/11: Move "min" and "max" macros out of _scm.h, Andy Wingo, 2018/06/17
- [Guile-commits] 11/11: Refactor handling of auxiliary stacks and setjmp/longjmp,
Andy Wingo <=
- [Guile-commits] 04/11: Fix libguile subcomponent headers not to include <libguile.h>, Andy Wingo, 2018/06/17