[pypy-commit] stmgc default: merge heads
arigo
noreply at buildbot.pypy.org
Thu Nov 5 13:02:21 EST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r1968:72facb6e4533
Date: 2015-11-05 19:03 +0100
http://bitbucket.org/pypy/stmgc/changeset/72facb6e4533/
Log: merge heads
diff --git a/c8/stm/core.c b/c8/stm/core.c
--- a/c8/stm/core.c
+++ b/c8/stm/core.c
@@ -1374,6 +1374,8 @@
from its segment. Better do it as soon as possible, because
other threads might be spin-looping, waiting for the -1 to
disappear. */
+ /* but first, emit commit-event of this thread: */
+ timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_COMMIT);
STM_SEGMENT->running_thread = NULL;
write_fence();
assert(_stm_detached_inevitable_from_thread == -1);
diff --git a/c8/stm/detach.c b/c8/stm/detach.c
--- a/c8/stm/detach.c
+++ b/c8/stm/detach.c
@@ -127,6 +127,7 @@
// XXX: not sure if the next line is a good idea
tl->last_associated_segment_num = remote_seg_num;
ensure_gs_register(remote_seg_num);
+ timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_REATTACH);
commit_external_inevitable_transaction();
}
dprintf(("reattach_transaction: start a new transaction\n"));
@@ -185,6 +186,7 @@
assert(segnum > 0);
ensure_gs_register(segnum);
+ timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_REATTACH);
commit_external_inevitable_transaction();
ensure_gs_register(mysegnum);
}
diff --git a/c8/stm/finalizer.c b/c8/stm/finalizer.c
--- a/c8/stm/finalizer.c
+++ b/c8/stm/finalizer.c
@@ -501,7 +501,17 @@
/* XXX: become inevitable, bc. otherwise, we would need to keep
around the original g_finalizers.run_finalizers to restore it
in case of an abort. */
- _stm_become_inevitable("finalizer-Tx");
+ _stm_become_inevitable(MSG_INEV_DONT_SLEEP);
+ /* did it work? */
+ if (STM_PSEGMENT->transaction_state != TS_INEVITABLE) { /* no */
+ /* avoid blocking here, waiting for another INEV transaction.
+ If we did that, application code could not proceed (start the
+ next transaction) and it will not be obvious from the profile
+ why we were WAITing. */
+ _stm_commit_transaction();
+ stm_rewind_jmp_leaveframe(tl, &rjbuf);
+ return;
+ }
while (__sync_lock_test_and_set(&g_finalizers.lock, 1) != 0) {
/* somebody is adding more finalizers (_commit_finalizer()) */
diff --git a/c8/stmgc.h b/c8/stmgc.h
--- a/c8/stmgc.h
+++ b/c8/stmgc.h
@@ -100,8 +100,8 @@
#define _stm_detach_inevitable_transaction(tl) do { \
write_fence(); \
assert(_stm_detached_inevitable_from_thread == 0); \
- if (stmcb_timing_event != NULL) \
- {stmcb_timing_event(tl, STM_TRANSACTION_DETACH, NULL);} \
+ if (stmcb_timing_event != NULL && tl->self_or_0_if_atomic != 0) \
+ {stmcb_timing_event(tl, STM_TRANSACTION_DETACH, NULL);} \
_stm_detached_inevitable_from_thread = tl->self_or_0_if_atomic; \
} while (0)
void _stm_reattach_transaction(intptr_t);
More information about the pypy-commit
mailing list