Author: Armin Rigo <[email protected]>
Branch: stmgc-c7
Changeset: r70276:ade60393992a
Date: 2014-03-25 14:18 +0100
http://bitbucket.org/pypy/pypy/changeset/ade60393992a/
Log: import stmgc/4d330c8e6b92
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 @@
-5575626c8253
+4d330c8e6b92
diff --git a/rpython/translator/stm/src_stm/stm/core.c
b/rpython/translator/stm/src_stm/stm/core.c
--- a/rpython/translator/stm/src_stm/stm/core.c
+++ b/rpython/translator/stm/src_stm/stm/core.c
@@ -581,6 +581,16 @@
*/
struct stm_priv_segment_info_s *pseg = get_priv_segment(segment_num);
+ switch (pseg->transaction_state) {
+ case TS_REGULAR:
+ break;
+ case TS_INEVITABLE:
+ stm_fatalerror("abort: transaction_state == TS_INEVITABLE");
+ default:
+ stm_fatalerror("abort: bad transaction_state == %d",
+ (int)pseg->transaction_state);
+ }
+
/* throw away the content of the nursery */
long bytes_in_nursery = throw_away_nursery(pseg);
@@ -606,15 +616,6 @@
assert(_has_mutex());
dprintf(("~~~ ABORT\n"));
- switch (STM_PSEGMENT->transaction_state) {
- case TS_REGULAR:
- break;
- case TS_INEVITABLE:
- stm_fatalerror("abort: transaction_state == TS_INEVITABLE");
- default:
- stm_fatalerror("abort: bad transaction_state == %d",
- (int)STM_PSEGMENT->transaction_state);
- }
assert(STM_PSEGMENT->running_pthread == pthread_self());
abort_data_structures_from_segment_num(STM_SEGMENT->segment_num);
@@ -677,9 +678,10 @@
s_mutex_unlock();
}
-void stm_become_globally_unique_transaction(const char *msg)
+void stm_become_globally_unique_transaction(stm_thread_local_t *tl,
+ const char *msg)
{
- stm_become_inevitable(msg); /* may still abort */
+ stm_become_inevitable(tl, msg); /* may still abort */
s_mutex_lock();
synchronize_all_threads(STOP_OTHERS_AND_BECOME_GLOBALLY_UNIQUE);
diff --git a/rpython/translator/stm/src_stm/stm/forksupport.c
b/rpython/translator/stm/src_stm/stm/forksupport.c
--- a/rpython/translator/stm/src_stm/stm/forksupport.c
+++ b/rpython/translator/stm/src_stm/stm/forksupport.c
@@ -61,7 +61,7 @@
bool was_in_transaction = _stm_in_transaction(this_tl);
if (was_in_transaction) {
- stm_become_inevitable("fork");
+ stm_become_inevitable(this_tl, "fork");
/* Note that the line above can still fail and abort, which should
be fine */
}
@@ -191,6 +191,8 @@
#ifndef NDEBUG
pr->running_pthread = pthread_self();
#endif
+ pr->pub.running_thread->shadowstack = (
+ pr->shadowstack_at_start_of_transaction);
stm_abort_transaction();
}
}
diff --git a/rpython/translator/stm/src_stm/stmgc.h
b/rpython/translator/stm/src_stm/stmgc.h
--- a/rpython/translator/stm/src_stm/stmgc.h
+++ b/rpython/translator/stm/src_stm/stmgc.h
@@ -276,7 +276,9 @@
/* Turn the current transaction inevitable. The 'jmpbuf' passed to
STM_START_TRANSACTION() is not going to be used any more after
this call (but the stm_become_inevitable() itself may still abort). */
-static inline void stm_become_inevitable(const char* msg) {
+static inline void stm_become_inevitable(stm_thread_local_t *tl,
+ const char* msg) {
+ assert(STM_SEGMENT->running_thread == tl);
if (STM_SEGMENT->jmpbuf_ptr != NULL)
_stm_become_inevitable(msg);
}
@@ -331,7 +333,8 @@
transaction is running concurrently. Avoid as much as possible.
Other transactions will continue running only after this transaction
commits. */
-void stm_become_globally_unique_transaction(const char *msg);
+void stm_become_globally_unique_transaction(stm_thread_local_t *tl,
+ const char *msg);
/* ==================== END ==================== */
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit