[pypy-commit] pypy stm: begin_inevitable_transaction.
arigo
noreply at buildbot.pypy.org
Fri Oct 28 18:30:53 CEST 2011
Author: Armin Rigo <arigo at tunes.org>
Branch: stm
Changeset: r48573:f0ea7da7446e
Date: 2011-10-28 12:21 +0200
http://bitbucket.org/pypy/pypy/changeset/f0ea7da7446e/
Log: begin_inevitable_transaction.
diff --git a/pypy/translator/c/funcgen.py b/pypy/translator/c/funcgen.py
--- a/pypy/translator/c/funcgen.py
+++ b/pypy/translator/c/funcgen.py
@@ -598,6 +598,7 @@
OP_STM_SETFIELD = _OP_STM
OP_STM_BEGIN_TRANSACTION = _OP_STM
OP_STM_COMMIT_TRANSACTION = _OP_STM
+ OP_STM_BEGIN_INEVITABLE_TRANSACTION = _OP_STM
def OP_PTR_NONZERO(self, op):
diff --git a/pypy/translator/stm/funcgen.py b/pypy/translator/stm/funcgen.py
--- a/pypy/translator/stm/funcgen.py
+++ b/pypy/translator/stm/funcgen.py
@@ -90,6 +90,9 @@
def stm_commit_transaction(funcgen, op):
return 'stm_commit_transaction();'
+def stm_begin_inevitable_transaction(funcgen, op):
+ return 'stm_begin_inevitable_transaction();'
+
def op_stm(funcgen, op):
assert funcgen.db.translator.stm_transformation_applied
diff --git a/pypy/translator/stm/rstm.py b/pypy/translator/stm/rstm.py
--- a/pypy/translator/stm/rstm.py
+++ b/pypy/translator/stm/rstm.py
@@ -87,6 +87,10 @@
"NOT_RPYTHON. For tests only"
raise NotImplementedError("hard to really emulate")
+def begin_inevitable_transaction():
+ "NOT_RPYTHON. For tests only, and at start up, but not in normal code."
+ raise NotImplementedError("hard to really emulate")
+
def transaction_boundary():
"NOT_RPYTHON. This is the one normally used"
raise NotImplementedError("hard to really emulate")
@@ -127,7 +131,8 @@
class ExtEntry(ExtRegistryEntry):
- _about_ = (begin_transaction, commit_transaction, transaction_boundary)
+ _about_ = (begin_transaction, commit_transaction,
+ begin_inevitable_transaction, transaction_boundary)
def compute_result_annotation(self):
return None
diff --git a/pypy/translator/stm/src_stm/et.c b/pypy/translator/stm/src_stm/et.c
--- a/pypy/translator/stm/src_stm/et.c
+++ b/pypy/translator/stm/src_stm/et.c
@@ -762,6 +762,10 @@
if (bool_cas(&global_timestamp, curtime, curtime + 1))
break;
}
+#ifdef RPY_ASSERT
+ assert(!d->transaction_active);
+ d->transaction_active = 1;
+#endif
d->setjmp_buf = NULL;
d->start_time = curtime;
#ifdef COMMIT_OTHER_INEV
diff --git a/pypy/translator/stm/test/test_transform.py b/pypy/translator/stm/test/test_transform.py
--- a/pypy/translator/stm/test/test_transform.py
+++ b/pypy/translator/stm/test/test_transform.py
@@ -72,3 +72,11 @@
return 0
t, cbuilder = self.compile(simplefunc)
cbuilder.cmdexec('', expect_crash=True)
+
+ def test_begin_inevitable_transaction(self):
+ def simplefunc(argv):
+ rstm.begin_inevitable_transaction()
+ rstm.commit_transaction()
+ return 0
+ t, cbuilder = self.compile(simplefunc)
+ cbuilder.cmdexec('')
More information about the pypy-commit
mailing list