[pypy-svn] pypy out-of-line-guards: Reproduce the problem caught by test_ztranslation here. Invalidation of single

fijal commits-noreply at bitbucket.org
Tue Dec 21 13:24:15 CET 2010


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: out-of-line-guards
Changeset: r40160:1677c895cf0b
Date: 2010-12-21 14:23 +0200
http://bitbucket.org/pypy/pypy/changeset/1677c895cf0b/

Log:	Reproduce the problem caught by test_ztranslation here. Invalidation
	of single bridge

diff --git a/pypy/jit/metainterp/test_outofline.py b/pypy/jit/metainterp/test/test_outofline.py
copy from pypy/jit/metainterp/test_outofline.py
copy to pypy/jit/metainterp/test/test_outofline.py
--- a/pypy/jit/metainterp/test_outofline.py
+++ b/pypy/jit/metainterp/test/test_outofline.py
@@ -111,7 +111,36 @@
 
         assert self.meta_interp(main, []) == main()
         self.check_loop_count(4)
-        self.check_history(getfield_gc=0, getfield_gc_pure=0)        
+        self.check_history(getfield_gc=0, getfield_gc_pure=0)
+
+    def test_jit_invariant_invalidate_bridge(self):
+        class A(object):
+            _jit_invariant_fields_ = ['x']
+
+        driver = JitDriver(greens = [], reds = ['i', 'total', 'a'])
+
+        @dont_look_inside
+        def g(a, i):
+            if i == 25:
+                a.x = 2
+
+        def f():
+            i = 0
+            a = A()
+            a.x = 1
+            total = 0
+            while i < 40:
+                driver.can_enter_jit(i=i, total=total, a=a)
+                driver.jit_merge_point(i=i, total=total, a=a)
+                i += 1
+                a = hint(a, promote=True)
+                if i % 2:
+                    total += a.x
+                    g(a, i)
+                total += 1
+            return total
+
+        assert self.meta_interp(f, []) == f()
 
 class TestLLtype(OutOfLineTests, LLJitMixin):
     pass

diff --git a/dotviewer/graphclient.py b/dotviewer/graphclient.py
--- a/dotviewer/graphclient.py
+++ b/dotviewer/graphclient.py
@@ -127,7 +127,7 @@
 
 def spawn_local_handler():
     if hasattr(sys, 'pypy_objspaceclass'):
-        python = 'python'
+        python = '/usr/bin/python'
     else:
         python = sys.executable
     args = [python, '-u', GRAPHSERVER, '--stdio']

diff --git a/pypy/jit/metainterp/test_outofline.py b/pypy/jit/metainterp/test_outofline.py
deleted file mode 100644
--- a/pypy/jit/metainterp/test_outofline.py
+++ /dev/null
@@ -1,117 +0,0 @@
-
-from pypy.rlib.jit import JitDriver, dont_look_inside, hint
-from pypy.jit.metainterp.test.test_basic import LLJitMixin
-
-class OutOfLineTests(object):
-    def test_getfield_jit_invariant(self):
-        class A(object):
-            _jit_invariant_fields_ = ['x']
-
-        a1 = A()
-        a1.x = 5
-        a2 = A()
-        a2.x = 8
-
-        def f(x):
-            if x:
-                a = a1
-            else:
-                a = a2
-            return a.x
-        res = self.interp_operations(f, [-3])
-        self.check_operations_history(getfield_gc = 0)
-
-    def test_setfield_jit_invariant(self):
-        class A(object):
-            _jit_invariant_fields_ = ['x']
-
-        myjitdriver = JitDriver(greens = [], reds = ['i', 'total'])
-        
-        a = A()
-
-        @dont_look_inside
-        def g(i):
-            if i == 5:
-                a.x = 2
-
-        def f():
-            a.x = 1
-            i = 0
-            total = 0
-            while i < 20:
-                myjitdriver.can_enter_jit(i=i, total=total)
-                myjitdriver.jit_merge_point(i=i, total=total)
-                g(i)
-                i += a.x
-                total += i
-            return total
-
-        assert self.meta_interp(f, []) == f()
-        self.check_loop_count(2)
-        self.check_history(getfield_gc=0, getfield_gc_pure=0)
-
-    def test_jit_invariant_bridge(self):
-        class A(object):
-            _jit_invariant_fields_ = ['x']
-
-        myjitdriver = JitDriver(greens = [], reds = ['i', 'total'])
-        
-        a = A()
-
-        @dont_look_inside
-        def g(i):
-            if i == 5:
-                a.x = 2
-
-        def f():
-            a.x = 1
-            i = 0
-            total = 0
-            while i < 40:
-                myjitdriver.can_enter_jit(i=i, total=total)
-                myjitdriver.jit_merge_point(i=i, total=total)
-                g(i)
-                i += a.x
-                if i > 18:
-                    i += 1
-                total += i
-            return total
-
-        assert self.meta_interp(f, []) == f()
-        self.check_loop_count(3)
-        self.check_history(getfield_gc=0, getfield_gc_pure=0)        
-
-    def test_jit_invariant_entry_bridge(self):
-        class A(object):
-            _jit_invariant_fields_ = ['x']
-
-        myjitdriver = JitDriver(greens = [], reds = ['i', 'total', 'a'])
-        
-        def f(a):
-            i = 0
-            total = 0
-            while i < 30:
-                myjitdriver.can_enter_jit(i=i, total=total, a=a)
-                myjitdriver.jit_merge_point(i=i, total=total, a=a)
-                a = hint(a, promote=True)
-                total += a.x
-                if i > 11:
-                    i += 1
-                i += 1
-            return total
-
-        def main():
-            total = 0
-            a = A()
-            a.x = 1
-            total += f(a)
-            a.x = 2
-            total += f(a)
-            return total
-
-        assert self.meta_interp(main, []) == main()
-        self.check_loop_count(4)
-        self.check_history(getfield_gc=0, getfield_gc_pure=0)        
-
-class TestLLtype(OutOfLineTests, LLJitMixin):
-    pass


More information about the Pypy-commit mailing list