From a6c1b9256e43d837870617c932a028ccaf9bfe0e Mon Sep 17 00:00:00 2001 From: Kevin Tew Date: Fri, 22 Jan 2010 23:32:32 +0000 Subject: [PATCH] Places added place local module path table for uninterned symbols svn: r17774 --- src/mzscheme/include/schthread.h | 2 ++ src/mzscheme/src/module.c | 33 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/mzscheme/include/schthread.h b/src/mzscheme/include/schthread.h index 5d53e414b8..1426d83959 100644 --- a/src/mzscheme/include/schthread.h +++ b/src/mzscheme/include/schthread.h @@ -260,6 +260,7 @@ typedef struct Thread_Local_Variables { int gensym_counter_; Scheme_Object *dummy_input_port_; Scheme_Object *dummy_output_port_; + Scheme_Bucket_Table *place_local_modpath_table_; /*KPLAKE1*/ } Thread_Local_Variables; @@ -505,6 +506,7 @@ XFORM_GC_VARIABLE_STACK_THROUGH_THREAD_LOCAL; #define gensym_counter XOA (scheme_get_thread_local_variables()->gensym_counter_) #define dummy_input_port XOA (scheme_get_thread_local_variables()->dummy_input_port_) #define dummy_output_port XOA (scheme_get_thread_local_variables()->dummy_output_port_) +#define place_local_modpath_table XOA (scheme_get_thread_local_variables()->place_local_modpath_table_) /*KPLAKE2*/ /* **************************************** */ diff --git a/src/mzscheme/src/module.c b/src/mzscheme/src/module.c index 119ec66cbb..f8f526d521 100644 --- a/src/mzscheme/src/module.c +++ b/src/mzscheme/src/module.c @@ -199,6 +199,9 @@ 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); +#if defined(MZ_USE_PLACES) && defined(MZ_PRECISE_GC) +THREAD_LOCAL_DECL(static Scheme_Bucket_Table *place_local_modpath_table); +#endif /* FIXME eventually theses initial objects should be shared, but work required */ THREAD_LOCAL_DECL(static Scheme_Env *initial_modules_env); @@ -408,6 +411,10 @@ void scheme_init_module_resolver(void) REGISTER_SO(starts_table); starts_table = scheme_make_weak_equal_table(); +#if defined(MZ_USE_PLACES) && defined(MZ_PRECISE_GC) + REGISTER_SO(place_local_modpath_table); + place_local_modpath_table = scheme_make_weak_equal_table(); +#endif config = scheme_current_config(); @@ -2870,10 +2877,36 @@ Scheme_Object *scheme_intern_resolved_module_path_worker(Scheme_Object *o) return return_value; } +#if defined(MZ_USE_PLACES) && defined(MZ_PRECISE_GC) +static Scheme_Object *scheme_intern_local_resolved_module_path_worker(Scheme_Object *o) +{ + Scheme_Object *rmp; + Scheme_Bucket *b; + Scheme_Object *return_value; + + rmp = scheme_alloc_small_object(); + rmp->type = scheme_resolved_module_path_type; + SCHEME_PTR_VAL(rmp) = o; + + scheme_start_atomic(); + b = scheme_bucket_from_table(place_local_modpath_table, (const char *)rmp); + scheme_end_atomic_no_swap(); + if (!b->val) + b->val = scheme_true; + + return_value = (Scheme_Object *)HT_EXTRACT_WEAK(b->key); + + return return_value; +} +#endif + Scheme_Object *scheme_intern_resolved_module_path(Scheme_Object *o) { #if defined(MZ_USE_PLACES) && defined(MZ_PRECISE_GC) void *return_payload; + if (SCHEME_SYMBOLP(o) && SCHEME_SYM_UNINTERNEDP(o)) { + return scheme_intern_local_resolved_module_path_worker(o); + } return_payload = scheme_master_fast_path(1, o); return (Scheme_Object*) return_payload; #endif