[pypy-commit] stmgc default: more asserts and a just-to-be-sure change that affects performance a bit
Raemi
noreply at buildbot.pypy.org
Wed Nov 6 19:49:47 CET 2013
Author: Remi Meier <remi.meier at gmail.com>
Branch:
Changeset: r546:14ac008e70a5
Date: 2013-11-06 19:49 +0100
http://bitbucket.org/pypy/stmgc/changeset/14ac008e70a5/
Log: more asserts and a just-to-be-sure change that affects performance a
bit
diff --git a/c4/stmsync.c b/c4/stmsync.c
--- a/c4/stmsync.c
+++ b/c4/stmsync.c
@@ -77,11 +77,17 @@
d->max_aborts = max_aborts;
}
+static void start_exclusivelock(void);
+static void stop_exclusivelock(void);
int stm_enter_callback_call(void)
{
int token = (thread_descriptor == NULL);
dprintf(("enter_callback_call(tok=%d)\n", token));
if (token == 1) {
+ /* acquire exclusive lock. Just to be safe...
+ XXX: remove again when sure it is not needed
+ (interaction with stop_all_other_threads()) */
+ start_exclusivelock();
stmgcpage_acquire_global_lock();
#ifdef STM_BARRIER_COUNT
static int seen = 0;
@@ -94,6 +100,7 @@
stmgc_init_nursery();
init_shadowstack();
stmgcpage_release_global_lock();
+ stop_exclusivelock();
}
BeginInevitableTransaction(0);
return token;
@@ -108,11 +115,13 @@
CommitTransaction(0);
if (token == 1) {
+ start_exclusivelock();
stmgcpage_acquire_global_lock();
done_shadowstack();
stmgc_done_nursery();
DescriptorDone();
stmgcpage_release_global_lock();
+ stop_exclusivelock();
}
}
@@ -292,6 +301,7 @@
void stm_stop_sharedlock(void)
{
+ assert(in_single_thread == NULL);
dprintf(("stm_stop_sharedlock\n"));
//assert(stmgc_nursery_hiding(thread_descriptor, 1));
int err = pthread_rwlock_unlock(&rwlock_shared);
@@ -311,6 +321,7 @@
static void stop_exclusivelock(void)
{
+ assert(in_single_thread == NULL);
dprintf(("stop_exclusivelock\n"));
int err = pthread_rwlock_unlock(&rwlock_shared);
if (err != 0)
@@ -326,6 +337,7 @@
BecomeInevitable("stop_all_other_threads");
if (!single_thread_nesting) {
+ assert(in_single_thread == NULL);
stm_start_single_thread();
for (d = stm_tx_head; d; d = d->tx_next) {
More information about the pypy-commit
mailing list