Author: Alex Gaynor <alex.gay...@gmail.com>
Branch: fix-lookinside-iff-oopspec
Changeset: r59225:3e3d959713c8
Date: 2012-12-02 11:20 -0800
http://bitbucket.org/pypy/pypy/changeset/3e3d959713c8/

Log:    fix tests and oopspecs + look_inside_iff

diff --git a/pypy/jit/metainterp/test/support.py 
b/pypy/jit/metainterp/test/support.py
--- a/pypy/jit/metainterp/test/support.py
+++ b/pypy/jit/metainterp/test/support.py
@@ -10,6 +10,8 @@
 from pypy.jit.codewriter.policy import JitPolicy
 from pypy.jit.codewriter import codewriter, longlong
 from pypy.rlib.rfloat import isnan
+from pypy.translator.backendopt.all import backend_optimizations
+
 
 def _get_jitcodes(testself, CPUClass, func, values, type_system,
                   supports_longlong=False, translationoptions={}, **kwds):
@@ -68,7 +70,9 @@
     policy = JitPolicy()
     policy.set_supports_floats(True)
     policy.set_supports_longlong(supports_longlong)
-    cw.find_all_graphs(policy)
+    graphs = cw.find_all_graphs(policy)
+    if kwds.get("backendopt"):
+        backend_optimizations(rtyper.annotator.translator, graphs=graphs)
     #
     testself.warmrunnerstate = FakeWarmRunnerState()
     testself.warmrunnerstate.cpu = cpu
diff --git a/pypy/jit/metainterp/test/test_list.py 
b/pypy/jit/metainterp/test/test_list.py
--- a/pypy/jit/metainterp/test/test_list.py
+++ b/pypy/jit/metainterp/test/test_list.py
@@ -79,7 +79,7 @@
         self.check_loops(setarrayitem_gc=0, call=0)
 
     def test_vlist_with_default_read(self):
-        jitdriver = JitDriver(greens = [], reds = ['n'])
+        jitdriver = JitDriver(greens=[], reds=['n'])
         def f(n):
             l = [1] * 20
             while n > 0:
@@ -93,7 +93,7 @@
                 n -= 1
             return l[0]
 
-        res = self.meta_interp(f, [10], listops=True)
+        res = self.meta_interp(f, [10], listops=True, backendopt=True)
         assert res == f(10)
         self.check_resops(setarrayitem_gc=0, call=0, getarrayitem_gc=0)
 
diff --git a/pypy/jit/metainterp/test/test_tracingopts.py 
b/pypy/jit/metainterp/test/test_tracingopts.py
--- a/pypy/jit/metainterp/test/test_tracingopts.py
+++ b/pypy/jit/metainterp/test/test_tracingopts.py
@@ -339,7 +339,7 @@
         res = self.interp_operations(fn, [7])
         assert res == 7 + 7 + 1
         self.check_operations_history(setarrayitem_gc=2,
-                setfield_gc=2)
+                setfield_gc=0)
 
     def test_virtualizable_with_array_heap_cache(self):
         myjitdriver = jit.JitDriver(greens = [], reds = ['n', 'x', 'i', 
'frame'],
@@ -559,7 +559,7 @@
             a1 = [0] * n
             g.a = a1
             return len(a1) + res
-        res = self.interp_operations(fn, [7])
+        res = self.interp_operations(fn, [7], backendopt=True)
         assert res == 7 * 3
         self.check_operations_history(arraylen_gc=1)
 
@@ -574,7 +574,7 @@
             x = [0] * n
             x[2] = 21
             return len(a[:n]) + x[2]
-        res = self.interp_operations(fn, [3])
+        res = self.interp_operations(fn, [3], backendopt=True)
         assert res == 24
         self.check_operations_history(getarrayitem_gc=0)
 
diff --git a/pypy/rlib/jit.py b/pypy/rlib/jit.py
--- a/pypy/rlib/jit.py
+++ b/pypy/rlib/jit.py
@@ -172,6 +172,7 @@
                 else:
                     return trampoline(%(arguments)s)
             f.__name__ = func.__name__ + "_look_inside_iff"
+            f._always_inline = True
         """ % {"arguments": ", ".join(args)}).compile() in d
         return d["f"]
     return inner
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to