Author: Armin Rigo <[email protected]>
Branch: stmgc-c4
Changeset: r66908:f2c9e61af458
Date: 2013-09-11 19:56 +0200
http://bitbucket.org/pypy/pypy/changeset/f2c9e61af458/
Log: import stmgc/983af03354a5
diff --git a/rpython/translator/stm/src_stm/et.c
b/rpython/translator/stm/src_stm/et.c
--- a/rpython/translator/stm/src_stm/et.c
+++ b/rpython/translator/stm/src_stm/et.c
@@ -983,6 +983,13 @@
stm_thread_local_obj = d->old_thread_local_obj;
d->old_thread_local_obj = NULL;
+ // notifies the CPU that we're potentially in a spin loop
+ SpinLoop(SPLP_ABORT);
+
+ /* make the transaction no longer active */
+ d->active = 0;
+ d->atomic = 0;
+
/* release the lock */
spinlock_release(d->public_descriptor->collection_lock);
@@ -1004,11 +1011,7 @@
if (num != ABRT_MANUAL && d->max_aborts >= 0 && !d->max_aborts--)
stm_fatalerror("unexpected abort!\n");
- // notifies the CPU that we're potentially in a spin loop
- SpinLoop(SPLP_ABORT);
// jump back to the setjmp_buf (this call does not return)
- d->active = 0;
- d->atomic = 0;
stm_stop_sharedlock();
longjmp(*d->setjmp_buf, 1);
}
diff --git a/rpython/translator/stm/src_stm/extra.c
b/rpython/translator/stm/src_stm/extra.c
--- a/rpython/translator/stm/src_stm/extra.c
+++ b/rpython/translator/stm/src_stm/extra.c
@@ -49,12 +49,16 @@
void stm_invoke_callbacks_on_abort(struct tx_descriptor *d)
{
wlog_t *item;
+ assert(d->active == 0);
+
G2L_LOOP_FORWARD(d->callbacks_on_abort, item) {
void *key = (void *)item->addr;
void (*callback)(void *) = (void(*)(void *))item->val;
assert(key != NULL);
assert(callback != NULL);
+ /* The callback may call stm_call_on_abort(key, NULL).
+ It is ignored, because we're no longer active. */
callback(key);
} G2L_LOOP_END;
diff --git a/rpython/translator/stm/src_stm/revision
b/rpython/translator/stm/src_stm/revision
--- a/rpython/translator/stm/src_stm/revision
+++ b/rpython/translator/stm/src_stm/revision
@@ -1,1 +1,1 @@
-698910c9edc3
+983af03354a5
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit