From 7315bfa5544d2aa25f2796fffd32866e2e33bda2 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 14 Sep 2011 14:28:19 -0600 Subject: [PATCH] drop an unnecesary lock The recent addition of a shared table of names for shared code caused bad performance on some machines (such as Robby's) due to the lock on the table. The lock dosn't seem to be necessary for platforms where places are supported, though. --- src/racket/src/codetab.inc | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/racket/src/codetab.inc b/src/racket/src/codetab.inc index c063c30065..fb66f2dded 100644 --- a/src/racket/src/codetab.inc +++ b/src/racket/src/codetab.inc @@ -22,9 +22,12 @@ extern MZ_DLLIMPORT int GC_is_marked(void *); THREAD_LOCAL_DECL(static void **codetab_tree); THREAD_LOCAL_DECL(static int during_set); + #ifdef MZ_USE_PLACES +/* This table is shared but not locked; we rely on x86-TSO + and the fact that entries are only added (never removed) + to skip the lock: */ static void **shared_codetab_tree; -static mzrt_rwlock *shared_codetab_lock; #endif static int do_clear_symbols(void **t, uintptr_t start, int offset, uintptr_t addr, int clearing); @@ -60,9 +63,7 @@ static void *find_symbol(uintptr_t v) #ifdef MZ_USE_PLACES if (!r && shared_codetab_tree) { - mzrt_rwlock_rdlock(shared_codetab_lock); r = do_find_symbol(shared_codetab_tree, v); - mzrt_rwlock_unlock(shared_codetab_lock); } #endif @@ -99,13 +100,6 @@ void scheme_jit_add_symbol(uintptr_t start, uintptr_t end, void *value, int gc_a #ifdef MZ_USE_PLACES if (!gc_able) { - if (!shared_codetab_lock) { - /* this function will be called in the main place - before others are started, so a lazy lock creation - is ok */ - mzrt_rwlock_create(&shared_codetab_lock); - } - mzrt_rwlock_wrlock(shared_codetab_lock); if (!shared_codetab_tree) shared_codetab_tree = malloc_node(0); the_tree = shared_codetab_tree; @@ -224,12 +218,6 @@ void scheme_jit_add_symbol(uintptr_t start, uintptr_t end, void *value, int gc_a do_clear_symbols(the_tree, start, 0, 0, 0); } #endif - -#ifdef MZ_USE_PLACES - if (!gc_able) { - mzrt_rwlock_unlock(shared_codetab_lock); - } -#endif } static int do_clear_symbols(void **t, uintptr_t start, int offset, uintptr_t addr, int clearing)