[pypy-commit] pypy stm-gc: Go through "hint" operations that are not related to stm.

arigo noreply at buildbot.pypy.org
Sun Feb 19 20:23:19 CET 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: stm-gc
Changeset: r52652:a5a9bfcc9aeb
Date: 2012-02-19 20:22 +0100
http://bitbucket.org/pypy/pypy/changeset/a5a9bfcc9aeb/

Log:	Go through "hint" operations that are not related to stm.

diff --git a/pypy/translator/stm/gcsource.py b/pypy/translator/stm/gcsource.py
--- a/pypy/translator/stm/gcsource.py
+++ b/pypy/translator/stm/gcsource.py
@@ -45,7 +45,9 @@
         for block in graph.iterblocks():
             for op in block.operations:
                 #
-                if op.opname in COPIES_POINTER:
+                if (op.opname in COPIES_POINTER or
+                        (op.opname == 'hint' and
+                         'stm_write' not in op.args[1].value)):
                     if _is_gc(op.result) and _is_gc(op.args[0]):
                         resultlist.append((op.args[0], op.result))
                         continue
diff --git a/pypy/translator/stm/test/test_gcsource.py b/pypy/translator/stm/test/test_gcsource.py
--- a/pypy/translator/stm/test/test_gcsource.py
+++ b/pypy/translator/stm/test/test_gcsource.py
@@ -2,6 +2,7 @@
 from pypy.translator.stm.gcsource import GcSource
 from pypy.objspace.flow.model import SpaceOperation, Constant
 from pypy.rpython.lltypesystem import lltype
+from pypy.rlib.jit import hint
 
 
 class X:
@@ -130,3 +131,21 @@
     v_result = gsrc.translator.graphs[0].getreturnvar()
     s = gsrc[v_result]
     assert list(s) == ['last_exc_value']
+
+def test_hint_xyz():
+    def main(n):
+        return hint(X(n), xyz=True)
+    gsrc = gcsource(main, [int])
+    v_result = gsrc.translator.graphs[0].getreturnvar()
+    s = gsrc[v_result]
+    assert len(s) == 1
+    assert list(s)[0].opname == 'malloc'
+
+def test_hint_stm_write():
+    def main(n):
+        return hint(X(n), stm_write=True)
+    gsrc = gcsource(main, [int])
+    v_result = gsrc.translator.graphs[0].getreturnvar()
+    s = gsrc[v_result]
+    assert len(s) == 1
+    assert list(s)[0].opname == 'hint'


More information about the pypy-commit mailing list