[pypy-commit] pypy celldict-versions: a test that a global read of a non-written global takes only a guard_not_invalidated

cfbolz noreply at buildbot.pypy.org
Mon Jul 4 16:52:32 CEST 2011


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: celldict-versions
Changeset: r45338:6b534032e588
Date: 2011-07-04 15:59 +0200
http://bitbucket.org/pypy/pypy/changeset/6b534032e588/

Log:	a test that a global read of a non-written global takes only a
	guard_not_invalidated

diff --git a/pypy/module/pypyjit/test_pypy_c/test_misc.py b/pypy/module/pypyjit/test_pypy_c/test_misc.py
--- a/pypy/module/pypyjit/test_pypy_c/test_misc.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_misc.py
@@ -232,3 +232,19 @@
             return total
         #
         self.run_and_check(main, [])
+
+
+    def test_global(self):
+        log = self.run("""
+        i = 0
+        globalinc = 1
+        def main(n):
+            global i
+            while i < n:
+                l = globalinc # ID: globalread
+                i += l
+        """, [1000])
+
+        loop, = log.loops_by_id("globalread", is_entry_bridge=True)
+        op, = loop.ops_by_id("globalread")
+        assert op.name == "guard_not_invalidated"


More information about the pypy-commit mailing list