[pypy-commit] pypy stmgc-c7-rewindjmp: Test and fix

arigo noreply at buildbot.pypy.org
Thu Aug 14 17:29:47 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c7-rewindjmp
Changeset: r72803:7182ba694a88
Date: 2014-08-14 17:29 +0200
http://bitbucket.org/pypy/pypy/changeset/7182ba694a88/

Log:	Test and fix

diff --git a/rpython/translator/stm/inevitable.py b/rpython/translator/stm/inevitable.py
--- a/rpython/translator/stm/inevitable.py
+++ b/rpython/translator/stm/inevitable.py
@@ -20,6 +20,7 @@
     'jit_assembler_call', 'gc_writebarrier',
     'shrink_array', 'jit_stm_transaction_break_point',
     'jit_stm_should_break_transaction',
+    'threadlocalref_get', 'threadlocalref_set',
     ])
 ALWAYS_ALLOW_OPERATIONS |= set(lloperation.enum_tryfold_ops())
 
diff --git a/rpython/translator/stm/test/test_inevitable.py b/rpython/translator/stm/test/test_inevitable.py
--- a/rpython/translator/stm/test/test_inevitable.py
+++ b/rpython/translator/stm/test/test_inevitable.py
@@ -279,3 +279,16 @@
 
         res = self.interpret_inevitable(f1, [])
         assert res is None
+
+    def test_threadlocal(self):
+        from rpython.rlib.rthread import ThreadLocalReference
+        opaque_id = lltype.opaqueptr(ThreadLocalReference.OPAQUEID, "foobar")
+        X = lltype.GcStruct('X', ('foo', lltype.Signed))
+        def f1():
+            x = lltype.malloc(X)
+            llop.threadlocalref_set(lltype.Void, opaque_id, x)
+            y = llop.threadlocalref_get(lltype.Ptr(X), opaque_id)
+            return x == y
+
+        res = self.interpret_inevitable(f1, [])
+        assert res is None


More information about the pypy-commit mailing list