# define HOOK_ENTER_INTERPRETER(func) func ()
#endif
\f
+extern void initialize_processor_early (void);
static void start_scheme (void);
static void Enter_Interpreter (void);
const char * scheme_program_name;
const char * OS_Name;
const char * OS_Variant;
-struct obstack scratch_obstack;
-struct obstack ffi_obstack;
-void * initial_C_stack_pointer;
+__thread struct obstack scratch_obstack;
+__thread struct obstack ffi_obstack;
+static void * initial_C_stack_pointer;
static char * reload_saved_string;
static unsigned int reload_saved_string_length;
#ifdef __OS2__
OS2_initialize_early ();
#endif
- obstack_init (&scratch_obstack);
- obstack_init (&ffi_obstack);
- dstack_initialize ();
- transaction_initialize ();
+ initialize_processor_early ();
+
reload_saved_string = 0;
reload_saved_string_length = 0;
read_command_line_options (argc, argv);
termination_init_error ();
return (0);
}
+
+void
+initialize_processor_early (void)
+{
+ obstack_init (&scratch_obstack);
+ obstack_init (&ffi_obstack);
+ dstack_initialize ();
+ transaction_initialize ();
+}
\f
/* Boot Scheme */
#ifndef SCM_CRITSEC_H
#define SCM_CRITSEC_H 1
-extern const char * critical_section_name;
-extern bool critical_section_hook_p;
-extern void (*critical_section_hook) (const char *);
+extern __thread const char * critical_section_name;
+extern __thread bool critical_section_hook_p;
+extern __thread void (*critical_section_hook) (const char *);
#define DECLARE_CRITICAL_SECTION() \
- const char * critical_section_name = 0; \
- bool critical_section_hook_p; \
- void (*critical_section_hook) (const char *)
+ __thread const char * critical_section_name = 0; \
+ __thread bool critical_section_hook_p; \
+ __thread void (*critical_section_hook) (const char *)
#define ENTER_CRITICAL_SECTION(name) critical_section_name = (name)
#define RENAME_CRITICAL_SECTION(name) critical_section_name = (name)
initialize that space, and create an unwind protection frame that
invokes `protector' when the stack is unwound. */
-extern void * dstack_position;
+extern __thread void * dstack_position;
/* The current stack pointer. */
extern void dstack_set_position (void * position);
#endif
extern SCHEME_OBJECT * Free;
-extern SCHEME_OBJECT * Free_primitive;
-extern SCHEME_OBJECT * heap_alloc_limit;
-extern SCHEME_OBJECT * heap_start;
-extern SCHEME_OBJECT * heap_end;
+extern __thread SCHEME_OBJECT * Free_primitive;
+extern __thread SCHEME_OBJECT * heap_alloc_limit;
+extern __thread SCHEME_OBJECT * heap_start;
+extern __thread SCHEME_OBJECT * heap_end;
#ifdef ENABLE_SMP
extern SCHEME_OBJECT * p0_heap_start;
extern SCHEME_OBJECT * shared_heap_start;
#endif
extern SCHEME_OBJECT * stack_pointer;
-extern SCHEME_OBJECT * stack_guard;
-extern SCHEME_OBJECT * stack_start;
-extern SCHEME_OBJECT * stack_end;
+extern __thread SCHEME_OBJECT * stack_guard;
+extern __thread SCHEME_OBJECT * stack_start;
+extern __thread SCHEME_OBJECT * stack_end;
extern SCHEME_OBJECT * constant_alloc_next;
extern SCHEME_OBJECT * constant_start;
\f
/* Address of the most recent return code in the stack. This is
only meaningful while in compiled code. */
-extern SCHEME_OBJECT * last_return_code;
+extern __thread SCHEME_OBJECT * last_return_code;
extern SCHEME_OBJECT fixed_objects;
extern SCHEME_OBJECT ephemeron_array;
extern const char * term_halt_messages [];
extern const char * fixed_objects_names [];
-extern bool trapping;
+extern __thread bool trapping;
extern const char * scheme_program_name;
extern const char * OS_Name;
extern const char * OS_Variant;
-extern struct obstack scratch_obstack;
-extern struct obstack ffi_obstack;
+extern __thread struct obstack scratch_obstack;
+extern __thread struct obstack ffi_obstack;
extern SCHEME_OBJECT * memory_block_start;
extern SCHEME_OBJECT * memory_block_end;
typedef char fexcept_t;
#endif
\f
-static bool scheme_fenv_p = false;
-static fenv_t scheme_fenv;
+static __thread bool scheme_fenv_p = false;
+static __thread fenv_t scheme_fenv;
static void
cache_float_environment (void)
# define COMPILER_END_SUBPROBLEM() do {} while (false)
#endif
-extern SCHEME_OBJECT * history_register;
-extern unsigned long prev_restore_history_offset;
+extern __thread SCHEME_OBJECT * history_register;
+extern __thread unsigned long prev_restore_history_offset;
extern void reset_history (void);
extern SCHEME_OBJECT * make_dummy_history (void);
\f
/* The EVAL/APPLY yin/yang */
-interpreter_state_t interpreter_state = NULL_INTERPRETER_STATE;
+__thread interpreter_state_t interpreter_state = NULL_INTERPRETER_STATE;
void
bind_interpreter_state (interpreter_state_t s)
return (interpreter_throw_argument);
}
-long prim_apply_error_code;
+__thread long prim_apply_error_code;
\f
void
Interpret (int pop_return_p)
extern void abort_to_interpreter (int) NORETURN;
extern int abort_to_interpreter_argument (void);
-extern interpreter_state_t interpreter_state;
-extern long prim_apply_error_code;
+extern __thread interpreter_state_t interpreter_state;
+extern __thread long prim_apply_error_code;
extern void bind_interpreter_state (interpreter_state_t);
extern void unbind_interpreter_state (interpreter_state_t);
RESET_HISTORY ();
}
+extern void initialize_processor_early (void);
+
static void *
work (void *p)
{
trace (";%d Start.", self->id);
assert (self->id != 0);
assert (self != processors);
+ initialize_processor_early ();
reset_processor_allocator (self);
RESET_HISTORY ();
SCHEME_OBJECT * Free;
/* value of Free on entry to primitive, or 0 if not in primitive */
-SCHEME_OBJECT * Free_primitive = 0;
+__thread SCHEME_OBJECT * Free_primitive = 0;
/* strict limit for Free */
-SCHEME_OBJECT * heap_alloc_limit;
+__thread SCHEME_OBJECT * heap_alloc_limit;
#ifdef ENABLE_SMP
/* the start of From space */
#endif
/* limits of local heap */
-SCHEME_OBJECT * heap_start;
-SCHEME_OBJECT * heap_end;
+__thread SCHEME_OBJECT * heap_start;
+__thread SCHEME_OBJECT * heap_end;
/* pointer to most-recently pushed item */
SCHEME_OBJECT * stack_pointer;
/*-strict limit for stack_pointer */
-SCHEME_OBJECT * stack_guard;
+__thread SCHEME_OBJECT * stack_guard;
/* limits of stack */
-SCHEME_OBJECT * stack_start;
-SCHEME_OBJECT * stack_end;
+__thread SCHEME_OBJECT * stack_start;
+__thread SCHEME_OBJECT * stack_end;
/* next free word in constant space */
SCHEME_OBJECT * constant_alloc_next;
/* Address of the most recent return code in the stack.
This is only meaningful while in compiled code. */
-SCHEME_OBJECT * last_return_code;
+__thread SCHEME_OBJECT * last_return_code;
SCHEME_OBJECT fixed_objects;
SCHEME_OBJECT ephemeron_array = SHARP_F;
unsigned long ephemeron_count = 0;
-bool trapping;
+__thread bool trapping;
SCHEME_OBJECT * memory_block_start;
SCHEME_OBJECT * memory_block_end;
enum transaction_state state;
};
-static struct transaction * current_transaction;
+static __thread struct transaction * current_transaction;
static void
guarantee_current_transaction (const char * proc)
extern void OS2_handle_attention_interrupt (void);
#endif
-SCHEME_OBJECT * history_register;
-unsigned long prev_restore_history_offset;
+__thread SCHEME_OBJECT * history_register;
+__thread unsigned long prev_restore_history_offset;
static SCHEME_OBJECT copy_history (SCHEME_OBJECT);
static void error_death (long, const char *) NORETURN;
SCHEME_OBJECT * callers_last_return_code;
#ifdef CC_IS_NATIVE
- extern void * C_Frame_Pointer;
- extern void * C_Stack_Pointer;
+ extern __thread void * C_Frame_Pointer;
+ extern __thread void * C_Stack_Pointer;
void * cfp = C_Frame_Pointer;
void * csp = C_Stack_Pointer;
#ifdef CL386
void * environment;
};
-static struct obstack dstack;
-static struct winding_record * current_winding_record;
-void * dstack_position;
+static __thread struct obstack dstack;
+static __thread struct winding_record * current_winding_record;
+__thread void * dstack_position;
void
dstack_initialize (void)