1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00

Rename scm_i_thread to scm_thread

* libguile/scm.h (struct scm_thread, scm_thread): Rename from
  scm_i_thread.
* libguile/deprecated.h (scm_i_thread): Add deprecated typedef.
* libguile/threads.h: Adapt to renaming.
* libguile/intrinsics.h:
* libguile/scmsigs.h:
* libguile/cache-internal.h: Remove threads.h includes; unnecessary with
  the forward decl.
* libguile/continuations.h:
* libguile/gc-inline.h:
* libguile/async.h: Adapt scm_thread type name change.
* libguile/async.c:
* libguile/continuations.c:
* libguile/control.c:
* libguile/dynstack.c:
* libguile/dynwind.c:
* libguile/eval.c:
* libguile/finalizers.c:
* libguile/fluids.c:
* libguile/gc.c:
* libguile/intrinsics.c:
* libguile/load.c:
* libguile/memoize.c:
* libguile/print.c:
* libguile/read.c:
* libguile/scmsigs.c:
* libguile/script.c:
* libguile/stackchk.c:
* libguile/stacks.c:
* libguile/symbols.c:
* libguile/threads.c:
* libguile/throw.c:
* libguile/vm-engine.c:
* libguile/vm.c: Adapt to type name change, and add additional includes
  as needed.
This commit is contained in:
Andy Wingo 2018-06-26 11:40:22 +02:00
parent 51e35158ba
commit 5804c977d7
32 changed files with 124 additions and 115 deletions

View file

@ -56,7 +56,7 @@
*/ */
void void
scm_i_async_push (scm_i_thread *t, SCM proc) scm_i_async_push (scm_thread *t, SCM proc)
{ {
SCM asyncs; SCM asyncs;
@ -102,7 +102,7 @@ scm_i_async_push (scm_i_thread *t, SCM proc)
/* Precondition: there are pending asyncs. */ /* Precondition: there are pending asyncs. */
SCM SCM
scm_i_async_pop (scm_i_thread *t) scm_i_async_pop (scm_thread *t)
{ {
while (1) while (1)
{ {
@ -140,7 +140,7 @@ scm_i_async_pop (scm_i_thread *t)
void void
scm_async_tick (void) scm_async_tick (void)
{ {
scm_i_thread *t = SCM_I_CURRENT_THREAD; scm_thread *t = SCM_I_CURRENT_THREAD;
if (t->block_asyncs) if (t->block_asyncs)
return; return;
@ -163,7 +163,7 @@ struct scm_thread_wake_data {
}; };
int int
scm_i_prepare_to_wait (scm_i_thread *t, scm_i_prepare_to_wait (scm_thread *t,
struct scm_thread_wake_data *wake) struct scm_thread_wake_data *wake)
{ {
if (t->block_asyncs) if (t->block_asyncs)
@ -183,13 +183,13 @@ scm_i_prepare_to_wait (scm_i_thread *t,
} }
void void
scm_i_wait_finished (scm_i_thread *t) scm_i_wait_finished (scm_thread *t)
{ {
scm_atomic_set_pointer ((void **)&t->wake, NULL); scm_atomic_set_pointer ((void **)&t->wake, NULL);
} }
int int
scm_i_prepare_to_wait_on_fd (scm_i_thread *t, int fd) scm_i_prepare_to_wait_on_fd (scm_thread *t, int fd)
{ {
struct scm_thread_wake_data *wake; struct scm_thread_wake_data *wake;
wake = scm_gc_typed_calloc (struct scm_thread_wake_data); wake = scm_gc_typed_calloc (struct scm_thread_wake_data);
@ -205,7 +205,7 @@ scm_c_prepare_to_wait_on_fd (int fd)
} }
int int
scm_i_prepare_to_wait_on_cond (scm_i_thread *t, scm_i_prepare_to_wait_on_cond (scm_thread *t,
scm_i_pthread_mutex_t *m, scm_i_pthread_mutex_t *m,
scm_i_pthread_cond_t *c) scm_i_pthread_cond_t *c)
{ {
@ -242,7 +242,7 @@ SCM_DEFINE (scm_system_async_mark_for_thread, "system-async-mark", 1, 1, 0,
"signal handlers.") "signal handlers.")
#define FUNC_NAME s_scm_system_async_mark_for_thread #define FUNC_NAME s_scm_system_async_mark_for_thread
{ {
scm_i_thread *t; scm_thread *t;
struct scm_thread_wake_data *wake; struct scm_thread_wake_data *wake;
if (SCM_UNBNDP (thread)) if (SCM_UNBNDP (thread))
@ -321,14 +321,14 @@ SCM_DEFINE (scm_noop, "noop", 0, 0, 1,
static void static void
increase_block (void *data) increase_block (void *data)
{ {
scm_i_thread *t = data; scm_thread *t = data;
t->block_asyncs++; t->block_asyncs++;
} }
static void static void
decrease_block (void *data) decrease_block (void *data)
{ {
scm_i_thread *t = data; scm_thread *t = data;
if (--t->block_asyncs == 0) if (--t->block_asyncs == 0)
scm_async_tick (); scm_async_tick ();
} }
@ -336,7 +336,7 @@ decrease_block (void *data)
void void
scm_dynwind_block_asyncs (void) scm_dynwind_block_asyncs (void)
{ {
scm_i_thread *t = SCM_I_CURRENT_THREAD; scm_thread *t = SCM_I_CURRENT_THREAD;
scm_dynwind_rewind_handler (increase_block, t, SCM_F_WIND_EXPLICITLY); scm_dynwind_rewind_handler (increase_block, t, SCM_F_WIND_EXPLICITLY);
scm_dynwind_unwind_handler (decrease_block, t, SCM_F_WIND_EXPLICITLY); scm_dynwind_unwind_handler (decrease_block, t, SCM_F_WIND_EXPLICITLY);
} }
@ -344,7 +344,7 @@ scm_dynwind_block_asyncs (void)
void void
scm_dynwind_unblock_asyncs (void) scm_dynwind_unblock_asyncs (void)
{ {
scm_i_thread *t = SCM_I_CURRENT_THREAD; scm_thread *t = SCM_I_CURRENT_THREAD;
if (t->block_asyncs == 0) if (t->block_asyncs == 0)
scm_misc_error ("scm_with_unblocked_asyncs", scm_misc_error ("scm_with_unblocked_asyncs",
"asyncs already unblocked", SCM_EOL); "asyncs already unblocked", SCM_EOL);

View file

@ -48,16 +48,16 @@ SCM_API void *scm_c_call_with_unblocked_asyncs (void *(*p) (void *d), void *d);
SCM_API void scm_dynwind_block_asyncs (void); SCM_API void scm_dynwind_block_asyncs (void);
SCM_API void scm_dynwind_unblock_asyncs (void); SCM_API void scm_dynwind_unblock_asyncs (void);
SCM_INTERNAL int scm_i_prepare_to_wait (scm_i_thread *, SCM_INTERNAL int scm_i_prepare_to_wait (scm_thread *,
struct scm_thread_wake_data *); struct scm_thread_wake_data *);
SCM_INTERNAL void scm_i_wait_finished (scm_i_thread *); SCM_INTERNAL void scm_i_wait_finished (scm_thread *);
SCM_INTERNAL int scm_i_prepare_to_wait_on_fd (scm_i_thread *, int); SCM_INTERNAL int scm_i_prepare_to_wait_on_fd (scm_thread *, int);
SCM_INTERNAL int scm_i_prepare_to_wait_on_cond (scm_i_thread *, SCM_INTERNAL int scm_i_prepare_to_wait_on_cond (scm_thread *,
scm_i_pthread_mutex_t *, scm_i_pthread_mutex_t *,
scm_i_pthread_cond_t *); scm_i_pthread_cond_t *);
SCM_INTERNAL void scm_i_async_push (scm_i_thread *t, SCM proc); SCM_INTERNAL void scm_i_async_push (scm_thread *t, SCM proc);
SCM_INTERNAL SCM scm_i_async_pop (scm_i_thread *t); SCM_INTERNAL SCM scm_i_async_pop (scm_thread *t);
SCM_INTERNAL void scm_init_async (void); SCM_INTERNAL void scm_init_async (void);

View file

@ -27,7 +27,6 @@
#include "libguile/gc.h" #include "libguile/gc.h"
#include "libguile/hash.h" #include "libguile/hash.h"
#include "libguile/threads.h"
/* A simple cache with 8 entries. The cache entries are stored in a /* A simple cache with 8 entries. The cache entries are stored in a

View file

@ -124,7 +124,7 @@ continuation_print (SCM obj, SCM port, scm_print_state *state SCM_UNUSED)
#endif #endif
static void static void
capture_auxiliary_stack (scm_i_thread *thread, scm_t_contregs *continuation) capture_auxiliary_stack (scm_thread *thread, scm_t_contregs *continuation)
{ {
#if SCM_HAVE_AUXILIARY_STACK #if SCM_HAVE_AUXILIARY_STACK
# if !(defined __ia64 or defined __ia64__) # if !(defined __ia64 or defined __ia64__)
@ -158,7 +158,7 @@ capture_auxiliary_stack (scm_i_thread *thread, scm_t_contregs *continuation)
} }
static void static void
restore_auxiliary_stack (scm_i_thread *thread, scm_t_contregs *continuation) restore_auxiliary_stack (scm_thread *thread, scm_t_contregs *continuation)
{ {
#if SCM_HAVE_AUXILIARY_STACK #if SCM_HAVE_AUXILIARY_STACK
memcpy (thread->auxiliary_stack_base, continuation->auxiliary_stack, memcpy (thread->auxiliary_stack_base, continuation->auxiliary_stack,
@ -167,7 +167,7 @@ restore_auxiliary_stack (scm_i_thread *thread, scm_t_contregs *continuation)
} }
SCM SCM
scm_i_make_continuation (jmp_buf *registers, scm_i_thread *thread, SCM vm_cont) scm_i_make_continuation (jmp_buf *registers, scm_thread *thread, SCM vm_cont)
{ {
SCM cont; SCM cont;
scm_t_contregs *continuation; scm_t_contregs *continuation;
@ -277,7 +277,7 @@ copy_stack_and_call (scm_t_contregs *continuation,
{ {
scm_t_dynstack *dynstack; scm_t_dynstack *dynstack;
scm_t_bits *joint; scm_t_bits *joint;
scm_i_thread *thread = SCM_I_CURRENT_THREAD; scm_thread *thread = SCM_I_CURRENT_THREAD;
dynstack = SCM_VM_CONT_DATA (continuation->vm_cont)->dynstack; dynstack = SCM_VM_CONT_DATA (continuation->vm_cont)->dynstack;
@ -299,7 +299,7 @@ copy_stack_and_call (scm_t_contregs *continuation,
static void static void
scm_dynthrow (SCM cont) scm_dynthrow (SCM cont)
{ {
scm_i_thread *thread = SCM_I_CURRENT_THREAD; scm_thread *thread = SCM_I_CURRENT_THREAD;
scm_t_contregs *continuation = SCM_CONTREGS (cont); scm_t_contregs *continuation = SCM_CONTREGS (cont);
SCM_STACKITEM *dst = thread->continuation_base; SCM_STACKITEM *dst = thread->continuation_base;
SCM_STACKITEM stack_top_element; SCM_STACKITEM stack_top_element;
@ -333,7 +333,7 @@ scm_i_with_continuation_barrier (scm_t_catch_body body,
void *pre_unwind_handler_data) void *pre_unwind_handler_data)
{ {
SCM_STACKITEM stack_item; SCM_STACKITEM stack_item;
scm_i_thread *thread = SCM_I_CURRENT_THREAD; scm_thread *thread = SCM_I_CURRENT_THREAD;
SCM old_controot; SCM old_controot;
SCM_STACKITEM *old_contbase; SCM_STACKITEM *old_contbase;
SCM result; SCM result;

View file

@ -68,7 +68,7 @@ typedef struct
SCM_INTERNAL SCM scm_i_make_continuation (jmp_buf *registers, SCM_INTERNAL SCM scm_i_make_continuation (jmp_buf *registers,
scm_i_thread *thread, scm_thread *thread,
SCM vm_cont); SCM vm_cont);
SCM_INTERNAL void scm_i_reinstate_continuation (SCM cont) SCM_NORETURN; SCM_INTERNAL void scm_i_reinstate_continuation (SCM cont) SCM_NORETURN;

View file

@ -219,7 +219,7 @@ static SCM
scm_suspendable_continuation_p (SCM tag) scm_suspendable_continuation_p (SCM tag)
{ {
scm_t_dynstack_prompt_flags flags; scm_t_dynstack_prompt_flags flags;
scm_i_thread *thread = SCM_I_CURRENT_THREAD; scm_thread *thread = SCM_I_CURRENT_THREAD;
jmp_buf *registers; jmp_buf *registers;
if (scm_dynstack_find_prompt (&thread->dynstack, tag, &flags, if (scm_dynstack_find_prompt (&thread->dynstack, tag, &flags,

View file

@ -107,6 +107,8 @@ typedef uintptr_t scm_t_uintptr SCM_DEPRECATED_TYPE;
typedef int64_t scm_t_int64 SCM_DEPRECATED_TYPE; typedef int64_t scm_t_int64 SCM_DEPRECATED_TYPE;
typedef uint64_t scm_t_uint64 SCM_DEPRECATED_TYPE; typedef uint64_t scm_t_uint64 SCM_DEPRECATED_TYPE;
typedef ptrdiff_t scm_t_ptrdiff SCM_DEPRECATED_TYPE; typedef ptrdiff_t scm_t_ptrdiff SCM_DEPRECATED_TYPE;
typedef struct scm_thread scm_i_thread SCM_DEPRECATED_TYPE;
#undef SCM_DEPRECATED_TYPE #undef SCM_DEPRECATED_TYPE
void scm_i_init_deprecated (void); void scm_i_init_deprecated (void);

View file

@ -31,6 +31,7 @@
#include "eval.h" #include "eval.h"
#include "fluids.h" #include "fluids.h"
#include "variable.h" #include "variable.h"
#include "threads.h"
#include "dynstack.h" #include "dynstack.h"

View file

@ -39,7 +39,7 @@ scm_dynamic_wind (SCM in_guard, SCM thunk, SCM out_guard)
#define FUNC_NAME "dynamic-wind" #define FUNC_NAME "dynamic-wind"
{ {
SCM ans; SCM ans;
scm_i_thread *thread = SCM_I_CURRENT_THREAD; scm_thread *thread = SCM_I_CURRENT_THREAD;
SCM_ASSERT (scm_is_true (scm_thunk_p (out_guard)), out_guard, SCM_ASSERT (scm_is_true (scm_thunk_p (out_guard)), out_guard,
SCM_ARG3, FUNC_NAME); SCM_ARG3, FUNC_NAME);
@ -60,7 +60,7 @@ scm_dynamic_wind (SCM in_guard, SCM thunk, SCM out_guard)
void void
scm_dynwind_begin (scm_t_dynwind_flags flags) scm_dynwind_begin (scm_t_dynwind_flags flags)
{ {
scm_i_thread *thread = SCM_I_CURRENT_THREAD; scm_thread *thread = SCM_I_CURRENT_THREAD;
scm_dynstack_push_frame (&thread->dynstack, flags); scm_dynstack_push_frame (&thread->dynstack, flags);
} }
@ -75,7 +75,7 @@ void
scm_dynwind_unwind_handler (void (*proc) (void *), void *data, scm_dynwind_unwind_handler (void (*proc) (void *), void *data,
scm_t_wind_flags flags) scm_t_wind_flags flags)
{ {
scm_i_thread *thread = SCM_I_CURRENT_THREAD; scm_thread *thread = SCM_I_CURRENT_THREAD;
scm_t_dynstack *dynstack = &thread->dynstack; scm_t_dynstack *dynstack = &thread->dynstack;
scm_dynstack_push_unwinder (dynstack, flags, proc, data); scm_dynstack_push_unwinder (dynstack, flags, proc, data);
@ -85,7 +85,7 @@ void
scm_dynwind_rewind_handler (void (*proc) (void *), void *data, scm_dynwind_rewind_handler (void (*proc) (void *), void *data,
scm_t_wind_flags flags) scm_t_wind_flags flags)
{ {
scm_i_thread *thread = SCM_I_CURRENT_THREAD; scm_thread *thread = SCM_I_CURRENT_THREAD;
scm_t_dynstack *dynstack = &thread->dynstack; scm_t_dynstack *dynstack = &thread->dynstack;
scm_dynstack_push_rewinder (dynstack, 0, proc, data); scm_dynstack_push_rewinder (dynstack, 0, proc, data);

View file

@ -436,7 +436,7 @@ eval (SCM x, SCM env)
case SCM_M_CALL_WITH_PROMPT: case SCM_M_CALL_WITH_PROMPT:
{ {
scm_i_thread *t; scm_thread *t;
SCM k, handler, res; SCM k, handler, res;
jmp_buf registers; jmp_buf registers;
const void *prev_cookie; const void *prev_cookie;

View file

@ -155,7 +155,7 @@ run_finalizers_async_thunk (void)
static void static void
queue_finalizer_async (void) queue_finalizer_async (void)
{ {
scm_i_thread *t = SCM_I_CURRENT_THREAD; scm_thread *t = SCM_I_CURRENT_THREAD;
/* Could be that the current thread is is NULL when we're allocating /* Could be that the current thread is is NULL when we're allocating
in threads.c:guilify_self_1. In that case, rely on the in threads.c:guilify_self_1. In that case, rely on the

View file

@ -37,6 +37,7 @@
#include "pairs.h" #include "pairs.h"
#include "ports.h" #include "ports.h"
#include "print.h" #include "print.h"
#include "threads.h"
#include "variable.h" #include "variable.h"
#include "weak-table.h" #include "weak-table.h"
@ -508,7 +509,7 @@ scm_c_with_fluids (SCM fluids, SCM values, SCM (*cproc) (), void *cdata)
{ {
SCM ans; SCM ans;
long flen, vlen, i; long flen, vlen, i;
scm_i_thread *thread = SCM_I_CURRENT_THREAD; scm_thread *thread = SCM_I_CURRENT_THREAD;
SCM_VALIDATE_LIST_COPYLEN (1, fluids, flen); SCM_VALIDATE_LIST_COPYLEN (1, fluids, flen);
SCM_VALIDATE_LIST_COPYLEN (2, values, vlen); SCM_VALIDATE_LIST_COPYLEN (2, values, vlen);
@ -545,7 +546,7 @@ scm_c_with_fluid (SCM fluid, SCM value, SCM (*cproc) (), void *cdata)
#define FUNC_NAME "scm_c_with_fluid" #define FUNC_NAME "scm_c_with_fluid"
{ {
SCM ans; SCM ans;
scm_i_thread *thread = SCM_I_CURRENT_THREAD; scm_thread *thread = SCM_I_CURRENT_THREAD;
scm_dynstack_push_fluid (&thread->dynstack, fluid, value, scm_dynstack_push_fluid (&thread->dynstack, fluid, value,
thread->dynamic_state); thread->dynamic_state);
@ -616,7 +617,7 @@ SCM_DEFINE (scm_set_current_dynamic_state, "set-current-dynamic-state", 1,0,0,
"and return the previous current dynamic state object.") "and return the previous current dynamic state object.")
#define FUNC_NAME s_scm_set_current_dynamic_state #define FUNC_NAME s_scm_set_current_dynamic_state
{ {
scm_i_thread *t = SCM_I_CURRENT_THREAD; scm_thread *t = SCM_I_CURRENT_THREAD;
SCM old = scm_current_dynamic_state (); SCM old = scm_current_dynamic_state ();
SCM_ASSERT (is_dynamic_state (state), state, SCM_ARG1, FUNC_NAME); SCM_ASSERT (is_dynamic_state (state), state, SCM_ARG1, FUNC_NAME);
restore_dynamic_state (get_dynamic_state (state), t->dynamic_state); restore_dynamic_state (get_dynamic_state (state), t->dynamic_state);

View file

@ -99,7 +99,7 @@ scm_inline_gc_alloc (void **freelist, size_t idx, scm_inline_gc_kind kind)
} }
static inline void * static inline void *
scm_inline_gc_malloc_pointerless (scm_i_thread *thread, size_t bytes) scm_inline_gc_malloc_pointerless (scm_thread *thread, size_t bytes)
{ {
size_t idx = scm_inline_gc_bytes_to_freelist_index (bytes); size_t idx = scm_inline_gc_bytes_to_freelist_index (bytes);
@ -111,7 +111,7 @@ scm_inline_gc_malloc_pointerless (scm_i_thread *thread, size_t bytes)
} }
static inline void * static inline void *
scm_inline_gc_malloc (scm_i_thread *thread, size_t bytes) scm_inline_gc_malloc (scm_thread *thread, size_t bytes)
{ {
size_t idx = scm_inline_gc_bytes_to_freelist_index (bytes); size_t idx = scm_inline_gc_bytes_to_freelist_index (bytes);
@ -123,13 +123,13 @@ scm_inline_gc_malloc (scm_i_thread *thread, size_t bytes)
} }
static inline void * static inline void *
scm_inline_gc_malloc_words (scm_i_thread *thread, size_t words) scm_inline_gc_malloc_words (scm_thread *thread, size_t words)
{ {
return scm_inline_gc_malloc (thread, words * sizeof (void *)); return scm_inline_gc_malloc (thread, words * sizeof (void *));
} }
static inline SCM static inline SCM
scm_inline_cell (scm_i_thread *thread, scm_t_bits car, scm_t_bits cdr) scm_inline_cell (scm_thread *thread, scm_t_bits car, scm_t_bits cdr)
{ {
SCM cell = SCM_PACK_POINTER (scm_inline_gc_malloc_words (thread, 2)); SCM cell = SCM_PACK_POINTER (scm_inline_gc_malloc_words (thread, 2));
@ -140,7 +140,7 @@ scm_inline_cell (scm_i_thread *thread, scm_t_bits car, scm_t_bits cdr)
} }
static inline SCM static inline SCM
scm_inline_double_cell (scm_i_thread *thread, scm_t_bits car, scm_t_bits cbr, scm_inline_double_cell (scm_thread *thread, scm_t_bits car, scm_t_bits cbr,
scm_t_bits ccr, scm_t_bits cdr) scm_t_bits ccr, scm_t_bits cdr)
{ {
SCM cell = SCM_PACK_POINTER (scm_inline_gc_malloc_words (thread, 4)); SCM cell = SCM_PACK_POINTER (scm_inline_gc_malloc_words (thread, 4));
@ -154,7 +154,7 @@ scm_inline_double_cell (scm_i_thread *thread, scm_t_bits car, scm_t_bits cbr,
} }
static inline SCM static inline SCM
scm_inline_words (scm_i_thread *thread, scm_t_bits car, uint32_t n_words) scm_inline_words (scm_thread *thread, scm_t_bits car, uint32_t n_words)
{ {
SCM obj = SCM_PACK_POINTER (scm_inline_gc_malloc_words (thread, n_words)); SCM obj = SCM_PACK_POINTER (scm_inline_gc_malloc_words (thread, n_words));
@ -164,7 +164,7 @@ scm_inline_words (scm_i_thread *thread, scm_t_bits car, uint32_t n_words)
} }
static inline SCM static inline SCM
scm_inline_cons (scm_i_thread *thread, SCM x, SCM y) scm_inline_cons (scm_thread *thread, SCM x, SCM y)
{ {
return scm_inline_cell (thread, SCM_UNPACK (x), SCM_UNPACK (y)); return scm_inline_cell (thread, SCM_UNPACK (x), SCM_UNPACK (y));
} }

View file

@ -543,7 +543,7 @@ queue_after_gc_hook (void * hook_data SCM_UNUSED,
void *fn_data SCM_UNUSED, void *fn_data SCM_UNUSED,
void *data SCM_UNUSED) void *data SCM_UNUSED)
{ {
scm_i_thread *t = SCM_I_CURRENT_THREAD; scm_thread *t = SCM_I_CURRENT_THREAD;
if (scm_is_false (SCM_CDR (after_gc_async_cell))) if (scm_is_false (SCM_CDR (after_gc_async_cell)))
{ {

View file

@ -32,6 +32,7 @@
#include "modules.h" #include "modules.h"
#include "numbers.h" #include "numbers.h"
#include "symbols.h" #include "symbols.h"
#include "threads.h"
#include "intrinsics.h" #include "intrinsics.h"
@ -109,32 +110,32 @@ logsub (SCM x, SCM y)
} }
static void static void
wind (scm_i_thread *thread, SCM winder, SCM unwinder) wind (scm_thread *thread, SCM winder, SCM unwinder)
{ {
scm_dynstack_push_dynwind (&thread->dynstack, winder, unwinder); scm_dynstack_push_dynwind (&thread->dynstack, winder, unwinder);
} }
static void static void
unwind (scm_i_thread *thread) unwind (scm_thread *thread)
{ {
scm_dynstack_pop (&thread->dynstack); scm_dynstack_pop (&thread->dynstack);
} }
static void static void
push_fluid (scm_i_thread *thread, SCM fluid, SCM value) push_fluid (scm_thread *thread, SCM fluid, SCM value)
{ {
scm_dynstack_push_fluid (&thread->dynstack, fluid, value, scm_dynstack_push_fluid (&thread->dynstack, fluid, value,
thread->dynamic_state); thread->dynamic_state);
} }
static void static void
pop_fluid (scm_i_thread *thread) pop_fluid (scm_thread *thread)
{ {
scm_dynstack_unwind_fluid (&thread->dynstack, thread->dynamic_state); scm_dynstack_unwind_fluid (&thread->dynstack, thread->dynamic_state);
} }
static SCM static SCM
fluid_ref (scm_i_thread *thread, SCM fluid) fluid_ref (scm_thread *thread, SCM fluid)
{ {
struct scm_cache_entry *entry; struct scm_cache_entry *entry;
@ -148,7 +149,7 @@ fluid_ref (scm_i_thread *thread, SCM fluid)
} }
static void static void
fluid_set_x (scm_i_thread *thread, SCM fluid, SCM value) fluid_set_x (scm_thread *thread, SCM fluid, SCM value)
{ {
struct scm_cache_entry *entry; struct scm_cache_entry *entry;
@ -161,14 +162,14 @@ fluid_set_x (scm_i_thread *thread, SCM fluid, SCM value)
} }
static void static void
push_dynamic_state (scm_i_thread *thread, SCM state) push_dynamic_state (scm_thread *thread, SCM state)
{ {
scm_dynstack_push_dynamic_state (&thread->dynstack, state, scm_dynstack_push_dynamic_state (&thread->dynstack, state,
thread->dynamic_state); thread->dynamic_state);
} }
static void static void
pop_dynamic_state (scm_i_thread *thread) pop_dynamic_state (scm_thread *thread)
{ {
scm_dynstack_unwind_dynamic_state (&thread->dynstack, scm_dynstack_unwind_dynamic_state (&thread->dynstack,
thread->dynamic_state); thread->dynamic_state);

View file

@ -25,7 +25,6 @@
#endif #endif
#include <libguile/scm.h> #include <libguile/scm.h>
#include <libguile/threads.h>
typedef SCM (*scm_t_scm_from_scm_scm_intrinsic) (SCM, SCM); typedef SCM (*scm_t_scm_from_scm_scm_intrinsic) (SCM, SCM);
@ -37,22 +36,22 @@ typedef uint64_t (*scm_t_u64_from_scm_intrinsic) (SCM);
typedef int64_t (*scm_t_s64_from_scm_intrinsic) (SCM); typedef int64_t (*scm_t_s64_from_scm_intrinsic) (SCM);
typedef SCM (*scm_t_scm_from_u64_intrinsic) (uint64_t); typedef SCM (*scm_t_scm_from_u64_intrinsic) (uint64_t);
typedef SCM (*scm_t_scm_from_s64_intrinsic) (int64_t); typedef SCM (*scm_t_scm_from_s64_intrinsic) (int64_t);
typedef void (*scm_t_thread_intrinsic) (scm_i_thread*); typedef void (*scm_t_thread_intrinsic) (scm_thread*);
typedef void (*scm_t_thread_scm_intrinsic) (scm_i_thread*, SCM); typedef void (*scm_t_thread_scm_intrinsic) (scm_thread*, SCM);
typedef void (*scm_t_thread_scm_scm_intrinsic) (scm_i_thread*, SCM, SCM); typedef void (*scm_t_thread_scm_scm_intrinsic) (scm_thread*, SCM, SCM);
typedef SCM (*scm_t_scm_from_thread_scm_intrinsic) (scm_i_thread*, SCM); typedef SCM (*scm_t_scm_from_thread_scm_intrinsic) (scm_thread*, SCM);
typedef SCM (*scm_t_scm_from_scm_u64_intrinsic) (SCM, uint64_t); typedef SCM (*scm_t_scm_from_scm_u64_intrinsic) (SCM, uint64_t);
typedef int (*scm_t_bool_from_scm_scm_intrinsic) (SCM, SCM); typedef int (*scm_t_bool_from_scm_scm_intrinsic) (SCM, SCM);
typedef enum scm_compare (*scm_t_compare_from_scm_scm_intrinsic) (SCM, SCM); typedef enum scm_compare (*scm_t_compare_from_scm_scm_intrinsic) (SCM, SCM);
typedef void (*scm_t_thread_sp_intrinsic) (scm_i_thread*, union scm_vm_stack_element*); typedef void (*scm_t_thread_sp_intrinsic) (scm_thread*, union scm_vm_stack_element*);
typedef SCM (*scm_t_scm_from_thread_u32_intrinsic) (scm_i_thread*, uint32_t); typedef SCM (*scm_t_scm_from_thread_u32_intrinsic) (scm_thread*, uint32_t);
typedef uint32_t (*scm_t_u32_from_thread_u32_u32_intrinsic) (scm_i_thread*, uint32_t, uint32_t); typedef uint32_t (*scm_t_u32_from_thread_u32_u32_intrinsic) (scm_thread*, uint32_t, uint32_t);
typedef void (*scm_t_thread_u32_u32_scm_u8_u8_intrinsic) (scm_i_thread*, uint32_t, typedef void (*scm_t_thread_u32_u32_scm_u8_u8_intrinsic) (scm_thread*, uint32_t,
uint32_t, SCM, uint8_t, uint32_t, SCM, uint8_t,
uint8_t); uint8_t);
typedef SCM (*scm_t_scm_from_scm_scm_scmp_sp_intrinsic) (SCM, SCM, SCM*, typedef SCM (*scm_t_scm_from_scm_scm_scmp_sp_intrinsic) (SCM, SCM, SCM*,
const union scm_vm_stack_element*); const union scm_vm_stack_element*);
typedef void (*scm_t_thread_scm_noreturn_intrinsic) (scm_i_thread*, SCM) SCM_NORETURN; typedef void (*scm_t_thread_scm_noreturn_intrinsic) (scm_thread*, SCM) SCM_NORETURN;
#define SCM_FOR_ALL_VM_INTRINSICS(M) \ #define SCM_FOR_ALL_VM_INTRINSICS(M) \
M(scm_from_scm_scm, add, "add", ADD) \ M(scm_from_scm_scm, add, "add", ADD) \

View file

@ -52,6 +52,7 @@
#include "loader.h" #include "loader.h"
#include "modules.h" #include "modules.h"
#include "pairs.h" #include "pairs.h"
#include "procs.h"
#include "read.h" #include "read.h"
#include "srfi-13.h" #include "srfi-13.h"
#include "strings.h" #include "strings.h"

View file

@ -98,7 +98,7 @@ do_unwind (void)
static SCM static SCM
do_push_fluid (SCM fluid, SCM val) do_push_fluid (SCM fluid, SCM val)
{ {
scm_i_thread *thread = SCM_I_CURRENT_THREAD; scm_thread *thread = SCM_I_CURRENT_THREAD;
scm_dynstack_push_fluid (&thread->dynstack, fluid, val, scm_dynstack_push_fluid (&thread->dynstack, fluid, val,
thread->dynamic_state); thread->dynamic_state);
return SCM_UNSPECIFIED; return SCM_UNSPECIFIED;
@ -107,7 +107,7 @@ do_push_fluid (SCM fluid, SCM val)
static SCM static SCM
do_pop_fluid (void) do_pop_fluid (void)
{ {
scm_i_thread *thread = SCM_I_CURRENT_THREAD; scm_thread *thread = SCM_I_CURRENT_THREAD;
scm_dynstack_unwind_fluid (&thread->dynstack, thread->dynamic_state); scm_dynstack_unwind_fluid (&thread->dynstack, thread->dynamic_state);
return SCM_UNSPECIFIED; return SCM_UNSPECIFIED;
} }
@ -115,7 +115,7 @@ do_pop_fluid (void)
static SCM static SCM
do_push_dynamic_state (SCM state) do_push_dynamic_state (SCM state)
{ {
scm_i_thread *thread = SCM_I_CURRENT_THREAD; scm_thread *thread = SCM_I_CURRENT_THREAD;
scm_dynstack_push_dynamic_state (&thread->dynstack, state, scm_dynstack_push_dynamic_state (&thread->dynstack, state,
thread->dynamic_state); thread->dynamic_state);
return SCM_UNSPECIFIED; return SCM_UNSPECIFIED;
@ -124,7 +124,7 @@ do_push_dynamic_state (SCM state)
static SCM static SCM
do_pop_dynamic_state (void) do_pop_dynamic_state (void)
{ {
scm_i_thread *thread = SCM_I_CURRENT_THREAD; scm_thread *thread = SCM_I_CURRENT_THREAD;
scm_dynstack_unwind_dynamic_state (&thread->dynstack, scm_dynstack_unwind_dynamic_state (&thread->dynstack,
thread->dynamic_state); thread->dynamic_state);
return SCM_UNSPECIFIED; return SCM_UNSPECIFIED;

View file

@ -61,6 +61,7 @@
#include "struct.h" #include "struct.h"
#include "symbols.h" #include "symbols.h"
#include "syntax.h" #include "syntax.h"
#include "threads.h"
#include "values.h" #include "values.h"
#include "variable.h" #include "variable.h"
#include "vectors.h" #include "vectors.h"

View file

@ -53,6 +53,7 @@
#include "ports-internal.h" #include "ports-internal.h"
#include "ports.h" #include "ports.h"
#include "private-options.h" #include "private-options.h"
#include "procs.h"
#include "srcprop.h" #include "srcprop.h"
#include "srfi-13.h" #include "srfi-13.h"
#include "srfi-4.h" #include "srfi-4.h"

View file

@ -827,7 +827,7 @@ typedef int32_t scm_t_wchar;
struct scm_frame; struct scm_frame;
struct scm_vm; struct scm_vm;
union scm_vm_stack_element; union scm_vm_stack_element;
typedef struct scm_i_thread scm_i_thread; /* FIXME: Rename. */ typedef struct scm_thread scm_thread;

View file

@ -100,7 +100,7 @@ static SCM signal_handler_asyncs;
static SCM signal_handler_threads; static SCM signal_handler_threads;
/* The signal delivery thread. */ /* The signal delivery thread. */
scm_i_thread *scm_i_signal_delivery_thread = NULL; scm_thread *scm_i_signal_delivery_thread = NULL;
/* The mutex held when launching the signal delivery thread. */ /* The mutex held when launching the signal delivery thread. */
static scm_i_pthread_mutex_t signal_delivery_thread_mutex = static scm_i_pthread_mutex_t signal_delivery_thread_mutex =
@ -233,7 +233,7 @@ static SIGRETTYPE
take_signal (int signum) take_signal (int signum)
{ {
SCM cell = SCM_SIMPLE_VECTOR_REF (signal_handler_asyncs, signum); SCM cell = SCM_SIMPLE_VECTOR_REF (signal_handler_asyncs, signum);
scm_i_thread *t = SCM_I_CURRENT_THREAD; scm_thread *t = SCM_I_CURRENT_THREAD;
if (scm_is_false (SCM_CDR (cell))) if (scm_is_false (SCM_CDR (cell)))
{ {

View file

@ -22,7 +22,7 @@
#include "libguile/threads.h" #include "libguile/scm.h"
@ -44,6 +44,6 @@ SCM_INTERNAL void scm_init_scmsigs (void);
SCM_INTERNAL void scm_i_close_signal_pipe (void); SCM_INTERNAL void scm_i_close_signal_pipe (void);
SCM_INTERNAL void scm_i_ensure_signal_delivery_thread (void); SCM_INTERNAL void scm_i_ensure_signal_delivery_thread (void);
SCM_INTERNAL scm_i_thread *scm_i_signal_delivery_thread; SCM_INTERNAL scm_thread *scm_i_signal_delivery_thread;
#endif /* SCM_SCMSIGS_H */ #endif /* SCM_SCMSIGS_H */

View file

@ -46,6 +46,7 @@
#include "read.h" #include "read.h"
#include "strings.h" #include "strings.h"
#include "strports.h" #include "strports.h"
#include "throw.h"
#include "version.h" #include "version.h"
#include "vm.h" #include "vm.h"

View file

@ -57,7 +57,7 @@ scm_stack_report ()
{ {
SCM port = scm_current_error_port (); SCM port = scm_current_error_port ();
SCM_STACKITEM stack; SCM_STACKITEM stack;
scm_i_thread *thread = SCM_I_CURRENT_THREAD; scm_thread *thread = SCM_I_CURRENT_THREAD;
scm_uintprint ((scm_stack_size (thread->continuation_base) scm_uintprint ((scm_stack_size (thread->continuation_base)
* sizeof (SCM_STACKITEM)), * sizeof (SCM_STACKITEM)),

View file

@ -42,6 +42,7 @@
#include "strings.h" #include "strings.h"
#include "struct.h" #include "struct.h"
#include "symbols.h" #include "symbols.h"
#include "threads.h"
#include "vm.h" /* to capture vm stacks */ #include "vm.h" /* to capture vm stacks */
#include "stacks.h" #include "stacks.h"

View file

@ -43,6 +43,7 @@
#include "srfi-13.h" #include "srfi-13.h"
#include "strings.h" #include "strings.h"
#include "strorder.h" #include "strorder.h"
#include "threads.h"
#include "variable.h" #include "variable.h"
#include "vectors.h" #include "vectors.h"
#include "weak-set.h" #include "weak-set.h"

View file

@ -80,7 +80,7 @@ thread_mark (GC_word *addr, struct GC_ms_entry *mark_stack_ptr,
struct GC_ms_entry *mark_stack_limit, GC_word env) struct GC_ms_entry *mark_stack_limit, GC_word env)
{ {
int word; int word;
struct scm_i_thread *t = (struct scm_i_thread *) addr; struct scm_thread *t = (struct scm_thread *) addr;
if (SCM_UNPACK (t->handle) == 0) if (SCM_UNPACK (t->handle) == 0)
/* T must be on the free-list; ignore. (See warning in /* T must be on the free-list; ignore. (See warning in
@ -251,7 +251,7 @@ thread_print (SCM exp, SCM port, scm_print_state *pstate SCM_UNUSED)
unsigned long ul; unsigned long ul;
uintmax_t um; uintmax_t um;
} u; } u;
scm_i_thread *t = SCM_I_THREAD_DATA (exp); scm_thread *t = SCM_I_THREAD_DATA (exp);
scm_i_pthread_t p = t->pthread; scm_i_pthread_t p = t->pthread;
uintmax_t id; uintmax_t id;
u.p = p; u.p = p;
@ -301,7 +301,7 @@ static int
block_self (SCM queue, scm_i_pthread_mutex_t *mutex, block_self (SCM queue, scm_i_pthread_mutex_t *mutex,
const scm_t_timespec *waittime) const scm_t_timespec *waittime)
{ {
scm_i_thread *t = SCM_I_CURRENT_THREAD; scm_thread *t = SCM_I_CURRENT_THREAD;
SCM q_handle; SCM q_handle;
int err; int err;
@ -356,13 +356,13 @@ scm_i_pthread_key_t scm_i_thread_key;
itself in TLS (rather than a pointer to some malloc'd memory) is not itself in TLS (rather than a pointer to some malloc'd memory) is not
possible since thread objects may live longer than the actual thread they possible since thread objects may live longer than the actual thread they
represent. */ represent. */
SCM_THREAD_LOCAL scm_i_thread *scm_i_current_thread = NULL; SCM_THREAD_LOCAL scm_thread *scm_i_current_thread = NULL;
#endif /* SCM_HAVE_THREAD_STORAGE_CLASS */ #endif /* SCM_HAVE_THREAD_STORAGE_CLASS */
static scm_i_pthread_mutex_t thread_admin_mutex = SCM_I_PTHREAD_MUTEX_INITIALIZER; static scm_i_pthread_mutex_t thread_admin_mutex = SCM_I_PTHREAD_MUTEX_INITIALIZER;
static scm_i_thread *all_threads = NULL; static scm_thread *all_threads = NULL;
static int thread_count; static int thread_count;
static SCM default_dynamic_state; static SCM default_dynamic_state;
@ -372,7 +372,7 @@ static SCM default_dynamic_state;
static void static void
guilify_self_1 (struct GC_stack_base *base, int needs_unregister) guilify_self_1 (struct GC_stack_base *base, int needs_unregister)
{ {
scm_i_thread t; scm_thread t;
/* We must arrange for SCM_I_CURRENT_THREAD to point to a valid value /* We must arrange for SCM_I_CURRENT_THREAD to point to a valid value
before allocating anything in this thread, because allocation could before allocating anything in this thread, because allocation could
@ -404,7 +404,7 @@ guilify_self_1 (struct GC_stack_base *base, int needs_unregister)
/* The switcheroo. */ /* The switcheroo. */
{ {
scm_i_thread *t_ptr = &t; scm_thread *t_ptr = &t;
GC_disable (); GC_disable ();
t_ptr = GC_generic_malloc (sizeof (*t_ptr), thread_gc_kind); t_ptr = GC_generic_malloc (sizeof (*t_ptr), thread_gc_kind);
@ -432,7 +432,7 @@ guilify_self_1 (struct GC_stack_base *base, int needs_unregister)
static void static void
guilify_self_2 (SCM dynamic_state) guilify_self_2 (SCM dynamic_state)
{ {
scm_i_thread *t = SCM_I_CURRENT_THREAD; scm_thread *t = SCM_I_CURRENT_THREAD;
t->guile_mode = 1; t->guile_mode = 1;
@ -470,7 +470,7 @@ on_thread_exit (void *v)
/* This handler is executed in non-guile mode. Note that although /* This handler is executed in non-guile mode. Note that although
libgc isn't guaranteed to see thread-locals, for this thread-local libgc isn't guaranteed to see thread-locals, for this thread-local
that isn't an issue as we have the all_threads list. */ that isn't an issue as we have the all_threads list. */
scm_i_thread *t = (scm_i_thread *) v, **tp; scm_thread *t = (scm_thread *) v, **tp;
t->exited = 1; t->exited = 1;
@ -636,7 +636,7 @@ with_guile (struct GC_stack_base *base, void *data)
{ {
void *res; void *res;
int new_thread; int new_thread;
scm_i_thread *t; scm_thread *t;
struct with_guile_args *args = data; struct with_guile_args *args = data;
new_thread = scm_i_init_thread_for_guile (base, args->dynamic_state); new_thread = scm_i_init_thread_for_guile (base, args->dynamic_state);
@ -702,7 +702,7 @@ void *
scm_without_guile (void *(*func)(void *), void *data) scm_without_guile (void *(*func)(void *), void *data)
{ {
void *result; void *result;
scm_i_thread *t = SCM_I_CURRENT_THREAD; scm_thread *t = SCM_I_CURRENT_THREAD;
if (t->guile_mode) if (t->guile_mode)
{ {
@ -775,7 +775,7 @@ unprotect_launch_data (launch_data *data)
static void * static void *
really_launch (void *d) really_launch (void *d)
{ {
scm_i_thread *t = SCM_I_CURRENT_THREAD; scm_thread *t = SCM_I_CURRENT_THREAD;
unprotect_launch_data (d); unprotect_launch_data (d);
/* The thread starts with asyncs blocked. */ /* The thread starts with asyncs blocked. */
t->block_asyncs++; t->block_asyncs++;
@ -995,7 +995,7 @@ scm_lock_mutex (SCM mx)
static inline SCM static inline SCM
lock_mutex (enum scm_mutex_kind kind, struct scm_mutex *m, lock_mutex (enum scm_mutex_kind kind, struct scm_mutex *m,
scm_i_thread *current_thread, scm_t_timespec *waittime) scm_thread *current_thread, scm_t_timespec *waittime)
#define FUNC_NAME "lock-mutex" #define FUNC_NAME "lock-mutex"
{ {
scm_i_scm_pthread_mutex_lock (&m->lock); scm_i_scm_pthread_mutex_lock (&m->lock);
@ -1066,7 +1066,7 @@ SCM_DEFINE (scm_timed_lock_mutex, "lock-mutex", 1, 1, 0,
{ {
scm_t_timespec cwaittime, *waittime = NULL; scm_t_timespec cwaittime, *waittime = NULL;
struct scm_mutex *m; struct scm_mutex *m;
scm_i_thread *t = SCM_I_CURRENT_THREAD; scm_thread *t = SCM_I_CURRENT_THREAD;
SCM ret; SCM ret;
SCM_VALIDATE_MUTEX (1, mutex); SCM_VALIDATE_MUTEX (1, mutex);
@ -1132,7 +1132,7 @@ scm_try_mutex (SCM mutex)
against the mutex kind. */ against the mutex kind. */
static inline void static inline void
unlock_mutex (enum scm_mutex_kind kind, struct scm_mutex *m, unlock_mutex (enum scm_mutex_kind kind, struct scm_mutex *m,
scm_i_thread *current_thread) scm_thread *current_thread)
#define FUNC_NAME "unlock-mutex" #define FUNC_NAME "unlock-mutex"
{ {
scm_i_scm_pthread_mutex_lock (&m->lock); scm_i_scm_pthread_mutex_lock (&m->lock);
@ -1173,7 +1173,7 @@ SCM_DEFINE (scm_unlock_mutex, "unlock-mutex", 1, 0, 0, (SCM mutex),
#define FUNC_NAME s_scm_unlock_mutex #define FUNC_NAME s_scm_unlock_mutex
{ {
struct scm_mutex *m; struct scm_mutex *m;
scm_i_thread *t = SCM_I_CURRENT_THREAD; scm_thread *t = SCM_I_CURRENT_THREAD;
SCM_VALIDATE_MUTEX (1, mutex); SCM_VALIDATE_MUTEX (1, mutex);
@ -1296,7 +1296,7 @@ SCM_DEFINE (scm_make_condition_variable, "make-condition-variable", 0, 0, 0,
static inline SCM static inline SCM
timed_wait (enum scm_mutex_kind kind, struct scm_mutex *m, struct scm_cond *c, timed_wait (enum scm_mutex_kind kind, struct scm_mutex *m, struct scm_cond *c,
scm_i_thread *current_thread, scm_t_timespec *waittime) scm_thread *current_thread, scm_t_timespec *waittime)
#define FUNC_NAME "wait-condition-variable" #define FUNC_NAME "wait-condition-variable"
{ {
scm_i_scm_pthread_mutex_lock (&m->lock); scm_i_scm_pthread_mutex_lock (&m->lock);
@ -1405,7 +1405,7 @@ SCM_DEFINE (scm_timed_wait_condition_variable, "wait-condition-variable", 2, 1,
scm_t_timespec waittime_val, *waittime = NULL; scm_t_timespec waittime_val, *waittime = NULL;
struct scm_cond *c; struct scm_cond *c;
struct scm_mutex *m; struct scm_mutex *m;
scm_i_thread *t = SCM_I_CURRENT_THREAD; scm_thread *t = SCM_I_CURRENT_THREAD;
SCM ret; SCM ret;
SCM_VALIDATE_CONDVAR (1, cond); SCM_VALIDATE_CONDVAR (1, cond);
@ -1520,7 +1520,7 @@ scm_std_select (int nfds,
{ {
fd_set my_readfds; fd_set my_readfds;
int res, eno, wakeup_fd; int res, eno, wakeup_fd;
scm_i_thread *t = SCM_I_CURRENT_THREAD; scm_thread *t = SCM_I_CURRENT_THREAD;
struct select_args args; struct select_args args;
if (readfds == NULL) if (readfds == NULL)
@ -1684,7 +1684,7 @@ SCM_DEFINE (scm_all_threads, "all-threads", 0, 0, 0,
of the way GC is done. of the way GC is done.
*/ */
int n = thread_count; int n = thread_count;
scm_i_thread *t; scm_thread *t;
SCM list = scm_c_make_list (n, SCM_UNSPECIFIED), *l; SCM list = scm_c_make_list (n, SCM_UNSPECIFIED), *l;
scm_i_pthread_mutex_lock (&thread_admin_mutex); scm_i_pthread_mutex_lock (&thread_admin_mutex);
@ -1717,7 +1717,7 @@ int
scm_c_thread_exited_p (SCM thread) scm_c_thread_exited_p (SCM thread)
#define FUNC_NAME s_scm_thread_exited_p #define FUNC_NAME s_scm_thread_exited_p
{ {
scm_i_thread *t; scm_thread *t;
SCM_VALIDATE_THREAD (1, thread); SCM_VALIDATE_THREAD (1, thread);
t = SCM_I_THREAD_DATA (thread); t = SCM_I_THREAD_DATA (thread);
return t->exited; return t->exited;
@ -1812,7 +1812,7 @@ scm_init_ice_9_threads (void *unused)
void void
scm_init_threads () scm_init_threads ()
{ {
scm_tc16_thread = scm_make_smob_type ("thread", sizeof (scm_i_thread)); scm_tc16_thread = scm_make_smob_type ("thread", sizeof (scm_thread));
scm_set_smob_print (scm_tc16_thread, thread_print); scm_set_smob_print (scm_tc16_thread, thread_print);
scm_tc16_mutex = scm_make_smob_type ("mutex", sizeof (struct scm_mutex)); scm_tc16_mutex = scm_make_smob_type ("mutex", sizeof (struct scm_mutex));

View file

@ -48,8 +48,8 @@ SCM_API scm_t_bits scm_tc16_condvar;
struct scm_thread_wake_data; struct scm_thread_wake_data;
struct scm_i_thread { struct scm_thread {
struct scm_i_thread *next_thread; struct scm_thread *next_thread;
SCM handle; SCM handle;
scm_i_pthread_t pthread; scm_i_pthread_t pthread;
@ -108,7 +108,7 @@ struct scm_i_thread {
}; };
#define SCM_I_IS_THREAD(x) SCM_SMOB_PREDICATE (scm_tc16_thread, x) #define SCM_I_IS_THREAD(x) SCM_SMOB_PREDICATE (scm_tc16_thread, x)
#define SCM_I_THREAD_DATA(x) ((scm_i_thread *) SCM_SMOB_DATA (x)) #define SCM_I_THREAD_DATA(x) ((scm_thread *) SCM_SMOB_DATA (x))
#define SCM_VALIDATE_THREAD(pos, a) \ #define SCM_VALIDATE_THREAD(pos, a) \
scm_assert_smob_type (scm_tc16_thread, (a)) scm_assert_smob_type (scm_tc16_thread, (a))
@ -171,13 +171,13 @@ SCM_INTERNAL scm_i_pthread_key_t scm_i_thread_key;
# ifdef SCM_HAVE_THREAD_STORAGE_CLASS # ifdef SCM_HAVE_THREAD_STORAGE_CLASS
SCM_INTERNAL SCM_THREAD_LOCAL scm_i_thread *scm_i_current_thread; SCM_INTERNAL SCM_THREAD_LOCAL scm_thread *scm_i_current_thread;
# define SCM_I_CURRENT_THREAD (scm_i_current_thread) # define SCM_I_CURRENT_THREAD (scm_i_current_thread)
# else /* !SCM_HAVE_THREAD_STORAGE_CLASS */ # else /* !SCM_HAVE_THREAD_STORAGE_CLASS */
# define SCM_I_CURRENT_THREAD \ # define SCM_I_CURRENT_THREAD \
((scm_i_thread *) scm_i_pthread_getspecific (scm_i_thread_key)) ((scm_thread *) scm_i_pthread_getspecific (scm_i_thread_key))
# endif /* !SCM_HAVE_THREAD_STORAGE_CLASS */ # endif /* !SCM_HAVE_THREAD_STORAGE_CLASS */

View file

@ -82,7 +82,7 @@ catch (SCM tag, SCM thunk, SCM handler, SCM pre_unwind_handler)
{ {
SCM eh, prompt_tag; SCM eh, prompt_tag;
SCM res; SCM res;
scm_i_thread *t = SCM_I_CURRENT_THREAD; scm_thread *t = SCM_I_CURRENT_THREAD;
scm_t_dynstack *dynstack = &t->dynstack; scm_t_dynstack *dynstack = &t->dynstack;
scm_t_dynamic_state *dynamic_state = t->dynamic_state; scm_t_dynamic_state *dynamic_state = t->dynamic_state;
jmp_buf registers; jmp_buf registers;

View file

@ -270,7 +270,7 @@
((uintptr_t) (ptr) % alignof_type (type) == 0) ((uintptr_t) (ptr) % alignof_type (type) == 0)
static SCM static SCM
VM_NAME (scm_i_thread *thread, jmp_buf *registers, int resume) VM_NAME (scm_thread *thread, jmp_buf *registers, int resume)
{ {
/* Instruction pointer: A pointer to the opcode that is currently /* Instruction pointer: A pointer to the opcode that is currently
running. */ running. */

View file

@ -185,7 +185,7 @@ scm_i_vm_capture_stack (union scm_vm_stack_element *stack_top,
SCM SCM
scm_i_capture_current_stack (void) scm_i_capture_current_stack (void)
{ {
scm_i_thread *thread; scm_thread *thread;
struct scm_vm *vp; struct scm_vm *vp;
thread = SCM_I_CURRENT_THREAD; thread = SCM_I_CURRENT_THREAD;
@ -661,7 +661,7 @@ scm_i_call_with_current_continuation (SCM proc)
#undef VM_USE_HOOKS #undef VM_USE_HOOKS
#undef VM_NAME #undef VM_NAME
typedef SCM (*scm_t_vm_engine) (scm_i_thread *current_thread, typedef SCM (*scm_t_vm_engine) (scm_thread *current_thread,
jmp_buf *registers, int resume); jmp_buf *registers, int resume);
static const scm_t_vm_engine vm_engines[SCM_VM_NUM_ENGINES] = static const scm_t_vm_engine vm_engines[SCM_VM_NUM_ENGINES] =
@ -1076,13 +1076,13 @@ vm_expand_stack (struct scm_vm *vp, union scm_vm_stack_element *new_sp)
} }
static uint32_t static uint32_t
frame_locals_count (scm_i_thread *thread) frame_locals_count (scm_thread *thread)
{ {
return SCM_FRAME_NUM_LOCALS (thread->vm.fp, thread->vm.sp); return SCM_FRAME_NUM_LOCALS (thread->vm.fp, thread->vm.sp);
} }
static void static void
thread_expand_stack (scm_i_thread *thread, union scm_vm_stack_element *new_sp) thread_expand_stack (scm_thread *thread, union scm_vm_stack_element *new_sp)
{ {
vm_expand_stack (&thread->vm, new_sp); vm_expand_stack (&thread->vm, new_sp);
} }
@ -1091,7 +1091,7 @@ thread_expand_stack (scm_i_thread *thread, union scm_vm_stack_element *new_sp)
it seems to be necessary for perf; the inlined version avoids the it seems to be necessary for perf; the inlined version avoids the
needs to flush IP in the common case. */ needs to flush IP in the common case. */
static void static void
alloc_frame (scm_i_thread *thread, uint32_t nlocals) alloc_frame (scm_thread *thread, uint32_t nlocals)
{ {
union scm_vm_stack_element *sp = thread->vm.fp - nlocals; union scm_vm_stack_element *sp = thread->vm.fp - nlocals;
@ -1107,7 +1107,7 @@ alloc_frame (scm_i_thread *thread, uint32_t nlocals)
} }
static uint32_t static uint32_t
compute_kwargs_npositional (scm_i_thread *thread, uint32_t nreq, uint32_t nopt) compute_kwargs_npositional (scm_thread *thread, uint32_t nreq, uint32_t nopt)
{ {
uint32_t npositional, nargs; uint32_t npositional, nargs;
@ -1129,7 +1129,7 @@ compute_kwargs_npositional (scm_i_thread *thread, uint32_t nreq, uint32_t nopt)
} }
static void static void
bind_kwargs (scm_i_thread *thread, uint32_t npositional, uint32_t nlocals, bind_kwargs (scm_thread *thread, uint32_t npositional, uint32_t nlocals,
SCM kwargs, uint8_t strict, uint8_t allow_other_keys) SCM kwargs, uint8_t strict, uint8_t allow_other_keys)
{ {
uint32_t nargs, nkw, n; uint32_t nargs, nkw, n;
@ -1193,7 +1193,7 @@ bind_kwargs (scm_i_thread *thread, uint32_t npositional, uint32_t nlocals,
} }
static SCM static SCM
cons_rest (scm_i_thread *thread, uint32_t base) cons_rest (scm_thread *thread, uint32_t base)
{ {
SCM rest = SCM_EOL; SCM rest = SCM_EOL;
uint32_t n = frame_locals_count (thread) - base; uint32_t n = frame_locals_count (thread) - base;
@ -1206,7 +1206,7 @@ cons_rest (scm_i_thread *thread, uint32_t base)
} }
static void static void
push_interrupt_frame (scm_i_thread *thread) push_interrupt_frame (scm_thread *thread)
{ {
union scm_vm_stack_element *old_fp; union scm_vm_stack_element *old_fp;
size_t old_frame_size = frame_locals_count (thread); size_t old_frame_size = frame_locals_count (thread);
@ -1256,10 +1256,10 @@ vm_return_to_continuation_inner (void *data_ptr)
return NULL; return NULL;
} }
static void reinstate_continuation_x (scm_i_thread *thread, SCM cont) SCM_NORETURN; static void reinstate_continuation_x (scm_thread *thread, SCM cont) SCM_NORETURN;
static void static void
reinstate_continuation_x (scm_i_thread *thread, SCM cont) reinstate_continuation_x (scm_thread *thread, SCM cont)
{ {
scm_t_contregs *continuation = scm_i_contregs (cont); scm_t_contregs *continuation = scm_i_contregs (cont);
struct scm_vm *vp = &thread->vm; struct scm_vm *vp = &thread->vm;
@ -1301,7 +1301,7 @@ reinstate_continuation_x (scm_i_thread *thread, SCM cont)
SCM SCM
scm_call_n (SCM proc, SCM *argv, size_t nargs) scm_call_n (SCM proc, SCM *argv, size_t nargs)
{ {
scm_i_thread *thread; scm_thread *thread;
struct scm_vm *vp; struct scm_vm *vp;
union scm_vm_stack_element *return_fp, *call_fp; union scm_vm_stack_element *return_fp, *call_fp;
/* Since nargs can only describe the length of a valid argv array in /* Since nargs can only describe the length of a valid argv array in
@ -1371,7 +1371,7 @@ scm_call_n (SCM proc, SCM *argv, size_t nargs)
#define VM_DEFINE_HOOK(n) \ #define VM_DEFINE_HOOK(n) \
{ \ { \
scm_i_thread *t = SCM_I_CURRENT_THREAD; \ scm_thread *t = SCM_I_CURRENT_THREAD; \
if (scm_is_false (t->vm.hooks[n])) \ if (scm_is_false (t->vm.hooks[n])) \
t->vm.hooks[n] = scm_make_hook (SCM_I_MAKINUM (1)); \ t->vm.hooks[n] = scm_make_hook (SCM_I_MAKINUM (1)); \
return t->vm.hooks[n]; \ return t->vm.hooks[n]; \
@ -1550,7 +1550,7 @@ SCM_DEFINE (scm_call_with_stack_overflow_handler,
"@code{call-with-stack-overflow-handler} was called.") "@code{call-with-stack-overflow-handler} was called.")
#define FUNC_NAME s_scm_call_with_stack_overflow_handler #define FUNC_NAME s_scm_call_with_stack_overflow_handler
{ {
struct scm_i_thread *t = SCM_I_CURRENT_THREAD; struct scm_thread *t = SCM_I_CURRENT_THREAD;
ptrdiff_t c_limit, stack_size; ptrdiff_t c_limit, stack_size;
struct overflow_handler_data data; struct overflow_handler_data data;
SCM new_limit, ret; SCM new_limit, ret;