From 620a4d6dd625e0e1ab4b7f9a37a5cae57f037d36 Mon Sep 17 00:00:00 2001 From: Kevin Tew Date: Tue, 5 Jan 2010 15:59:12 +0000 Subject: [PATCH] CIL Tagging svn: r17485 --- src/mzscheme/src/bignum.c | 2 +- src/mzscheme/src/bool.c | 12 +-- src/mzscheme/src/char.c | 2 +- src/mzscheme/src/env.c | 14 ++-- src/mzscheme/src/error.c | 44 +++++------ src/mzscheme/src/eval.c | 71 ++++++++--------- src/mzscheme/src/file.c | 27 +++---- src/mzscheme/src/fun.c | 86 ++++++++++----------- src/mzscheme/src/hash.c | 3 +- src/mzscheme/src/list.c | 19 ++--- src/mzscheme/src/module.c | 139 +++++++++++++++++----------------- src/mzscheme/src/network.c | 2 +- src/mzscheme/src/number.c | 22 +++--- src/mzscheme/src/numstr.c | 10 +-- src/mzscheme/src/places.c | 6 +- src/mzscheme/src/port.c | 50 ++++++------ src/mzscheme/src/portfun.c | 32 ++++---- src/mzscheme/src/rational.c | 2 +- src/mzscheme/src/read.c | 52 ++++++------- src/mzscheme/src/regexp.c | 2 +- src/mzscheme/src/schexn.h | 14 ++-- src/mzscheme/src/schpriv.h | 12 +++ src/mzscheme/src/schuchar.inc | 26 +++---- src/mzscheme/src/schustr.inc | 22 +++--- src/mzscheme/src/sema.c | 4 +- src/mzscheme/src/setjmpup.c | 4 +- src/mzscheme/src/string.c | 18 ++--- src/mzscheme/src/struct.c | 49 ++++++------ src/mzscheme/src/stxobj.c | 55 ++++++-------- src/mzscheme/src/symbol.c | 12 +-- src/mzscheme/src/syntax.c | 48 ++++++------ src/mzscheme/src/thread.c | 48 +++++------- src/mzscheme/src/type.c | 18 +++-- src/mzscheme/src/vector.c | 4 +- 34 files changed, 468 insertions(+), 463 deletions(-) diff --git a/src/mzscheme/src/bignum.c b/src/mzscheme/src/bignum.c index 8a03adb47f..d22695da66 100644 --- a/src/mzscheme/src/bignum.c +++ b/src/mzscheme/src/bignum.c @@ -95,7 +95,7 @@ void scheme_bignum_use_fuel(long n); # define WORD_SIZE 32 #endif -static Scheme_Object *bignum_one; +READ_ONLY static Scheme_Object *bignum_one; void scheme_init_bignum() { REGISTER_SO(bignum_one); diff --git a/src/mzscheme/src/bool.c b/src/mzscheme/src/bool.c index 8e48fa5204..060347986f 100644 --- a/src/mzscheme/src/bool.c +++ b/src/mzscheme/src/bool.c @@ -31,13 +31,13 @@ #endif /* global_constants */ -Scheme_Object scheme_true[1]; -Scheme_Object scheme_false[1]; +READ_ONLY Scheme_Object scheme_true[1]; +READ_ONLY Scheme_Object scheme_false[1]; -Scheme_Object *scheme_not_prim; -Scheme_Object *scheme_eq_prim; -Scheme_Object *scheme_eqv_prim; -Scheme_Object *scheme_equal_prim; +READ_ONLY Scheme_Object *scheme_not_prim; +READ_ONLY Scheme_Object *scheme_eq_prim; +READ_ONLY Scheme_Object *scheme_eqv_prim; +READ_ONLY Scheme_Object *scheme_equal_prim; /* locals */ static Scheme_Object *not_prim (int argc, Scheme_Object *argv[]); diff --git a/src/mzscheme/src/char.c b/src/mzscheme/src/char.c index f7357af51b..82f78908cc 100644 --- a/src/mzscheme/src/char.c +++ b/src/mzscheme/src/char.c @@ -28,7 +28,7 @@ /* globals */ #include "schuchar.inc" -Scheme_Object **scheme_char_constants; +READ_ONLY Scheme_Object **scheme_char_constants; /* locals */ static Scheme_Object *char_p (int argc, Scheme_Object *argv[]); diff --git a/src/mzscheme/src/env.c b/src/mzscheme/src/env.c index 1d9e573e93..bf29fd6396 100644 --- a/src/mzscheme/src/env.c +++ b/src/mzscheme/src/env.c @@ -53,20 +53,21 @@ static int builtin_ref_counter = 0; static int env_uid_counter = 0; /* globals READ-ONLY SHARED */ -static Scheme_Object *kernel_symbol; -static Scheme_Env *kernel_env; -static Scheme_Env *unsafe_env; -static Scheme_Env *flfxnum_env; +READ_ONLY static Scheme_Object *kernel_symbol; +READ_ONLY static Scheme_Object *unshadowable_symbol; +READ_ONLY static Scheme_Env *kernel_env; +READ_ONLY static Scheme_Env *unsafe_env; +READ_ONLY static Scheme_Env *flfxnum_env; #define MAX_CONST_LOCAL_POS 64 #define MAX_CONST_LOCAL_TYPES 2 #define MAX_CONST_LOCAL_FLAG_VAL 3 #define SCHEME_LOCAL_FLAGS_MASK 0x3 -static Scheme_Object *scheme_local[MAX_CONST_LOCAL_POS][MAX_CONST_LOCAL_TYPES][MAX_CONST_LOCAL_FLAG_VAL + 1]; +READ_ONLY static Scheme_Object *scheme_local[MAX_CONST_LOCAL_POS][MAX_CONST_LOCAL_TYPES][MAX_CONST_LOCAL_FLAG_VAL + 1]; #define MAX_CONST_TOPLEVEL_DEPTH 16 #define MAX_CONST_TOPLEVEL_POS 16 #define SCHEME_TOPLEVEL_FLAGS_MASK 0x3 -static Scheme_Object *toplevels[MAX_CONST_TOPLEVEL_DEPTH][MAX_CONST_TOPLEVEL_POS][SCHEME_TOPLEVEL_FLAGS_MASK + 1]; +READ_ONLY static Scheme_Object *toplevels[MAX_CONST_TOPLEVEL_DEPTH][MAX_CONST_TOPLEVEL_POS][SCHEME_TOPLEVEL_FLAGS_MASK + 1]; /* If locked, these are probably sharable: */ THREAD_LOCAL_DECL(static Scheme_Hash_Table *toplevels_ht); @@ -183,7 +184,6 @@ static void init_compile_data(Scheme_Comp_Env *env); #define ASSERT_IS_VARIABLE_BUCKET(b) /* if (((Scheme_Object *)b)->type != scheme_variable_type) abort() */ -static Scheme_Object *unshadowable_symbol; /*========================================================================*/ /* initialization */ diff --git a/src/mzscheme/src/error.c b/src/mzscheme/src/error.c index cf371085e4..d33b11cf92 100644 --- a/src/mzscheme/src/error.c +++ b/src/mzscheme/src/error.c @@ -41,36 +41,36 @@ #endif /* globals */ -scheme_console_printf_t scheme_console_printf; +SHARED_OK scheme_console_printf_t scheme_console_printf; scheme_console_printf_t scheme_get_console_printf() { return scheme_console_printf; } -Scheme_Exit_Proc scheme_exit; +SHARED_OK Scheme_Exit_Proc scheme_exit; void scheme_set_exit(Scheme_Exit_Proc p) { scheme_exit = p; } -void (*scheme_console_output)(char *str, long len); +HOOK_SHARED_OK void (*scheme_console_output)(char *str, long len); static int init_syslog_level = INIT_SYSLOG_LEVEL; static int init_stderr_level = SCHEME_LOG_ERROR; THREAD_LOCAL_DECL(static Scheme_Logger *scheme_main_logger); /* readonly globals */ -const char *scheme_compile_stx_string = "compile"; -const char *scheme_expand_stx_string = "expand"; -const char *scheme_application_stx_string = "application"; -const char *scheme_set_stx_string = "set!"; -const char *scheme_var_ref_string = "#%variable-reference"; -const char *scheme_begin_stx_string = "begin"; -static Scheme_Object *fatal_symbol; -static Scheme_Object *error_symbol; -static Scheme_Object *warning_symbol; -static Scheme_Object *info_symbol; -static Scheme_Object *debug_symbol; -static Scheme_Object *arity_property; -static Scheme_Object *def_err_val_proc; -static Scheme_Object *def_error_esc_proc; -static Scheme_Object *default_display_handler; -static Scheme_Object *emergency_display_handler; -Scheme_Object *scheme_def_exit_proc; -Scheme_Object *scheme_raise_arity_error_proc; +READ_ONLY const char *scheme_compile_stx_string = "compile"; +READ_ONLY const char *scheme_expand_stx_string = "expand"; +READ_ONLY const char *scheme_application_stx_string = "application"; +READ_ONLY const char *scheme_set_stx_string = "set!"; +READ_ONLY const char *scheme_var_ref_string = "#%variable-reference"; +READ_ONLY const char *scheme_begin_stx_string = "begin"; +ROSYM static Scheme_Object *fatal_symbol; +ROSYM static Scheme_Object *error_symbol; +ROSYM static Scheme_Object *warning_symbol; +ROSYM static Scheme_Object *info_symbol; +ROSYM static Scheme_Object *debug_symbol; +ROSYM static Scheme_Object *arity_property; +ROSYM static Scheme_Object *def_err_val_proc; +ROSYM static Scheme_Object *def_error_esc_proc; +ROSYM static Scheme_Object *default_display_handler; +ROSYM static Scheme_Object *emergency_display_handler; +READ_ONLY Scheme_Object *scheme_def_exit_proc; +READ_ONLY Scheme_Object *scheme_raise_arity_error_proc; #ifdef MEMORY_COUNTING_ON @@ -1300,7 +1300,7 @@ char *scheme_make_args_string(char *s, int which, int argc, Scheme_Object **argv const char *scheme_number_suffix(int which) { - static char *ending[] = {"st", "nd", "rd"}; + READ_ONLY static char *ending[] = {"st", "nd", "rd"}; if (!which) return "th"; diff --git a/src/mzscheme/src/eval.c b/src/mzscheme/src/eval.c index 088ea02243..1bb5624af3 100644 --- a/src/mzscheme/src/eval.c +++ b/src/mzscheme/src/eval.c @@ -149,53 +149,54 @@ #define EMBEDDED_DEFINES_START_ANYWHERE 0 -/* globals */ -THREAD_LOCAL_DECL(volatile int scheme_fuel_counter); +/* globals */ int scheme_startup_use_jit = 1; void scheme_set_startup_use_jit(int v) { scheme_startup_use_jit = v; } -/* THREAD LOCAL SHARED */ -#ifdef USE_STACK_BOUNDARY_VAR -THREAD_LOCAL_DECL(unsigned long scheme_stack_boundary); -THREAD_LOCAL_DECL(unsigned long volatile scheme_jit_stack_boundary); -#endif -THREAD_LOCAL_DECL(static Scheme_Object *quick_stx); - /* global counters */ /* FIXME needs to be atomically incremented */ int scheme_overflow_count; int get_overflow_count() { return scheme_overflow_count; } + + +/* THREAD LOCAL SHARED */ +THREAD_LOCAL_DECL(volatile int scheme_fuel_counter); +#ifdef USE_STACK_BOUNDARY_VAR +THREAD_LOCAL_DECL(unsigned long scheme_stack_boundary); +THREAD_LOCAL_DECL(unsigned long volatile scheme_jit_stack_boundary); +#endif +THREAD_LOCAL_DECL(static Scheme_Object *quick_stx); THREAD_LOCAL_DECL(int scheme_continuation_application_count); /* read-only globals */ -Scheme_Object *scheme_eval_waiting; -Scheme_Object *scheme_multiple_values; -static Scheme_Object *app_expander; -static Scheme_Object *datum_expander; -static Scheme_Object *top_expander; -static Scheme_Object *stop_expander; +READ_ONLY Scheme_Object *scheme_eval_waiting; +READ_ONLY Scheme_Object *scheme_multiple_values; +READ_ONLY static Scheme_Object *app_expander; +READ_ONLY static Scheme_Object *datum_expander; +READ_ONLY static Scheme_Object *top_expander; +READ_ONLY static Scheme_Object *stop_expander; /* symbols */ -static Scheme_Object *app_symbol; -static Scheme_Object *datum_symbol; -static Scheme_Object *top_symbol; -static Scheme_Object *top_level_symbol; -static Scheme_Object *define_values_symbol; -static Scheme_Object *letrec_values_symbol; -static Scheme_Object *lambda_symbol; -static Scheme_Object *unknown_symbol; -static Scheme_Object *void_link_symbol; -static Scheme_Object *quote_symbol; -static Scheme_Object *letrec_syntaxes_symbol; -static Scheme_Object *begin_symbol; -static Scheme_Object *let_values_symbol; -static Scheme_Object *internal_define_symbol; -static Scheme_Object *module_symbol; -static Scheme_Object *module_begin_symbol; -static Scheme_Object *expression_symbol; -static Scheme_Object *protected_symbol; -Scheme_Object *scheme_stack_dump_key; -static Scheme_Object *zero_rands_ptr; /* &zero_rands_ptr is dummy rands pointer */ +ROSYM static Scheme_Object *app_symbol; +ROSYM static Scheme_Object *datum_symbol; +ROSYM static Scheme_Object *top_symbol; +ROSYM static Scheme_Object *top_level_symbol; +ROSYM static Scheme_Object *define_values_symbol; +ROSYM static Scheme_Object *letrec_values_symbol; +ROSYM static Scheme_Object *lambda_symbol; +ROSYM static Scheme_Object *unknown_symbol; +ROSYM static Scheme_Object *void_link_symbol; +ROSYM static Scheme_Object *quote_symbol; +ROSYM static Scheme_Object *letrec_syntaxes_symbol; +ROSYM static Scheme_Object *begin_symbol; +ROSYM static Scheme_Object *let_values_symbol; +ROSYM static Scheme_Object *internal_define_symbol; +ROSYM static Scheme_Object *module_symbol; +ROSYM static Scheme_Object *module_begin_symbol; +ROSYM static Scheme_Object *expression_symbol; +ROSYM static Scheme_Object *protected_symbol; +ROSYM Scheme_Object *scheme_stack_dump_key; +READ_ONLY static Scheme_Object *zero_rands_ptr; /* &zero_rands_ptr is dummy rands pointer */ /* locals */ static Scheme_Object *eval(int argc, Scheme_Object *argv[]); diff --git a/src/mzscheme/src/file.c b/src/mzscheme/src/file.c index 516e88d2f9..a7f4b7934b 100644 --- a/src/mzscheme/src/file.c +++ b/src/mzscheme/src/file.c @@ -128,7 +128,7 @@ long scheme_creator_id = 'MzSc'; #define IS_A_SEP(kind, x) ((kind == SCHEME_UNIX_PATH_KIND) ? IS_A_UNIX_SEP(x) : IS_A_DOS_SEP(x)) #define IS_A_PRIM_SEP(kind, x) ((kind == SCHEME_UNIX_PATH_KIND) ? IS_A_UNIX_PRIM_SEP(x) : IS_A_DOS_PRIM_SEP(x)) -MZ_DLLSPEC int scheme_ignore_user_paths; +SHARED_OK int scheme_ignore_user_paths; void scheme_set_ignore_user_paths(int v) { scheme_ignore_user_paths = v; } #define CURRENT_WD() scheme_get_param(scheme_current_config(), MZCONFIG_CURRENT_DIRECTORY) @@ -216,21 +216,22 @@ static char *do_normal_path_seps(char *si, int *_len, int delta, int strip_trail static char *remove_redundant_slashes(char *filename, int *l, int delta, int *expanded, int kind); static Scheme_Object *do_path_to_directory_path(char *s, long offset, long len, Scheme_Object *p, int just_check, int kind); -static Scheme_Object *up_symbol, *relative_symbol; -static Scheme_Object *same_symbol; +READ_ONLY static Scheme_Object *up_symbol; +READ_ONLY static Scheme_Object *relative_symbol; +READ_ONLY static Scheme_Object *same_symbol; #ifndef NO_FILE_SYSTEM_UTILS -static Scheme_Object *read_symbol, *write_symbol, *execute_symbol; +READ_ONLY static Scheme_Object *read_symbol, *write_symbol, *execute_symbol; -static Scheme_Object *temp_dir_symbol, *home_dir_symbol, *pref_dir_symbol; -static Scheme_Object *doc_dir_symbol, *desk_dir_symbol; -static Scheme_Object *init_dir_symbol, *init_file_symbol, *sys_dir_symbol; -static Scheme_Object *exec_file_symbol, *run_file_symbol, *collects_dir_symbol; -static Scheme_Object *pref_file_symbol, *orig_dir_symbol, *addon_dir_symbol; +READ_ONLY static Scheme_Object *temp_dir_symbol, *home_dir_symbol, *pref_dir_symbol; +READ_ONLY static Scheme_Object *doc_dir_symbol, *desk_dir_symbol; +READ_ONLY static Scheme_Object *init_dir_symbol, *init_file_symbol, *sys_dir_symbol; +READ_ONLY static Scheme_Object *exec_file_symbol, *run_file_symbol, *collects_dir_symbol; +READ_ONLY static Scheme_Object *pref_file_symbol, *orig_dir_symbol, *addon_dir_symbol; -static Scheme_Object *exec_cmd, *run_cmd; -static Scheme_Object *collects_path, *original_pwd = NULL, *addon_dir = NULL; +SHARED_OK static Scheme_Object *exec_cmd, *run_cmd; +SHARED_OK static Scheme_Object *collects_path, *original_pwd = NULL, *addon_dir = NULL; #endif -static Scheme_Object *windows_symbol, *unix_symbol; +READ_ONLY static Scheme_Object *windows_symbol, *unix_symbol; void scheme_init_file(Scheme_Env *env) { @@ -1623,7 +1624,7 @@ char *strip_trailing_spaces(const char *s, int *_len, int delta, int in_place) } /* Watch out for special device names. Could we do better than hardwiring this list? */ -static char *special_filenames[] = { "NUL", "CON", "PRN", "AUX", /* NT only: "CLOCK$", */ +READ_ONLY static const char *special_filenames[] = { "NUL", "CON", "PRN", "AUX", /* NT only: "CLOCK$", */ "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", diff --git a/src/mzscheme/src/fun.c b/src/mzscheme/src/fun.c index 877a5f88a6..2608d41a11 100644 --- a/src/mzscheme/src/fun.c +++ b/src/mzscheme/src/fun.c @@ -76,23 +76,51 @@ static void ASSERT_SUSPEND_BREAK_ZERO() { } /* globals */ -int scheme_defining_primitives; /* set to 1 during start-up */ +SHARED_OK int scheme_defining_primitives; /* set to 1 during start-up */ -Scheme_Object scheme_void[1]; /* the void constant */ -Scheme_Object *scheme_values_func; /* the function bound to `values' */ -Scheme_Object *scheme_procedure_p_proc; -Scheme_Object *scheme_procedure_arity_includes_proc; -Scheme_Object *scheme_void_proc; -Scheme_Object *scheme_call_with_values_proc; /* the function bound to `call-with-values' */ -Scheme_Object *scheme_reduced_procedure_struct; -Scheme_Object *scheme_tail_call_waiting; -Scheme_Object *scheme_inferred_name_symbol; -Scheme_Object *scheme_default_prompt_tag; +READ_ONLY Scheme_Object scheme_void[1]; /* the void constant */ +READ_ONLY Scheme_Object *scheme_values_func; /* the function bound to `values' */ +READ_ONLY Scheme_Object *scheme_procedure_p_proc; +READ_ONLY Scheme_Object *scheme_procedure_arity_includes_proc; +READ_ONLY Scheme_Object *scheme_void_proc; +READ_ONLY Scheme_Object *scheme_call_with_values_proc; /* the function bound to `call-with-values' */ +READ_ONLY Scheme_Object *scheme_reduced_procedure_struct; +READ_ONLY Scheme_Object *scheme_tail_call_waiting; +READ_ONLY Scheme_Object *scheme_inferred_name_symbol; +READ_ONLY Scheme_Object *scheme_default_prompt_tag; + +/* READ ONLY SHARABLE GLOBALS */ + +ROSYM static Scheme_Object *certify_mode_symbol; +ROSYM static Scheme_Object *transparent_symbol; +ROSYM static Scheme_Object *transparent_binding_symbol; +ROSYM static Scheme_Object *opaque_symbol; +ROSYM static Scheme_Object *is_method_symbol; +ROSYM static Scheme_Object *cont_key; /* uninterned */ +ROSYM static Scheme_Object *barrier_prompt_key; /* uninterned */ +READ_ONLY static Scheme_Prompt *original_default_prompt; /* for escapes, represents the implicit initial prompt */ +READ_ONLY static Scheme_Object *call_with_prompt_proc; +READ_ONLY static Scheme_Object *abort_continuation_proc; +READ_ONLY static Scheme_Object *internal_call_cc_prim; + +/* Caches need to be thread-local: */ +THREAD_LOCAL_DECL(static Scheme_Prompt *available_prompt); +THREAD_LOCAL_DECL(static Scheme_Prompt *available_cws_prompt); +THREAD_LOCAL_DECL(static Scheme_Prompt *available_regular_prompt); +THREAD_LOCAL_DECL(static Scheme_Dynamic_Wind *available_prompt_dw); +THREAD_LOCAL_DECL(static Scheme_Meta_Continuation *available_prompt_mc); +THREAD_LOCAL_DECL(static Scheme_Object *cached_beg_stx); +THREAD_LOCAL_DECL(static Scheme_Object *cached_mod_stx); +THREAD_LOCAL_DECL(static Scheme_Object *cached_mod_beg_stx); +THREAD_LOCAL_DECL(static Scheme_Object *cached_dv_stx); +THREAD_LOCAL_DECL(static Scheme_Object *cached_ds_stx); +THREAD_LOCAL_DECL(static int cached_stx_phase); +THREAD_LOCAL_DECL(static Scheme_Cont *offstack_cont); +THREAD_LOCAL_DECL(static Scheme_Overflow *offstack_overflow); THREAD_LOCAL_DECL(int scheme_cont_capture_count); THREAD_LOCAL_DECL(static int scheme_prompt_capture_count); - /* locals */ static Scheme_Object *procedure_p (int argc, Scheme_Object *argv[]); static Scheme_Object *apply (int argc, Scheme_Object *argv[]); @@ -151,40 +179,6 @@ static Scheme_Object *current_prompt_read(int, Scheme_Object **); static Scheme_Object *write_compiled_closure(Scheme_Object *obj); static Scheme_Object *read_compiled_closure(Scheme_Object *obj); -/* READ ONLY SHARABLE GLOBALS */ -static Scheme_Prompt *original_default_prompt; /* for escapes, represents the implicit initial prompt */ - -static Scheme_Object *certify_mode_symbol; -static Scheme_Object *transparent_symbol; -static Scheme_Object *transparent_binding_symbol; -static Scheme_Object *opaque_symbol; - -static Scheme_Object *cont_key; /* uninterned */ -static Scheme_Object *barrier_prompt_key; /* uninterned */ - -static Scheme_Object *is_method_symbol; - -static Scheme_Object *call_with_prompt_proc; -static Scheme_Object *abort_continuation_proc; - -static Scheme_Object *internal_call_cc_prim; - -/* Caches need to be thread-local: */ -THREAD_LOCAL_DECL(static Scheme_Prompt *available_prompt); -THREAD_LOCAL_DECL(static Scheme_Prompt *available_cws_prompt); -THREAD_LOCAL_DECL(static Scheme_Prompt *available_regular_prompt); -THREAD_LOCAL_DECL(static Scheme_Dynamic_Wind *available_prompt_dw); -THREAD_LOCAL_DECL(static Scheme_Meta_Continuation *available_prompt_mc); -THREAD_LOCAL_DECL(static Scheme_Object *cached_beg_stx); -THREAD_LOCAL_DECL(static Scheme_Object *cached_mod_stx); -THREAD_LOCAL_DECL(static Scheme_Object *cached_mod_beg_stx); -THREAD_LOCAL_DECL(static Scheme_Object *cached_dv_stx); -THREAD_LOCAL_DECL(static Scheme_Object *cached_ds_stx); -THREAD_LOCAL_DECL(static int cached_stx_phase); -THREAD_LOCAL_DECL(static Scheme_Cont *offstack_cont); -THREAD_LOCAL_DECL(static Scheme_Overflow *offstack_overflow); - - typedef void (*DW_PrePost_Proc)(void *); #define CONS(a,b) scheme_make_pair(a,b) diff --git a/src/mzscheme/src/hash.c b/src/mzscheme/src/hash.c index 495355a950..7395cd16d4 100644 --- a/src/mzscheme/src/hash.c +++ b/src/mzscheme/src/hash.c @@ -33,6 +33,8 @@ long scheme_hash_request_count; long scheme_hash_iteration_count; +READ_ONLY static Scheme_Object GONE[1]; + #ifdef MZ_PRECISE_GC static void register_traversers(void); #endif @@ -140,7 +142,6 @@ static int not_stx_bound_eq(char *a, char *b) /* normal hash table */ /*========================================================================*/ -static Scheme_Object GONE[1]; Scheme_Hash_Table *scheme_make_hash_table(int type) { diff --git a/src/mzscheme/src/list.c b/src/mzscheme/src/list.c index 560944277c..2963747aee 100644 --- a/src/mzscheme/src/list.c +++ b/src/mzscheme/src/list.c @@ -25,13 +25,16 @@ #include "schpriv.h" -/* globals */ -Scheme_Object scheme_null[1]; -Scheme_Object *scheme_cons_proc; -Scheme_Object *scheme_mcons_proc; -Scheme_Object *scheme_list_proc; -Scheme_Object *scheme_list_star_proc; -Scheme_Object *scheme_box_proc; +/* read only globals */ +READ_ONLY Scheme_Object scheme_null[1]; +READ_ONLY Scheme_Object *scheme_cons_proc; +READ_ONLY Scheme_Object *scheme_mcons_proc; +READ_ONLY Scheme_Object *scheme_list_proc; +READ_ONLY Scheme_Object *scheme_list_star_proc; +READ_ONLY Scheme_Object *scheme_box_proc; +/* read only locals */ +ROSYM static Scheme_Object *weak_symbol; +ROSYM static Scheme_Object *equal_symbol; /* locals */ static Scheme_Object *pair_p_prim (int argc, Scheme_Object *argv[]); @@ -149,8 +152,6 @@ static Scheme_Object *unsafe_set_box (int argc, Scheme_Object *argv[]); #define UNBOX "unbox" #define SETBOX "set-box!" -static Scheme_Object *weak_symbol, *equal_symbol; - void scheme_init_list (Scheme_Env *env) { diff --git a/src/mzscheme/src/module.c b/src/mzscheme/src/module.c index aabf6d7d24..4695bfec99 100644 --- a/src/mzscheme/src/module.c +++ b/src/mzscheme/src/module.c @@ -30,12 +30,11 @@ #include "schexpobs.h" /* globals */ -Scheme_Object *scheme_sys_wraps0; -Scheme_Object *scheme_sys_wraps1; -Scheme_Object *(*scheme_module_demand_hook)(int, Scheme_Object **); +SHARED_OK Scheme_Object *(*scheme_module_demand_hook)(int, Scheme_Object **); +SHARED_OK static Scheme_Bucket_Table *modpath_table; #ifdef MZ_USE_PLACES -mzrt_mutex *modpath_table_mutex; +SHARED_OK static mzrt_mutex *modpath_table_mutex; #else # define mzrt_mutex_lock(l) /* empty */ # define mzrt_mutex_unlock(l) /* empty */ @@ -128,77 +127,80 @@ static Scheme_Object *scheme_sys_wraps_phase_worker(long p); #define cons scheme_make_pair - /* global read-only kernel stuff */ -static Scheme_Object *kernel_modname; -static Scheme_Object *kernel_symbol; -static Scheme_Object *kernel_modidx; -static Scheme_Module *kernel; -static Scheme_Object *flfxnum_modname; -static Scheme_Object *unsafe_modname; +READ_ONLY static Scheme_Object *kernel_modname; +READ_ONLY static Scheme_Object *kernel_symbol; +READ_ONLY static Scheme_Object *kernel_modidx; +READ_ONLY static Scheme_Module *kernel; +READ_ONLY static Scheme_Object *flfxnum_modname; +READ_ONLY static Scheme_Object *unsafe_modname; + +/* global read-only phase wraps */ +READ_ONLY static Scheme_Object *scheme_sys_wraps0; +READ_ONLY static Scheme_Object *scheme_sys_wraps1; /* global read-only symbols */ -static Scheme_Object *module_symbol; -static Scheme_Object *module_begin_symbol; -static Scheme_Object *prefix_symbol; -static Scheme_Object *only_symbol; -static Scheme_Object *rename_symbol; -static Scheme_Object *all_except_symbol; -static Scheme_Object *prefix_all_except_symbol; -static Scheme_Object *all_from_symbol; -static Scheme_Object *all_from_except_symbol; -static Scheme_Object *all_defined_symbol; -static Scheme_Object *all_defined_except_symbol; -static Scheme_Object *prefix_all_defined_symbol; -static Scheme_Object *prefix_all_defined_except_symbol; -static Scheme_Object *struct_symbol; -static Scheme_Object *protect_symbol; -static Scheme_Object *expand_symbol; -static Scheme_Object *for_syntax_symbol; -static Scheme_Object *for_template_symbol; -static Scheme_Object *for_label_symbol; -static Scheme_Object *for_meta_symbol; -static Scheme_Object *just_meta_symbol; -static Scheme_Object *quote_symbol; -static Scheme_Object *lib_symbol; -static Scheme_Object *planet_symbol; -static Scheme_Object *file_symbol; -static Scheme_Object *module_name_symbol; -static Scheme_Object *nominal_id_symbol; +ROSYM static Scheme_Object *module_symbol; +ROSYM static Scheme_Object *module_begin_symbol; +ROSYM static Scheme_Object *prefix_symbol; +ROSYM static Scheme_Object *only_symbol; +ROSYM static Scheme_Object *rename_symbol; +ROSYM static Scheme_Object *all_except_symbol; +ROSYM static Scheme_Object *prefix_all_except_symbol; +ROSYM static Scheme_Object *all_from_symbol; +ROSYM static Scheme_Object *all_from_except_symbol; +ROSYM static Scheme_Object *all_defined_symbol; +ROSYM static Scheme_Object *all_defined_except_symbol; +ROSYM static Scheme_Object *prefix_all_defined_symbol; +ROSYM static Scheme_Object *prefix_all_defined_except_symbol; +ROSYM static Scheme_Object *struct_symbol; +ROSYM static Scheme_Object *protect_symbol; +ROSYM static Scheme_Object *expand_symbol; +ROSYM static Scheme_Object *for_syntax_symbol; +ROSYM static Scheme_Object *for_template_symbol; +ROSYM static Scheme_Object *for_label_symbol; +ROSYM static Scheme_Object *for_meta_symbol; +ROSYM static Scheme_Object *just_meta_symbol; +ROSYM static Scheme_Object *quote_symbol; +ROSYM static Scheme_Object *lib_symbol; +ROSYM static Scheme_Object *planet_symbol; +ROSYM static Scheme_Object *file_symbol; +ROSYM static Scheme_Object *module_name_symbol; +ROSYM static Scheme_Object *nominal_id_symbol; /* global read-only syntax */ -Scheme_Object *scheme_module_stx; -Scheme_Object *scheme_module_begin_stx; -Scheme_Object *scheme_begin_stx; -Scheme_Object *scheme_define_values_stx; -Scheme_Object *scheme_define_syntaxes_stx; -Scheme_Object *scheme_top_stx; -static Scheme_Object *modbeg_syntax; -static Scheme_Object *define_for_syntaxes_stx; -static Scheme_Object *require_stx; -static Scheme_Object *provide_stx; -static Scheme_Object *set_stx; -static Scheme_Object *app_stx; -static Scheme_Object *lambda_stx; -static Scheme_Object *case_lambda_stx; -static Scheme_Object *let_values_stx; -static Scheme_Object *letrec_values_stx; -static Scheme_Object *if_stx; -static Scheme_Object *begin0_stx; -static Scheme_Object *set_stx; -static Scheme_Object *with_continuation_mark_stx; -static Scheme_Object *letrec_syntaxes_stx; -static Scheme_Object *var_ref_stx; -static Scheme_Object *expression_stx; +READ_ONLY Scheme_Object *scheme_module_stx; +READ_ONLY Scheme_Object *scheme_module_begin_stx; +READ_ONLY Scheme_Object *scheme_begin_stx; +READ_ONLY Scheme_Object *scheme_define_values_stx; +READ_ONLY Scheme_Object *scheme_define_syntaxes_stx; +READ_ONLY Scheme_Object *scheme_top_stx; +READ_ONLY static Scheme_Object *modbeg_syntax; +READ_ONLY static Scheme_Object *define_for_syntaxes_stx; +READ_ONLY static Scheme_Object *require_stx; +READ_ONLY static Scheme_Object *provide_stx; +READ_ONLY static Scheme_Object *set_stx; +READ_ONLY static Scheme_Object *app_stx; +READ_ONLY static Scheme_Object *lambda_stx; +READ_ONLY static Scheme_Object *case_lambda_stx; +READ_ONLY static Scheme_Object *let_values_stx; +READ_ONLY static Scheme_Object *letrec_values_stx; +READ_ONLY static Scheme_Object *if_stx; +READ_ONLY static Scheme_Object *begin0_stx; +READ_ONLY static Scheme_Object *set_stx; +READ_ONLY static Scheme_Object *with_continuation_mark_stx; +READ_ONLY static Scheme_Object *letrec_syntaxes_stx; +READ_ONLY static Scheme_Object *var_ref_stx; +READ_ONLY static Scheme_Object *expression_stx; -static Scheme_Env *initial_modules_env; -static int num_initial_modules; -static Scheme_Object **initial_modules; -static Scheme_Object *initial_renames; -static Scheme_Bucket_Table *initial_toplevel; +READ_ONLY static Scheme_Env *initial_modules_env; +READ_ONLY static int num_initial_modules; +READ_ONLY static Scheme_Object **initial_modules; +READ_ONLY static Scheme_Object *initial_renames; +READ_ONLY static Scheme_Bucket_Table *initial_toplevel; -static Scheme_Object *empty_self_modidx; -static Scheme_Object *empty_self_modname; +READ_ONLY static Scheme_Object *empty_self_modidx; +READ_ONLY static Scheme_Object *empty_self_modname; THREAD_LOCAL_DECL(static Scheme_Bucket_Table *starts_table); @@ -214,7 +216,6 @@ THREAD_LOCAL_DECL(static Scheme_Object *global_shift_cache); # define SHIFT_CACHE_NULLP(x) !(x) #endif -static Scheme_Bucket_Table *modpath_table; #define SCHEME_MODNAMEP(obj) SAME_TYPE(SCHEME_TYPE(obj), scheme_resolved_module_path_type) typedef void (*Check_Func)(Scheme_Object *prnt_name, Scheme_Object *name, diff --git a/src/mzscheme/src/network.c b/src/mzscheme/src/network.c index 7d42841f92..65f50fce3b 100644 --- a/src/mzscheme/src/network.c +++ b/src/mzscheme/src/network.c @@ -316,7 +316,7 @@ typedef struct SOCKADDR_IN mz_unspec_address; # ifdef PROTOENT_IS_INT # define PROTO_P_PROTO PROTOENT_IS_INT # else -static struct protoent *proto; +SHARED_OK static struct protoent *proto; # define PROTO_P_PROTO (proto ? proto->p_proto : 0) # endif diff --git a/src/mzscheme/src/number.c b/src/mzscheme/src/number.c index ba9499fa25..46080637a0 100644 --- a/src/mzscheme/src/number.c +++ b/src/mzscheme/src/number.c @@ -52,9 +52,6 @@ # define MAX_SHIFT_EVER 32 #endif -/* globals */ -double scheme_infinity_val, scheme_minus_infinity_val; - /* locals */ static Scheme_Object *number_p (int argc, Scheme_Object *argv[]); static Scheme_Object *complex_p (int argc, Scheme_Object *argv[]); @@ -127,21 +124,24 @@ static Scheme_Object *unsafe_flvector_length (int argc, Scheme_Object *argv[]); static Scheme_Object *unsafe_flvector_ref (int argc, Scheme_Object *argv[]); static Scheme_Object *unsafe_flvector_set (int argc, Scheme_Object *argv[]); -static double not_a_number_val; +/* globals */ +READ_ONLY double scheme_infinity_val; +READ_ONLY double scheme_minus_infinity_val; +READ_ONLY double scheme_floating_point_zero = 0.0; +READ_ONLY double scheme_floating_point_nzero = 0.0; /* negated below; many compilers treat -0.0 as 0.0, + but otherwise correctly implement fp negation */ +READ_ONLY static double not_a_number_val; -Scheme_Object *scheme_inf_object, *scheme_minus_inf_object, *scheme_nan_object; +READ_ONLY Scheme_Object *scheme_inf_object, *scheme_minus_inf_object, *scheme_nan_object; #define zeroi scheme_exact_zero -Scheme_Object *scheme_zerod, *scheme_nzerod, *scheme_pi, *scheme_half_pi, *scheme_plus_i, *scheme_minus_i; +READ_ONLY Scheme_Object *scheme_zerod, *scheme_nzerod, *scheme_pi, *scheme_half_pi, *scheme_plus_i, *scheme_minus_i; #ifdef MZ_USE_SINGLE_FLOATS -Scheme_Object *scheme_zerof, *scheme_nzerof, *scheme_single_pi; -Scheme_Object *scheme_single_inf_object, *scheme_single_minus_inf_object, *scheme_single_nan_object; +READ_ONLY Scheme_Object *scheme_zerof, *scheme_nzerof, *scheme_single_pi; +READ_ONLY Scheme_Object *scheme_single_inf_object, *scheme_single_minus_inf_object, *scheme_single_nan_object; #endif -double scheme_floating_point_zero = 0.0; -double scheme_floating_point_nzero = 0.0; /* negated below; many compilers treat -0.0 as 0.0, - but otherwise correctly implement fp negation */ #ifdef FREEBSD_CONTROL_387 #include diff --git a/src/mzscheme/src/numstr.c b/src/mzscheme/src/numstr.c index 4b8c1c3ee5..259917c852 100644 --- a/src/mzscheme/src/numstr.c +++ b/src/mzscheme/src/numstr.c @@ -56,10 +56,10 @@ static Scheme_Object *sch_pack_bang(int argc, Scheme_Object *argv[]); static char *number_to_allocated_string(int radix, Scheme_Object *obj, int alloc); -static char *infinity_str = "+inf.0"; -static char *minus_infinity_str = "-inf.0"; -static char *not_a_number_str = "+nan.0"; -static char *other_not_a_number_str = "-nan.0"; +READ_ONLY static char *infinity_str = "+inf.0"; +READ_ONLY static char *minus_infinity_str = "-inf.0"; +READ_ONLY static char *not_a_number_str = "+nan.0"; +READ_ONLY static char *other_not_a_number_str = "-nan.0"; static Scheme_Object *num_limits[3]; @@ -176,7 +176,7 @@ MK_SCH_TRIG(SCH_COS, cos) /* number parsing */ /*========================================================================*/ -static int u_strcmp(mzchar *s, char *t) +static int u_strcmp(mzchar *s, const char *t) { int i; diff --git a/src/mzscheme/src/places.c b/src/mzscheme/src/places.c index 25afc3734a..2ff8c91bd0 100644 --- a/src/mzscheme/src/places.c +++ b/src/mzscheme/src/places.c @@ -8,7 +8,7 @@ #include "mzrt.h" -mz_proc_thread *scheme_master_proc_thread; +SHARED_OK mz_proc_thread *scheme_master_proc_thread; THREAD_LOCAL_DECL(mz_proc_thread *proc_thread_self); Scheme_Object *scheme_place(int argc, Scheme_Object *args[]); @@ -154,8 +154,8 @@ typedef struct Child_Status { struct Child_Status *next; } Child_Status; -static Child_Status *child_statuses = NULL; -static mzrt_mutex* child_status_lock = NULL; +SHARED_OK static Child_Status *child_statuses = NULL; +SHARED_OK static mzrt_mutex* child_status_lock = NULL; static void add_child_status(int pid, int status) { Child_Status *st; diff --git a/src/mzscheme/src/port.c b/src/mzscheme/src/port.c index 98df233fe1..c04a907b2c 100644 --- a/src/mzscheme/src/port.c +++ b/src/mzscheme/src/port.c @@ -299,16 +299,16 @@ typedef struct Scheme_FD { /******************** Globals and Prototypes ********************/ /* globals */ -Scheme_Object scheme_eof[1]; +READ_ONLY Scheme_Object scheme_eof[1]; THREAD_LOCAL_DECL(Scheme_Object *scheme_orig_stdout_port); THREAD_LOCAL_DECL(Scheme_Object *scheme_orig_stderr_port); THREAD_LOCAL_DECL(Scheme_Object *scheme_orig_stdin_port); THREAD_LOCAL_DECL(fd_set *scheme_fd_set); -Scheme_Object *(*scheme_make_stdin)(void) = NULL; -Scheme_Object *(*scheme_make_stdout)(void) = NULL; -Scheme_Object *(*scheme_make_stderr)(void) = NULL; +HOOK_SHARED_OK Scheme_Object *(*scheme_make_stdin)(void) = NULL; +HOOK_SHARED_OK Scheme_Object *(*scheme_make_stdout)(void) = NULL; +HOOK_SHARED_OK Scheme_Object *(*scheme_make_stderr)(void) = NULL; int scheme_file_open_count; @@ -319,28 +319,28 @@ static int special_is_ok; /* locals */ #ifdef MZ_FDS -static Scheme_Object *fd_input_port_type; +READ_ONLY static Scheme_Object *fd_input_port_type; #endif #ifdef USE_OSKIT_CONSOLE -static Scheme_Object *oskit_console_input_port_type; +READ_ONLY static Scheme_Object *oskit_console_input_port_type; #endif -static Scheme_Object *file_input_port_type; -Scheme_Object *scheme_string_input_port_type; +READ_ONLY static Scheme_Object *file_input_port_type; +READ_ONLY Scheme_Object *scheme_string_input_port_type; #ifdef USE_TCP -Scheme_Object *scheme_tcp_input_port_type; -Scheme_Object *scheme_tcp_output_port_type; +READ_ONLY Scheme_Object *scheme_tcp_input_port_type; +READ_ONLY Scheme_Object *scheme_tcp_output_port_type; #endif #ifdef MZ_FDS -static Scheme_Object *fd_output_port_type; +READ_ONLY static Scheme_Object *fd_output_port_type; #endif -static Scheme_Object *file_output_port_type; -Scheme_Object *scheme_string_output_port_type; -Scheme_Object *scheme_user_input_port_type; -Scheme_Object *scheme_user_output_port_type; -Scheme_Object *scheme_pipe_read_port_type; -Scheme_Object *scheme_pipe_write_port_type; -Scheme_Object *scheme_null_output_port_type; -Scheme_Object *scheme_redirect_output_port_type; +READ_ONLY static Scheme_Object *file_output_port_type; +READ_ONLY Scheme_Object *scheme_string_output_port_type; +READ_ONLY Scheme_Object *scheme_user_input_port_type; +READ_ONLY Scheme_Object *scheme_user_output_port_type; +READ_ONLY Scheme_Object *scheme_pipe_read_port_type; +READ_ONLY Scheme_Object *scheme_pipe_write_port_type; +READ_ONLY Scheme_Object *scheme_null_output_port_type; +READ_ONLY Scheme_Object *scheme_redirect_output_port_type; int scheme_force_port_closed; @@ -407,14 +407,14 @@ static Scheme_Object *make_oskit_console_input_port(); static void force_close_output_port(Scheme_Object *port); static void force_close_input_port(Scheme_Object *port); -static Scheme_Object *text_symbol, *binary_symbol; -static Scheme_Object *append_symbol, *error_symbol, *update_symbol, *can_update_symbol; -static Scheme_Object *replace_symbol, *truncate_symbol, *truncate_replace_symbol; -static Scheme_Object *must_truncate_symbol; +ROSYM static Scheme_Object *text_symbol, *binary_symbol; +ROSYM static Scheme_Object *append_symbol, *error_symbol, *update_symbol, *can_update_symbol; +ROSYM static Scheme_Object *replace_symbol, *truncate_symbol, *truncate_replace_symbol; +ROSYM static Scheme_Object *must_truncate_symbol; -Scheme_Object *scheme_none_symbol, *scheme_line_symbol, *scheme_block_symbol; +ROSYM Scheme_Object *scheme_none_symbol, *scheme_line_symbol, *scheme_block_symbol; -static Scheme_Object *exact_symbol; +ROSYM static Scheme_Object *exact_symbol; #define READ_STRING_BYTE_BUFFER_SIZE 1024 THREAD_LOCAL_DECL(static char *read_string_byte_buffer); diff --git a/src/mzscheme/src/portfun.c b/src/mzscheme/src/portfun.c index 26eeb639cc..0bf467e847 100644 --- a/src/mzscheme/src/portfun.c +++ b/src/mzscheme/src/portfun.c @@ -139,26 +139,26 @@ static int pipe_out_ready(Scheme_Output_Port *p); static void register_traversers(void); #endif -static Scheme_Object *any_symbol; -static Scheme_Object *any_one_symbol; -static Scheme_Object *cr_symbol; -static Scheme_Object *lf_symbol; -static Scheme_Object *crlf_symbol; -static Scheme_Object *module_symbol; +ROSYM static Scheme_Object *any_symbol; +ROSYM static Scheme_Object *any_one_symbol; +ROSYM static Scheme_Object *cr_symbol; +ROSYM static Scheme_Object *lf_symbol; +ROSYM static Scheme_Object *crlf_symbol; +ROSYM static Scheme_Object *module_symbol; -static Scheme_Object *default_read_handler; -static Scheme_Object *default_display_handler; -static Scheme_Object *default_write_handler; -static Scheme_Object *default_print_handler; +READ_ONLY static Scheme_Object *default_read_handler; +READ_ONLY static Scheme_Object *default_display_handler; +READ_ONLY static Scheme_Object *default_write_handler; +READ_ONLY static Scheme_Object *default_print_handler; -Scheme_Object *scheme_default_global_print_handler; +READ_ONLY Scheme_Object *scheme_default_global_print_handler; -Scheme_Object *scheme_write_proc; -Scheme_Object *scheme_display_proc; -Scheme_Object *scheme_print_proc; +READ_ONLY Scheme_Object *scheme_write_proc; +READ_ONLY Scheme_Object *scheme_display_proc; +READ_ONLY Scheme_Object *scheme_print_proc; -static Scheme_Object *dummy_input_port; -static Scheme_Object *dummy_output_port; +READ_ONLY static Scheme_Object *dummy_input_port; +READ_ONLY static Scheme_Object *dummy_output_port; #define fail_err_symbol scheme_false diff --git a/src/mzscheme/src/rational.c b/src/mzscheme/src/rational.c index b9c63dc61d..fa7e676268 100644 --- a/src/mzscheme/src/rational.c +++ b/src/mzscheme/src/rational.c @@ -27,7 +27,7 @@ #include #include -static Scheme_Object *one = scheme_make_integer(1); +READ_ONLY static Scheme_Object *one = scheme_make_integer(1); static Scheme_Object *make_rational(const Scheme_Object *n, const Scheme_Object *d, int normalize) diff --git a/src/mzscheme/src/read.c b/src/mzscheme/src/read.c index 1daab9950d..6167f00c2e 100644 --- a/src/mzscheme/src/read.c +++ b/src/mzscheme/src/read.c @@ -51,44 +51,44 @@ /* Init options for embedding: */ /* these are used to set initial config parameterizations */ -int scheme_square_brackets_are_parens = 1; -int scheme_curly_braces_are_parens = 1; +SHARED_OK int scheme_square_brackets_are_parens = 1; +SHARED_OK int scheme_curly_braces_are_parens = 1; /* performance counter */ /* FIXME should be atomically incremented or not shared */ int scheme_num_read_syntax_objects; /* global flag set from environment variable */ -static int use_perma_cache = 1; +SHARED_OK static int use_perma_cache = 1; /* read-only global symbols */ static char *builtin_fast; /* FIXME possible init race condition */ -static unsigned char delim[128]; +SHARED_OK static unsigned char delim[128]; /* Table of built-in variable refs for .zo loading: */ static Scheme_Object **variable_references; -static Scheme_Object *quote_symbol; -static Scheme_Object *quasiquote_symbol; -static Scheme_Object *unquote_symbol; -static Scheme_Object *unquote_splicing_symbol; -static Scheme_Object *syntax_symbol; -static Scheme_Object *unsyntax_symbol; -static Scheme_Object *unsyntax_splicing_symbol; -static Scheme_Object *quasisyntax_symbol; -static Scheme_Object *paren_shape_symbol; -static Scheme_Object *terminating_macro_symbol; -static Scheme_Object *non_terminating_macro_symbol; -static Scheme_Object *dispatch_macro_symbol; -static Scheme_Object *honu_comma; -static Scheme_Object *honu_semicolon; -static Scheme_Object *honu_parens; -static Scheme_Object *honu_braces; -static Scheme_Object *honu_brackets; -static Scheme_Object *honu_angles; +ROSYM static Scheme_Object *quote_symbol; +ROSYM static Scheme_Object *quasiquote_symbol; +ROSYM static Scheme_Object *unquote_symbol; +ROSYM static Scheme_Object *unquote_splicing_symbol; +ROSYM static Scheme_Object *syntax_symbol; +ROSYM static Scheme_Object *unsyntax_symbol; +ROSYM static Scheme_Object *unsyntax_splicing_symbol; +ROSYM static Scheme_Object *quasisyntax_symbol; +ROSYM static Scheme_Object *paren_shape_symbol; +ROSYM static Scheme_Object *terminating_macro_symbol; +ROSYM static Scheme_Object *non_terminating_macro_symbol; +ROSYM static Scheme_Object *dispatch_macro_symbol; +ROSYM static Scheme_Object *honu_comma; +ROSYM static Scheme_Object *honu_semicolon; +ROSYM static Scheme_Object *honu_parens; +ROSYM static Scheme_Object *honu_braces; +ROSYM static Scheme_Object *honu_brackets; +ROSYM static Scheme_Object *honu_angles; /* For matching angle brackets in Honu mode: */ -static Scheme_Object *honu_angle_open; -static Scheme_Object *honu_angle_close; +ROSYM static Scheme_Object *honu_angle_open; +ROSYM static Scheme_Object *honu_angle_close; /* For recoginizing unresolved hash tables and commented-out graph introductions: */ -static Scheme_Object *unresolved_uninterned_symbol; -static Scheme_Object *tainted_uninterned_symbol; +ROSYM static Scheme_Object *unresolved_uninterned_symbol; +ROSYM static Scheme_Object *tainted_uninterned_symbol; /* local function prototypes */ static Scheme_Object *read_case_sensitive(int, Scheme_Object *[]); diff --git a/src/mzscheme/src/regexp.c b/src/mzscheme/src/regexp.c index 7edc7336b5..19e9118afd 100644 --- a/src/mzscheme/src/regexp.c +++ b/src/mzscheme/src/regexp.c @@ -1962,7 +1962,7 @@ regranges(int parse_flags, int at_start) } } -static char *prop_names[] = { "Cn", +READ_ONLY static const char *prop_names[] = { "Cn", "Cc", "Cf", "Cs", diff --git a/src/mzscheme/src/schexn.h b/src/mzscheme/src/schexn.h index dfe3e513f5..c9c5439a8f 100644 --- a/src/mzscheme/src/schexn.h +++ b/src/mzscheme/src/schexn.h @@ -31,7 +31,7 @@ enum { #define MZEXN_MAXARGS 3 #ifdef GLOBAL_EXN_ARRAY -static exn_rec exn_table[] = { +READ_ONLY static exn_rec exn_table[] = { { 2, NULL, NULL, 0, NULL, -1 }, { 2, NULL, NULL, 0, NULL, 0 }, { 2, NULL, NULL, 0, NULL, 1 }, @@ -54,7 +54,7 @@ static exn_rec exn_table[] = { { 3, NULL, NULL, 0, NULL, 0 } }; #else -static exn_rec *exn_table; +READ_ONLY static exn_rec *exn_table; #endif #endif @@ -88,11 +88,11 @@ static exn_rec *exn_table; #endif #ifdef _MZEXN_DECL_FIELDS - static const char *MZEXN_FIELDS[2] = { "message", "continuation-marks" }; - static const char *MZEXN_FAIL_CONTRACT_VARIABLE_FIELDS[1] = { "id" }; - static const char *MZEXN_FAIL_SYNTAX_FIELDS[1] = { "exprs" }; - static const char *MZEXN_FAIL_READ_FIELDS[1] = { "srclocs" }; - static const char *MZEXN_BREAK_FIELDS[1] = { "continuation" }; + READ_ONLY static const char *MZEXN_FIELDS[2] = { "message", "continuation-marks" }; + READ_ONLY static const char *MZEXN_FAIL_CONTRACT_VARIABLE_FIELDS[1] = { "id" }; + READ_ONLY static const char *MZEXN_FAIL_SYNTAX_FIELDS[1] = { "exprs" }; + READ_ONLY static const char *MZEXN_FAIL_READ_FIELDS[1] = { "srclocs" }; + READ_ONLY static const char *MZEXN_BREAK_FIELDS[1] = { "continuation" }; #endif #ifdef _MZEXN_DECL_PROPS diff --git a/src/mzscheme/src/schpriv.h b/src/mzscheme/src/schpriv.h index db2de8db99..9d87c19064 100644 --- a/src/mzscheme/src/schpriv.h +++ b/src/mzscheme/src/schpriv.h @@ -20,6 +20,18 @@ #include "scheme.h" +#ifdef CIL_ANALYSIS +#define ROSYM __attribute__((__ROSYM__)) +#define READ_ONLY __attribute__((__READ_ONLY__)) +#define SHARED_OK __attribute__((__SHARED_OK__)) +#define HOOK_SHARED_OK __attribute__((__HOOK_SHARED_OK__)) +#else +#define ROSYM /* EMPTY */ +#define READ_ONLY /* EMPTY */ +#define SHARED_OK /* EMPTY */ +#define HOOK_SHARED_OK /* EMPTY */ +#endif + /*========================================================================*/ /* allocation and GC */ /*========================================================================*/ diff --git a/src/mzscheme/src/schuchar.inc b/src/mzscheme/src/schuchar.inc index 5a9a2f277e..cce8c10dac 100644 --- a/src/mzscheme/src/schuchar.inc +++ b/src/mzscheme/src/schuchar.inc @@ -7,17 +7,17 @@ via the scheme_uchar_find() macro in scheme.h. */ /* Character properties: */ -unsigned short *scheme_uchar_table[8192]; +READ_ONLY unsigned short *scheme_uchar_table[8192]; /* Character case mapping as index into scheme_uchar_ups, etc.: */ -unsigned char *scheme_uchar_cases_table[8192]; +READ_ONLY unsigned char *scheme_uchar_cases_table[8192]; /* Character general categories: */ -unsigned char *scheme_uchar_cats_table[8192]; +READ_ONLY unsigned char *scheme_uchar_cats_table[8192]; /* The udata... arrays are used by init_uchar_table to fill the above mappings.*/ -static unsigned short udata[] = { +READ_ONLY static unsigned short udata[] = { /* 0 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, @@ -1465,7 +1465,7 @@ static unsigned short udata[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }; -static unsigned char udata_cases[] = { +READ_ONLY static unsigned char udata_cases[] = { /* 0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -2164,7 +2164,7 @@ static unsigned char udata_cases[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -static unsigned char udata_cats[] = { +READ_ONLY static unsigned char udata_cats[] = { /* 0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -3618,7 +3618,7 @@ static unsigned char udata_cats[] = { is relative to the original character (except for combining class, of course). */ -int scheme_uchar_ups[] = { +READ_ONLY int scheme_uchar_ups[] = { 0, 0, -32, 743, 121, 0, -1, 0, -232, 0, -300, 195, 0, 0, 0, 0, 0, 0, 0, 97, 0, 0, 163, 0, 130, 0, 0, 0, 0, 56, 0, -1, -2, -79, 0, 0, 0, 0, 0, 0, 0, 0, 0, -210, -206, -205, -202, -203, @@ -3631,7 +3631,7 @@ int scheme_uchar_ups[] = { 9, 0, 0, -7205, 0, 0, 0, 0, 0, 0, 0, 0, 0, -28, 0, -16, 0, -26, 0, 0, 0, -10795, -10792, -7264, 0, 0, 0, 0, 0, -40, 0 }; -int scheme_uchar_downs[] = { +READ_ONLY int scheme_uchar_downs[] = { 0, 32, 0, 0, 0, 1, 0, -199, 0, -121, 0, 0, 210, 206, 205, 79, 202, 203, 207, 0, 211, 209, 0, 213, 0, 214, 218, 217, 219, 0, 2, 1, 0, 0, -97, -56, -130, 10795, -163, 10792, -195, 69, 71, 0, 0, 0, 0, 0, @@ -3644,7 +3644,7 @@ int scheme_uchar_downs[] = { 0, -74, -9, 0, -86, -100, -112, -128, -126, -7517, -8383, -8262, 28, 0, 16, 0, 26, 0, -10743, -3814, -10727, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0 }; -int scheme_uchar_titles[] = { +READ_ONLY int scheme_uchar_titles[] = { 0, 0, -32, 743, 121, 0, -1, 0, -232, 0, -300, 195, 0, 0, 0, 0, 0, 0, 0, 97, 0, 0, 163, 0, 130, 0, 0, 0, 0, 56, 1, 0, -1, -79, 0, 0, 0, 0, 0, 0, 0, 0, 0, -210, -206, -205, -202, -203, @@ -3657,7 +3657,7 @@ int scheme_uchar_titles[] = { 9, 0, 0, -7205, 0, 0, 0, 0, 0, 0, 0, 0, 0, -28, 0, -16, 0, -26, 0, 0, 0, -10795, -10792, -7264, 0, 0, 0, 0, 0, -40, 0 }; -int scheme_uchar_folds[] = { +READ_ONLY int scheme_uchar_folds[] = { 0, 32, 0, 775, 0, 1, 0, 0, 0, -121, -268, 0, 210, 206, 205, 79, 202, 203, 207, 0, 211, 209, 0, 213, 0, 214, 218, 217, 219, 0, 2, 1, 0, 0, -97, -56, -130, 10795, -163, 10792, -195, 69, 71, 0, 0, 0, 0, 0, @@ -3670,7 +3670,7 @@ int scheme_uchar_folds[] = { 0, -74, -9, -7173, -86, -100, -112, -128, -126, -7517, -8383, -8262, 28, 0, 16, 0, 26, 0, -10743, -3814, -10727, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0 }; -unsigned char scheme_uchar_combining_classes[] = { +READ_ONLY unsigned char scheme_uchar_combining_classes[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -3684,7 +3684,7 @@ unsigned char scheme_uchar_combining_classes[] = { 0, 0, 0, 0, 0, 0, 0, 0, 218, 224, 8, 26, 0, 0, 226 }; #define NUM_GENERAL_CATEGORIES 30 -static const char *general_category_names[] = { +READ_ONLY static const char *general_category_names[] = { "cn", "cc", "cf", @@ -3720,7 +3720,7 @@ static const char *general_category_names[] = { #define NUM_UCHAR_RANGES 430 #define URANGE_VARIES 0x40000000 -static int mapped_uchar_ranges[] = { +READ_ONLY static int mapped_uchar_ranges[] = { 0x0, 0x36f | URANGE_VARIES, 0x374, 0x375 | URANGE_VARIES, 0x37a, 0x37e | URANGE_VARIES, diff --git a/src/mzscheme/src/schustr.inc b/src/mzscheme/src/schustr.inc index 34791cec9a..51cdc9c2df 100644 --- a/src/mzscheme/src/schustr.inc +++ b/src/mzscheme/src/schustr.inc @@ -2,7 +2,7 @@ #define NUM_SPECIAL_CASINGS 104 -static int uchar_special_casings[] = { +READ_ONLY static int uchar_special_casings[] = { /* code, down len, off, up len, off, title len, off, fold len, off, final-sigma? */ 223, 1, 0, 2, 1, 2, 3, 2, 5, 0, 304, 2, 7, 1, 9, 1, 9, 2, 10, 0, @@ -110,7 +110,7 @@ static int uchar_special_casings[] = { 64279, 1, 648, 2, 649, 2, 651, 2, 653, 0 }; /* Offsets in scheme_uchar_special_casings point into here: */ -static int uchar_special_casing_data[] = { +READ_ONLY static int uchar_special_casing_data[] = { 223, 83, 83, 83, 115, 115, 115, 105, 775, 304, 105, 775, 329, 700, 78, 700, 110, 496, 74, 780, 106, 780, 912, 921, 776, 769, 953, 776, 769, 962, 931, 963, 944, 933, 776, 769, 965, 776, 769, 1415, 1333, 1362, 1333, 1410, 1381, 1410, 7830, 72, @@ -168,7 +168,7 @@ static int uchar_special_casing_data[] = { The entire utable_compose_pairs table is referenced by utable_decomp_indices to map characters to canonical decompositions. None of the [de]composition tables includes Hangol. */ -static unsigned int utable_compose_pairs[] = { +READ_ONLY static unsigned int utable_compose_pairs[] = { 0x3c0338, 0x3d0338, 0x3e0338, 0x410300, 0x410301, 0x410302, 0x410303, 0x410304, 0x410306, 0x410307, 0x410308, 0x410309, 0x41030a, 0x41030c, 0x41030f, 0x410311, 0x410323, 0x410325, 0x410328, 0x420307, 0x420323, 0x420331, 0x430301, 0x430302, @@ -410,7 +410,7 @@ static unsigned int utable_compose_pairs[] = { 0x9ef90000, 0x99a70000, 0x72350000, 0x90f10000, 0x8d770000, 0x3010000, 0xb70000, 0x3b0000, 0x2b90000, 0x3080301, 0x3130000, 0x3000000, 0x30090000, 0xc50000, 0x20020000 }; -static unsigned int utable_compose_result[] = { +READ_ONLY static unsigned int utable_compose_result[] = { 0x226e, 0x2260, 0x226f, 0xc0, 0xc1, 0xc2, 0xc3, 0x100, 0x102, 0x226, 0xc4, 0x1ea2, 0xc5, 0x1cd, 0x200, 0x202, 0x1ea0, 0x1e00, 0x104, 0x1e02, 0x1e04, 0x1e06, 0x106, 0x108, @@ -533,7 +533,7 @@ static unsigned int utable_compose_result[] = { least one is outside the BMP, so it doesn't fit in utable_compose_pairs. Negative values in utable_decomp_indices map to this table; add one to the mapped index, negate, then multiply by 2 to find the pair. */ -static unsigned int utable_compose_long_pairs[] = { +READ_ONLY static unsigned int utable_compose_long_pairs[] = { 0x27ed3, 0x0, 0x25249, 0x0, 0x233d5, 0x0, 0x2284a, 0x0, 0x21d0b, 0x0, 0x236a3, 0x0, 0x22bf1, 0x0, 0x22b0c, 0x0, 0x226d4, 0x0, 0x261da, 0x0, 0x22331, 0x0, 0x219c8, 0x0, @@ -576,7 +576,7 @@ static unsigned int utable_compose_long_pairs[] = { utable_long_compose_pairs (when the index is negative). */ #define DECOMPOSE_TABLE_SIZE 2043 -static unsigned int utable_decomp_keys[] = { +READ_ONLY static unsigned int utable_decomp_keys[] = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd9, 0xda, 0xdb, @@ -834,7 +834,7 @@ static unsigned int utable_decomp_keys[] = { 0x2fa13, 0x2fa14, 0x2fa15, 0x2fa16, 0x2fa17, 0x2fa18, 0x2fa19, 0x2fa1a, 0x2fa1b, 0x2fa1c, 0x2fa1d }; -static short utable_decomp_indices[] = { +READ_ONLY static short utable_decomp_indices[] = { 3, 4, 5, 6, 10, 12, 26, 33, 34, 35, 40, 65, 66, 67, 72, 97, 104, 105, 106, 107, 111, 144, 145, 146, @@ -1103,7 +1103,7 @@ static short utable_decomp_indices[] = { #define KOMPAT_DECOMPOSE_TABLE_SIZE 3359 -static unsigned int utable_kompat_decomp_keys[] = { +READ_ONLY static unsigned int utable_kompat_decomp_keys[] = { 0xa0, 0xa8, 0xaa, 0xaf, 0xb2, 0xb3, 0xb4, 0xb5, 0xb8, 0xb9, 0xba, 0xbc, 0xbd, 0xbe, 0x132, 0x133, 0x13f, 0x140, 0x149, 0x17f, 0x1c4, 0x1c5, 0x1c6, 0x1c7, @@ -1525,7 +1525,7 @@ static unsigned int utable_kompat_decomp_keys[] = { 0x1d7f1, 0x1d7f2, 0x1d7f3, 0x1d7f4, 0x1d7f5, 0x1d7f6, 0x1d7f7, 0x1d7f8, 0x1d7f9, 0x1d7fa, 0x1d7fb, 0x1d7fc, 0x1d7fd, 0x1d7fe, 0x1d7ff }; -static char utable_kompat_decomp_lens[] = { +READ_ONLY static char utable_kompat_decomp_lens[] = { 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 3, 3, 3, 2, 2, 2, 2, 2, 1, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, @@ -1667,7 +1667,7 @@ static char utable_kompat_decomp_lens[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; -static short utable_kompat_decomp_indices[] = { +READ_ONLY static short utable_kompat_decomp_indices[] = { 0, 1, 3, 4, 6, 7, 8, 10, 11, 13, 14, 15, 18, 21, 24, 26, 28, 30, 32, 34, 35, 38, 41, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 73, 75, 77, 79, 81, 83, @@ -1879,7 +1879,7 @@ static short utable_kompat_decomp_indices[] = { 257, 251, 13, 6, 7, 252, 253, 254, 255, 256, 257, 251, 13, 6, 7, 252, 253, 254, 255, 256, 257, 251, 13, 6, 7, 252, 253, 254, 255, 256, 257 }; -static unsigned short utable_kompat_decomp_strs[] = { +READ_ONLY static unsigned short utable_kompat_decomp_strs[] = { 0x20, 0x20, 0x308, 0x61, 0x20, 0x304, 0x32, 0x33, 0x20, 0x301, 0x3bc, 0x20, 0x327, 0x31, 0x6f, 0x31, 0x2044, 0x34, 0x31, 0x2044, 0x32, 0x33, 0x2044, 0x34, diff --git a/src/mzscheme/src/sema.c b/src/mzscheme/src/sema.c index cf682f032f..960ee3bdc3 100644 --- a/src/mzscheme/src/sema.c +++ b/src/mzscheme/src/sema.c @@ -23,7 +23,7 @@ #ifndef NO_SCHEME_THREADS -Scheme_Object *scheme_always_ready_evt; +READ_ONLY Scheme_Object *scheme_always_ready_evt; THREAD_LOCAL_DECL(Scheme_Object *scheme_system_idle_channel); static Scheme_Object *make_sema(int n, Scheme_Object **p); @@ -60,7 +60,7 @@ static int pending_break(Scheme_Thread *p); int scheme_main_was_once_suspended; THREAD_LOCAL_DECL(static Scheme_Object *system_idle_put_evt); -static Scheme_Object *thread_recv_evt; +READ_ONLY static Scheme_Object *thread_recv_evt; #ifdef MZ_PRECISE_GC static void register_traversers(void); diff --git a/src/mzscheme/src/setjmpup.c b/src/mzscheme/src/setjmpup.c index aea77c44a0..107d91c988 100644 --- a/src/mzscheme/src/setjmpup.c +++ b/src/mzscheme/src/setjmpup.c @@ -35,8 +35,8 @@ #endif #ifdef MZ_PRECISE_GC -void *(*scheme_get_external_stack_val)(void); -void (*scheme_set_external_stack_val)(void *); +HOOK_SHARED_OK void *(*scheme_get_external_stack_val)(void); +HOOK_SHARED_OK void (*scheme_set_external_stack_val)(void *); #endif #ifndef MZ_PRECISE_GC diff --git a/src/mzscheme/src/string.c b/src/mzscheme/src/string.c index 8f4b6c4499..2d7f6ea922 100644 --- a/src/mzscheme/src/string.c +++ b/src/mzscheme/src/string.c @@ -219,7 +219,7 @@ static char *mz_iconv_nl_langinfo(){ } #endif -static const char * const STRING_IS_NOT_UTF_8 = "string is not a well-formed UTF-8 encoding: "; +READ_ONLY static const char * const STRING_IS_NOT_UTF_8 = "string is not a well-formed UTF-8 encoding: "; static Scheme_Object *make_string (int argc, Scheme_Object *argv[]); static Scheme_Object *string (int argc, Scheme_Object *argv[]); @@ -333,17 +333,17 @@ static char *string_to_from_locale(int to_bytes, #define portable_isspace(x) (((x) < 128) && isspace(x)) -static Scheme_Object *sys_symbol; -static Scheme_Object *platform_3m_path, *platform_cgc_path; -static Scheme_Object *zero_length_char_string; -static Scheme_Object *zero_length_byte_string; +ROSYM static Scheme_Object *sys_symbol; +ROSYM static Scheme_Object *platform_3m_path, *platform_cgc_path; +READ_ONLY static Scheme_Object *zero_length_char_string; +READ_ONLY static Scheme_Object *zero_length_byte_string; -static Scheme_Hash_Table *putenv_str_table; +SHARED_OK static Scheme_Hash_Table *putenv_str_table; -static char *embedding_banner; +SHARED_OK static char *embedding_banner; static Scheme_Object *vers_str, *banner_str; -static Scheme_Object *complete_symbol, *continues_symbol, *aborts_symbol, *error_symbol; +READ_ONLY static Scheme_Object *complete_symbol, *continues_symbol, *aborts_symbol, *error_symbol; void scheme_init_string (Scheme_Env *env) @@ -5453,7 +5453,7 @@ void machine_details(char *buff) /***************************** Unix ***********************************/ #if (!defined(MACINTOSH_EVENTS) || defined(OS_X)) && !defined(DOS_FILE_SYSTEM) && !defined(USE_OSKIT_CONSOLE) -static char *uname_locations[] = { "/bin/uname", +READ_ONLY static char *uname_locations[] = { "/bin/uname", "/usr/bin/uname", /* The above should cover everything, but just in case... */ diff --git a/src/mzscheme/src/struct.c b/src/mzscheme/src/struct.c index 2eeaac5d08..2655e086d0 100644 --- a/src/mzscheme/src/struct.c +++ b/src/mzscheme/src/struct.c @@ -25,17 +25,32 @@ #define PROP_USE_HT_COUNT 5 /* globals */ -Scheme_Object *scheme_arity_at_least, *scheme_date; -Scheme_Object *scheme_make_arity_at_least; -Scheme_Object *scheme_source_property; -Scheme_Object *scheme_input_port_property, *scheme_output_port_property; -Scheme_Object *scheme_equal_property; -Scheme_Object *scheme_make_struct_type_proc; -Scheme_Object *scheme_current_inspector_proc; +READ_ONLY Scheme_Object *scheme_arity_at_least; +READ_ONLY Scheme_Object *scheme_date; +READ_ONLY Scheme_Object *scheme_make_arity_at_least; +READ_ONLY Scheme_Object *scheme_source_property; +READ_ONLY Scheme_Object *scheme_input_port_property; +READ_ONLY Scheme_Object *scheme_output_port_property; +READ_ONLY Scheme_Object *scheme_equal_property; +READ_ONLY Scheme_Object *scheme_make_struct_type_proc; +READ_ONLY Scheme_Object *scheme_current_inspector_proc; +READ_ONLY Scheme_Object *scheme_recur_symbol; +READ_ONLY Scheme_Object *scheme_display_symbol; +READ_ONLY Scheme_Object *scheme_write_special_symbol; + +READ_ONLY static Scheme_Object *location_struct; +READ_ONLY static Scheme_Object *write_property; +READ_ONLY static Scheme_Object *evt_property; +READ_ONLY static Scheme_Object *proc_property; +READ_ONLY static Scheme_Object *rename_transformer_property; +READ_ONLY static Scheme_Object *set_transformer_property; +READ_ONLY static Scheme_Object *not_free_id_symbol; +READ_ONLY static Scheme_Object *scheme_checked_proc_property; +ROSYM static Scheme_Object *ellipses_symbol; +ROSYM static Scheme_Object *prefab_symbol; /* locals */ -Scheme_Object *location_struct; typedef enum { SCHEME_CONSTR = 1, @@ -109,15 +124,10 @@ static Scheme_Object *make_name(const char *pre, const char *tn, int tnl, const static void get_struct_type_info(int argc, Scheme_Object *argv[], Scheme_Object **a, int always); -static Scheme_Object *write_property; -Scheme_Object *scheme_recur_symbol, *scheme_display_symbol, *scheme_write_special_symbol; -static Scheme_Object *evt_property; static int evt_struct_is_ready(Scheme_Object *o, Scheme_Schedule_Info *sinfo); static int is_evt_struct(Scheme_Object *); -static Scheme_Object *proc_property; - static int wrapped_evt_is_ready(Scheme_Object *o, Scheme_Schedule_Info *sinfo); static int nack_guard_evt_is_ready(Scheme_Object *o, Scheme_Schedule_Info *sinfo); static int nack_evt_is_ready(Scheme_Object *o, Scheme_Schedule_Info *sinfo); @@ -137,11 +147,6 @@ static Scheme_Object *exn_source_get(int argc, Scheme_Object **argv); static Scheme_Object *procedure_extract_target(int argc, Scheme_Object **argv); -static Scheme_Object *rename_transformer_property; -static Scheme_Object *set_transformer_property; -static Scheme_Object *not_free_id_symbol; -static Scheme_Object *scheme_checked_proc_property; - #ifdef MZ_PRECISE_GC static void register_traversers(void); #endif @@ -156,8 +161,6 @@ static Scheme_Object *make_prefab_key(Scheme_Struct_Type *type); #define BUILTIN_STRUCT_FLAGS SCHEME_STRUCT_EXPTIME | SCHEME_STRUCT_NO_SET #define LOC_STRUCT_FLAGS BUILTIN_STRUCT_FLAGS | SCHEME_STRUCT_NO_SET -static Scheme_Object *ellipses_symbol, *prefab_symbol; - #define TYPE_NAME(base, blen) make_name("struct:", base, blen, "", NULL, 0, "", 1) #define CSTR_NAME(base, blen) make_name("make-", base, blen, "", NULL, 0, "", 1) #define PRED_NAME(base, blen) make_name("", base, blen, "?", NULL, 0, "", 1) @@ -188,13 +191,13 @@ scheme_init_struct (Scheme_Env *env) int i; Scheme_Object *guard; - static const char *arity_fields[1] = { "value" }; + READ_ONLY static const char *arity_fields[1] = { "value" }; #ifdef TIME_SYNTAX - static const char *date_fields[10] = { "second", "minute", "hour", + READ_ONLY static const char *date_fields[10] = { "second", "minute", "hour", "day", "month", "year", "week-day", "year-day", "dst?", "time-zone-offset" }; #endif - static const char *location_fields[10] = { "source", "line", "column", "position", "span" }; + READ_ONLY static const char *location_fields[10] = { "source", "line", "column", "position", "span" }; #ifdef MZ_PRECISE_GC register_traversers(); diff --git a/src/mzscheme/src/stxobj.c b/src/mzscheme/src/stxobj.c index 4d59b8dda4..ba28392ccb 100644 --- a/src/mzscheme/src/stxobj.c +++ b/src/mzscheme/src/stxobj.c @@ -37,7 +37,30 @@ In addition, the need to marshal syntax objects to bytecode introduces some other complications. */ -static Scheme_Object *scheme_datum_to_syntax_proc; +READ_ONLY static Scheme_Object *scheme_datum_to_syntax_proc; +ROSYM static Scheme_Object *source_symbol; /* uninterned! */ +ROSYM static Scheme_Object *share_symbol; /* uninterned! */ +ROSYM static Scheme_Object *origin_symbol; +ROSYM static Scheme_Object *lexical_symbol; +ROSYM static Scheme_Object *protected_symbol; +ROSYM static Scheme_Object *nominal_id_symbol; + +READ_ONLY static Scheme_Stx_Srcloc *empty_srcloc; +READ_ONLY static Scheme_Object *empty_simplified; +READ_ONLY static Scheme_Object *no_nested_inactive_certs; +READ_ONLY static Scheme_Object *no_nested_active_certs; +READ_ONLY static Scheme_Object *no_nested_certs; + +THREAD_LOCAL_DECL(static Scheme_Object *nominal_ipair_cache); +THREAD_LOCAL_DECL(static Scheme_Object *mark_id); +THREAD_LOCAL_DECL(static Scheme_Object *current_rib_timestamp); +THREAD_LOCAL_DECL(static Scheme_Hash_Table *quick_hash_table); +THREAD_LOCAL_DECL(static Scheme_Object *last_phase_shift); +THREAD_LOCAL_DECL(static Scheme_Object *unsealed_dependencies); +THREAD_LOCAL_DECL(static Scheme_Hash_Table *id_marks_ht); /* a cache */ +THREAD_LOCAL_DECL(static Scheme_Hash_Table *than_id_marks_ht); /* a cache */ +THREAD_LOCAL_DECL(static Scheme_Bucket_Table *interned_skip_ribs); + static Scheme_Object *syntax_p(int argc, Scheme_Object **argv); @@ -75,36 +98,6 @@ static Scheme_Object *lift_inactive_certs(Scheme_Object *o, int as_active); static Scheme_Object *write_free_id_info_prefix(Scheme_Object *obj); static Scheme_Object *read_free_id_info_prefix(Scheme_Object *obj, Scheme_Object *insp); -static Scheme_Object *source_symbol; /* uninterned! */ -static Scheme_Object *share_symbol; /* uninterned! */ -static Scheme_Object *origin_symbol; -static Scheme_Object *lexical_symbol; -static Scheme_Object *protected_symbol; -static Scheme_Object *nominal_id_symbol; - -THREAD_LOCAL_DECL(static Scheme_Object *nominal_ipair_cache); - -THREAD_LOCAL_DECL(static Scheme_Object *mark_id); -THREAD_LOCAL_DECL(static Scheme_Object *current_rib_timestamp); - -static Scheme_Stx_Srcloc *empty_srcloc; - -static Scheme_Object *empty_simplified; - -THREAD_LOCAL_DECL(static Scheme_Hash_Table *quick_hash_table); - -THREAD_LOCAL_DECL(static Scheme_Object *last_phase_shift); - -THREAD_LOCAL_DECL(static Scheme_Object *unsealed_dependencies); - -THREAD_LOCAL_DECL(static Scheme_Hash_Table *id_marks_ht); /* a cache */ -THREAD_LOCAL_DECL(static Scheme_Hash_Table *than_id_marks_ht); /* a cache */ - -THREAD_LOCAL_DECL(static Scheme_Bucket_Table *interned_skip_ribs); - -static Scheme_Object *no_nested_inactive_certs; -static Scheme_Object *no_nested_active_certs; -static Scheme_Object *no_nested_certs; #ifdef MZ_PRECISE_GC static void register_traversers(void); diff --git a/src/mzscheme/src/symbol.c b/src/mzscheme/src/symbol.c index af9bd2d727..d3dab00073 100644 --- a/src/mzscheme/src/symbol.c +++ b/src/mzscheme/src/symbol.c @@ -48,12 +48,12 @@ extern MZ_DLLIMPORT void (*GC_custom_finalize)(void); extern int GC_is_marked(void *); #endif -Scheme_Hash_Table *scheme_symbol_table = NULL; -Scheme_Hash_Table *scheme_keyword_table = NULL; -Scheme_Hash_Table *scheme_parallel_symbol_table = NULL; +SHARED_OK Scheme_Hash_Table *scheme_symbol_table = NULL; +SHARED_OK Scheme_Hash_Table *scheme_keyword_table = NULL; +SHARED_OK Scheme_Hash_Table *scheme_parallel_symbol_table = NULL; #ifdef MZ_USE_PLACES -mzrt_rwlock *symbol_table_lock; +SHARED_OK mzrt_rwlock *symbol_table_lock; #else # define mzrt_rwlock_rdlock(l) /* empty */ # define mzrt_rwlock_wrlock(l) /* empty */ @@ -63,7 +63,8 @@ mzrt_rwlock *symbol_table_lock; unsigned long scheme_max_found_symbol_name; /* globals */ -int scheme_case_sensitive = 1; +SHARED_OK int scheme_case_sensitive = 1; +static int gensym_counter; void scheme_set_case_sensitive(int v) { scheme_case_sensitive = v; } @@ -80,7 +81,6 @@ static Scheme_Object *string_to_keyword_prim (int argc, Scheme_Object *argv[]); static Scheme_Object *keyword_to_string_prim (int argc, Scheme_Object *argv[]); static Scheme_Object *gensym(int argc, Scheme_Object *argv[]); -static int gensym_counter; /**************************************************************************/ diff --git a/src/mzscheme/src/syntax.c b/src/mzscheme/src/syntax.c index c25ee83bda..6e55a2868f 100644 --- a/src/mzscheme/src/syntax.c +++ b/src/mzscheme/src/syntax.c @@ -34,22 +34,32 @@ #include "schexpobs.h" /* globals */ -Scheme_Object *scheme_define_values_syntax, *scheme_define_syntaxes_syntax; -Scheme_Object *scheme_ref_syntax; -Scheme_Object *scheme_begin_syntax; -Scheme_Object *scheme_lambda_syntax; -Scheme_Object *scheme_compiled_void_code; -Scheme_Object scheme_undefined[1]; +READ_ONLY Scheme_Object *scheme_define_values_syntax; +READ_ONLY Scheme_Object *scheme_define_syntaxes_syntax; +READ_ONLY Scheme_Object *scheme_ref_syntax; +READ_ONLY Scheme_Object *scheme_begin_syntax; +READ_ONLY Scheme_Object *scheme_lambda_syntax; +READ_ONLY Scheme_Object *scheme_compiled_void_code; +READ_ONLY Scheme_Object scheme_undefined[1]; + +READ_ONLY Scheme_Syntax_Optimizer scheme_syntax_optimizers[_COUNT_EXPD_]; +READ_ONLY Scheme_Syntax_Resolver scheme_syntax_resolvers[_COUNT_EXPD_]; +READ_ONLY Scheme_Syntax_SFSer scheme_syntax_sfsers[_COUNT_EXPD_]; +READ_ONLY Scheme_Syntax_Validater scheme_syntax_validaters[_COUNT_EXPD_]; +READ_ONLY Scheme_Syntax_Executer scheme_syntax_executers[_COUNT_EXPD_]; +READ_ONLY Scheme_Syntax_Jitter scheme_syntax_jitters[_COUNT_EXPD_]; +READ_ONLY Scheme_Syntax_Cloner scheme_syntax_cloners[_COUNT_EXPD_]; +READ_ONLY Scheme_Syntax_Shifter scheme_syntax_shifters[_COUNT_EXPD_]; +READ_ONLY int scheme_syntax_protect_afters[_COUNT_EXPD_]; + +/* symbols */ +ROSYM static Scheme_Object *lambda_symbol; +ROSYM static Scheme_Object *letrec_values_symbol; +ROSYM static Scheme_Object *let_star_values_symbol; +ROSYM static Scheme_Object *let_values_symbol; +ROSYM static Scheme_Object *begin_symbol; +ROSYM static Scheme_Object *disappeared_binding_symbol; -Scheme_Syntax_Optimizer scheme_syntax_optimizers[_COUNT_EXPD_]; -Scheme_Syntax_Resolver scheme_syntax_resolvers[_COUNT_EXPD_]; -Scheme_Syntax_SFSer scheme_syntax_sfsers[_COUNT_EXPD_]; -Scheme_Syntax_Validater scheme_syntax_validaters[_COUNT_EXPD_]; -Scheme_Syntax_Executer scheme_syntax_executers[_COUNT_EXPD_]; -Scheme_Syntax_Jitter scheme_syntax_jitters[_COUNT_EXPD_]; -Scheme_Syntax_Cloner scheme_syntax_cloners[_COUNT_EXPD_]; -Scheme_Syntax_Shifter scheme_syntax_shifters[_COUNT_EXPD_]; -int scheme_syntax_protect_afters[_COUNT_EXPD_]; /* locals */ static Scheme_Object *lambda_syntax(Scheme_Object *form, Scheme_Comp_Env *env, Scheme_Compile_Info *rec, int drec); @@ -226,14 +236,6 @@ static Scheme_Object *read_top(Scheme_Object *obj); static Scheme_Object *write_case_lambda(Scheme_Object *obj); static Scheme_Object *read_case_lambda(Scheme_Object *obj); -/* symbols */ -static Scheme_Object *lambda_symbol; -static Scheme_Object *letrec_values_symbol; -static Scheme_Object *let_star_values_symbol; -static Scheme_Object *let_values_symbol; -static Scheme_Object *begin_symbol; -static Scheme_Object *disappeared_binding_symbol; - #ifdef MZ_PRECISE_GC static void register_traversers(void); #endif diff --git a/src/mzscheme/src/thread.c b/src/mzscheme/src/thread.c index 194b217387..acbdc0cab3 100644 --- a/src/mzscheme/src/thread.c +++ b/src/mzscheme/src/thread.c @@ -185,16 +185,10 @@ extern int GC_is_marked(void *); # endif #endif -/* On swap, put target in a static variable, instead of on the stack, - so that the swapped-out thread is less likely to have a pointer - to the target thread. */ -THREAD_LOCAL_DECL(static Scheme_Thread *swap_target); -THREAD_LOCAL_DECL(static Scheme_Object *scheduled_kills); - -Scheme_Object *scheme_parameterization_key; -Scheme_Object *scheme_exn_handler_key; -Scheme_Object *scheme_break_enabled_key; +ROSYM Scheme_Object *scheme_parameterization_key; +ROSYM Scheme_Object *scheme_exn_handler_key; +ROSYM Scheme_Object *scheme_break_enabled_key; long scheme_total_gc_time; static long start_this_gc_time, end_this_gc_time; @@ -213,16 +207,32 @@ void (*scheme_wakeup_on_input)(void *fds); int (*scheme_check_for_break)(void); void (*scheme_on_atomic_timeout)(void); +ROSYM static Scheme_Object *read_symbol, *write_symbol, *execute_symbol, *delete_symbol, *exists_symbol; +ROSYM static Scheme_Object *client_symbol, *server_symbol; + + + THREAD_LOCAL_DECL(static int do_atomic = 0); THREAD_LOCAL_DECL(static int missed_context_switch = 0); THREAD_LOCAL_DECL(static int have_activity = 0); THREAD_LOCAL_DECL(int scheme_active_but_sleeping = 0); THREAD_LOCAL_DECL(static int thread_ended_with_activity); THREAD_LOCAL_DECL(int scheme_no_stack_overflow); - THREAD_LOCAL_DECL(static int needs_sleep_cancelled); - THREAD_LOCAL_DECL(static int tls_pos = 0); +/* On swap, put target in a static variable, instead of on the stack, + so that the swapped-out thread is less likely to have a pointer + to the target thread. */ +THREAD_LOCAL_DECL(static Scheme_Thread *swap_target); +THREAD_LOCAL_DECL(static Scheme_Object *scheduled_kills); +THREAD_LOCAL_DECL(static Scheme_Object *the_nested_exn_handler); +THREAD_LOCAL_DECL(static Scheme_Object *cust_closers); +THREAD_LOCAL_DECL(static Scheme_Object *thread_swap_callbacks); +THREAD_LOCAL_DECL(static Scheme_Object *thread_swap_out_callbacks); +THREAD_LOCAL_DECL(static Scheme_Object *recycle_cell); +THREAD_LOCAL_DECL(static Scheme_Object *maybe_recycle_cell); +THREAD_LOCAL_DECL(static int recycle_cc_count); +THREAD_LOCAL_DECL(static mz_jmp_buf main_init_error_buf); #ifdef MZ_PRECISE_GC extern long GC_get_memory_use(void *c); @@ -242,22 +252,6 @@ typedef struct Thread_Cell { Scheme_Bucket_Table *vals; } Thread_Cell; -static Scheme_Object *read_symbol, *write_symbol, *execute_symbol, *delete_symbol, *exists_symbol; -static Scheme_Object *client_symbol, *server_symbol; - -THREAD_LOCAL_DECL(static Scheme_Object *the_nested_exn_handler); - -THREAD_LOCAL_DECL(static Scheme_Object *cust_closers); - -THREAD_LOCAL_DECL(static Scheme_Object *thread_swap_callbacks); -THREAD_LOCAL_DECL(static Scheme_Object *thread_swap_out_callbacks); - -THREAD_LOCAL_DECL(static Scheme_Object *recycle_cell); -THREAD_LOCAL_DECL(static Scheme_Object *maybe_recycle_cell); -THREAD_LOCAL_DECL(static int recycle_cc_count); - -THREAD_LOCAL_DECL(static mz_jmp_buf main_init_error_buf); - #ifdef MZ_PRECISE_GC /* This is a trick to get the types right. Note that the layout of the weak box is defined by the diff --git a/src/mzscheme/src/type.c b/src/mzscheme/src/type.c index 71ba0982aa..555cb45b87 100644 --- a/src/mzscheme/src/type.c +++ b/src/mzscheme/src/type.c @@ -26,17 +26,19 @@ #include "schpriv.h" #include -Scheme_Type_Reader2 *scheme_type_readers; -Scheme_Type_Writer *scheme_type_writers; -Scheme_Equal_Proc *scheme_type_equals; -Scheme_Primary_Hash_Proc *scheme_type_hash1s; -Scheme_Secondary_Hash_Proc *scheme_type_hash2s; +/* types should all be registered before invoking places */ -static char **type_names; -static Scheme_Type maxtype, allocmax; +SHARED_OK Scheme_Type_Reader2 *scheme_type_readers; +SHARED_OK Scheme_Type_Writer *scheme_type_writers; +SHARED_OK Scheme_Equal_Proc *scheme_type_equals; +SHARED_OK Scheme_Primary_Hash_Proc *scheme_type_hash1s; +SHARED_OK Scheme_Secondary_Hash_Proc *scheme_type_hash2s; + +SHARED_OK static char **type_names; +SHARED_OK static Scheme_Type maxtype, allocmax; #ifdef MEMORY_COUNTING_ON -long scheme_type_table_count; +SHARED_OK long scheme_type_table_count; #endif static void init_type_arrays() diff --git a/src/mzscheme/src/vector.c b/src/mzscheme/src/vector.c index 5d75e40780..e3643eb0f0 100644 --- a/src/mzscheme/src/vector.c +++ b/src/mzscheme/src/vector.c @@ -26,8 +26,8 @@ #include "schpriv.h" /* globals */ -Scheme_Object *scheme_vector_proc; -Scheme_Object *scheme_vector_immutable_proc; +READ_ONLY Scheme_Object *scheme_vector_proc; +READ_ONLY Scheme_Object *scheme_vector_immutable_proc; /* locals */ static Scheme_Object *vector_p (int argc, Scheme_Object *argv[]);