Author: Armin Rigo <[email protected]>
Branch: stmgc-c4
Changeset: r65126:2a4c96f5318f
Date: 2013-06-30 19:59 +0200
http://bitbucket.org/pypy/pypy/changeset/2a4c96f5318f/

Log:    set_transaction_length()

diff --git a/rpython/rlib/rstm.py b/rpython/rlib/rstm.py
--- a/rpython/rlib/rstm.py
+++ b/rpython/rlib/rstm.py
@@ -12,7 +12,7 @@
         llop.stm_should_break_transaction(lltype.Bool))
 
 def set_transaction_length(length):
-    stmgcintf.StmOperations.set_transaction_length(length)
+    llop.stm_set_transaction_length(lltype.Void, length)
 
 def increment_atomic():
     stmgcintf.StmOperations.add_atomic(+1)
diff --git a/rpython/rtyper/lltypesystem/lloperation.py 
b/rpython/rtyper/lltypesystem/lloperation.py
--- a/rpython/rtyper/lltypesystem/lloperation.py
+++ b/rpython/rtyper/lltypesystem/lloperation.py
@@ -436,6 +436,7 @@
     'stm_commit_transaction': LLOp(),
     'stm_begin_inevitable_transaction': LLOp(),
     'stm_should_break_transaction': LLOp(sideeffects=False),
+    'stm_set_transaction_length': LLOp(),
 
     # __________ address operations __________
 
diff --git a/rpython/translator/c/funcgen.py b/rpython/translator/c/funcgen.py
--- a/rpython/translator/c/funcgen.py
+++ b/rpython/translator/c/funcgen.py
@@ -598,6 +598,7 @@
     OP_STM_COMMIT_TRANSACTION = _OP_STM
     OP_STM_BEGIN_INEVITABLE_TRANSACTION = _OP_STM
     OP_STM_SHOULD_BREAK_TRANSACTION = _OP_STM
+    OP_STM_SET_TRANSACTION_LENGTH = _OP_STM
 
 
     def OP_PTR_NONZERO(self, op):
diff --git a/rpython/translator/stm/funcgen.py 
b/rpython/translator/stm/funcgen.py
--- a/rpython/translator/stm/funcgen.py
+++ b/rpython/translator/stm/funcgen.py
@@ -123,6 +123,10 @@
     result = funcgen.expr(op.result)
     return '%s = stm_should_break_transaction();' % (result,)
 
+def stm_set_transaction_length(funcgen, op):
+    arg0 = funcgen.expr(op.args[0])
+    return 'stm_set_transaction_length(%s);' % (arg0,)
+
 
 def op_stm(funcgen, op):
     func = globals()[op.opname]
diff --git a/rpython/translator/stm/test/test_ztranslated.py 
b/rpython/translator/stm/test/test_ztranslated.py
--- a/rpython/translator/stm/test/test_ztranslated.py
+++ b/rpython/translator/stm/test/test_ztranslated.py
@@ -95,6 +95,14 @@
         data = cbuilder.cmdexec('')
         assert '< 1 >\n' in data
 
+    def test_set_transaction_length(self):
+        def entry_point(argv):
+            rstm.set_transaction_length(123)
+            return 0
+        t, cbuilder = self.compile(entry_point)
+        cbuilder.cmdexec('')
+        # assert did not crash
+
     def test_targetdemo(self):
         t, cbuilder = self.compile(targetdemo2.entry_point)
         data, dataerr = cbuilder.cmdexec('4 5000', err=True,
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to