Author: Maciej Fijalkowski <fij...@gmail.com>
Branch: optresult-unroll
Changeset: r79158:ed3d726ab106
Date: 2015-08-23 17:22 +0200
http://bitbucket.org/pypy/pypy/changeset/ed3d726ab106/

Log:    fix more tests

diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizebridge.py 
b/rpython/jit/metainterp/optimizeopt/test/test_optimizebridge.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_optimizebridge.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizebridge.py
@@ -116,3 +116,6 @@
         jump(1, 3)
         """
         self.optimize(loop, bridge, expected)
+
+    def test_virtual_state_guard_needed(self):
+        pass
diff --git a/rpython/jit/metainterp/optimizeopt/unroll.py 
b/rpython/jit/metainterp/optimizeopt/unroll.py
--- a/rpython/jit/metainterp/optimizeopt/unroll.py
+++ b/rpython/jit/metainterp/optimizeopt/unroll.py
@@ -7,7 +7,7 @@
      Optimization, LoopInfo, MININT, MAXINT
 from rpython.jit.metainterp.optimizeopt.virtualstate import (
     VirtualStateConstructor, VirtualStatesCantMatch)
-from rpython.jit.metainterp.resoperation import rop, ResOperation
+from rpython.jit.metainterp.resoperation import rop, ResOperation, GuardResOp
 from rpython.jit.metainterp import compile
 
 class UnrollableOptimizer(Optimizer):
@@ -169,7 +169,13 @@
                 extra_guards = target_virtual_state.generate_guards(
                     virtual_state, jump_op.getarglist(), infos,
                     self.optimizer.cpu)
-                assert not extra_guards.extra_guards
+                patchguardop = self.optimizer.patchguardop
+                for guard in extra_guards.extra_guards:
+                    if isinstance(guard, GuardResOp):
+                        guard.rd_snapshot = patchguardop.rd_snapshot
+                        guard.rd_frame_info_list = 
patchguardop.rd_frame_info_list
+                        guard.setdescr(compile.ResumeAtPositionDescr())
+                    self.send_extra_operation(guard)
             except VirtualStatesCantMatch:
                 continue
             short_preamble = target_token.short_preamble
diff --git a/rpython/jit/metainterp/test/test_ajit.py 
b/rpython/jit/metainterp/test/test_ajit.py
--- a/rpython/jit/metainterp/test/test_ajit.py
+++ b/rpython/jit/metainterp/test/test_ajit.py
@@ -1606,7 +1606,7 @@
                 y.v = g(y.v) - y.v/y.v + lc/l[0] - 1
             return y.v
         res = self.meta_interp(f, [20], listops=True)
-        self.check_resops(getarrayitem_gc=0, getfield_gc=1)
+        self.check_resops(getarrayitem_gc_i=0, getfield_gc_i=1)
 
     def test_guard_isnull_nonnull(self):
         myjitdriver = JitDriver(greens = [], reds = ['x', 'res'])
@@ -1661,7 +1661,7 @@
             return res
         res = self.meta_interp(g, [21])
         assert res == 3 * 21
-        self.check_resops(call=1)
+        self.check_resops(call_r=1)
 
     def test_bug_optimizeopt_mutates_ops(self):
         myjitdriver = JitDriver(greens = [], reds = ['x', 'res', 'const', 'a'])
@@ -1823,7 +1823,7 @@
         assert res == 6*8 + 6**8
         self.check_trace_count(4)
         self.check_resops({'guard_class': 2, 'int_gt': 4,
-                           'getfield_gc': 4, 'guard_true': 4,
+                           'getfield_gc_i': 4, 'guard_true': 4,
                            'int_sub': 4, 'jump': 2, 'int_mul': 2,
                            'int_add': 2})
 
@@ -1866,7 +1866,7 @@
         res = self.meta_interp(g, [6, 20])
         assert res == g(6, 20)
         self.check_trace_count(8)
-        self.check_resops(getarrayitem_gc=10)
+        self.check_resops(getarrayitem_gc_i=10)
 
     def test_multiple_specialied_versions_bridge(self):
         myjitdriver = JitDriver(greens = [], reds = ['y', 'x', 'z', 'res'])
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to