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.
This commit is contained in:
parent
bbb38c0ff9
commit
7315bfa554
|
@ -22,9 +22,12 @@ extern MZ_DLLIMPORT int GC_is_marked(void *);
|
||||||
|
|
||||||
THREAD_LOCAL_DECL(static void **codetab_tree);
|
THREAD_LOCAL_DECL(static void **codetab_tree);
|
||||||
THREAD_LOCAL_DECL(static int during_set);
|
THREAD_LOCAL_DECL(static int during_set);
|
||||||
|
|
||||||
#ifdef MZ_USE_PLACES
|
#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 void **shared_codetab_tree;
|
||||||
static mzrt_rwlock *shared_codetab_lock;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int do_clear_symbols(void **t, uintptr_t start, int offset, uintptr_t addr, int clearing);
|
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
|
#ifdef MZ_USE_PLACES
|
||||||
if (!r && shared_codetab_tree) {
|
if (!r && shared_codetab_tree) {
|
||||||
mzrt_rwlock_rdlock(shared_codetab_lock);
|
|
||||||
r = do_find_symbol(shared_codetab_tree, v);
|
r = do_find_symbol(shared_codetab_tree, v);
|
||||||
mzrt_rwlock_unlock(shared_codetab_lock);
|
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
#ifdef MZ_USE_PLACES
|
||||||
if (!gc_able) {
|
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)
|
if (!shared_codetab_tree)
|
||||||
shared_codetab_tree = malloc_node(0);
|
shared_codetab_tree = malloc_node(0);
|
||||||
the_tree = shared_codetab_tree;
|
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);
|
do_clear_symbols(the_tree, start, 0, 0, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#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)
|
static int do_clear_symbols(void **t, uintptr_t start, int offset, uintptr_t addr, int clearing)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user