Author: Armin Rigo <[email protected]>
Branch: stmgc-c7
Changeset: r69968:1b664888133d
Date: 2014-03-15 09:18 +0100
http://bitbucket.org/pypy/pypy/changeset/1b664888133d/
Log: import stmgc/7f6e7192dd38
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 @@
-3c39b8d8e184
+7f6e7192dd38
diff --git a/rpython/translator/stm/src_stm/stm/contention.c
b/rpython/translator/stm/src_stm/stm/contention.c
--- a/rpython/translator/stm/src_stm/stm/contention.c
+++ b/rpython/translator/stm/src_stm/stm/contention.c
@@ -173,8 +173,14 @@
kind! The shadowstack may not be correct here. It
should not end in a deadlock, because the target thread
is, in principle, guaranteed to call abort_with_mutex()
- very soon.
+ very soon. Just to be on the safe side, make it really
+ impossible for the target thread to later enter the same
+ cond_wait(C_ABORTED) (and thus wait, possibly for us,
+ ending in a deadlock): check again must_abort() first.
*/
+ if (must_abort())
+ abort_with_mutex();
+
dprintf(("contention: wait C_ABORTED...\n"));
cond_wait(C_ABORTED);
dprintf(("contention: done\n"));
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
@@ -12,7 +12,7 @@
void _stm_write_slowpath(object_t *obj)
{
- assert(_running_transaction());
+ assert(_seems_to_be_running_transaction());
assert(!_is_young(obj));
/* is this an object from the same transaction, outside the nursery? */
diff --git a/rpython/translator/stm/src_stm/stm/core.h
b/rpython/translator/stm/src_stm/stm/core.h
--- a/rpython/translator/stm/src_stm/stm/core.h
+++ b/rpython/translator/stm/src_stm/stm/core.h
@@ -205,7 +205,7 @@
}
static bool _is_tl_registered(stm_thread_local_t *tl);
-static bool _running_transaction(void);
+static bool _seems_to_be_running_transaction(void);
static void teardown_core(void);
static void abort_with_mutex(void) __attribute__((noreturn));
diff --git a/rpython/translator/stm/src_stm/stm/sync.c
b/rpython/translator/stm/src_stm/stm/sync.c
--- a/rpython/translator/stm/src_stm/stm/sync.c
+++ b/rpython/translator/stm/src_stm/stm/sync.c
@@ -214,7 +214,7 @@
}
__attribute__((unused))
-static bool _running_transaction(void)
+static bool _seems_to_be_running_transaction(void)
{
return (STM_SEGMENT->running_thread != NULL);
}
@@ -302,6 +302,7 @@
static void enter_safe_point_if_requested(void)
{
+ assert(_seems_to_be_running_transaction());
assert(_has_mutex());
while (1) {
if (must_abort())
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
@@ -148,6 +148,7 @@
stm_write() is called, or immediately after getting the object from
stm_allocate(), as long as the rules above are respected.
*/
+__attribute__((always_inline))
static inline void stm_read(object_t *obj)
{
((stm_read_marker_t *)(((uintptr_t)obj) >> 4))->rm =
@@ -159,6 +160,7 @@
the next one, then stm_write() needs to be called again. It is not
necessary to call it immediately after stm_allocate().
*/
+__attribute__((always_inline))
static inline void stm_write(object_t *obj)
{
if (UNLIKELY((obj->stm_flags & _STM_GCFLAG_WRITE_BARRIER) != 0))
@@ -178,6 +180,7 @@
of 8 and at least 16. In the fast-path, this is inlined to just
a few assembler instructions.
*/
+__attribute__((always_inline))
static inline object_t *stm_allocate(ssize_t size_rounded_up)
{
OPT_ASSERT(size_rounded_up >= 16);
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit