[pypy-commit] pypy value-classes: Add test for case of Virtual/ConstPtr (failing currently)

sbauman pypy.commits at gmail.com
Tue Sep 27 21:21:15 EDT 2016


Author: Spenser Bauman <sabauma at gmail.com>
Branch: value-classes
Changeset: r87427:b4954bdf7ddc
Date: 2016-09-27 21:20 -0400
http://bitbucket.org/pypy/pypy/changeset/b4954bdf7ddc/

Log:	Add test for case of Virtual/ConstPtr (failing currently)

diff --git a/rpython/jit/metainterp/test/test_virtual.py b/rpython/jit/metainterp/test/test_virtual.py
--- a/rpython/jit/metainterp/test/test_virtual.py
+++ b/rpython/jit/metainterp/test/test_virtual.py
@@ -1044,6 +1044,35 @@
 
         self.meta_interp(f, [])
 
+    def test_avoid_preamble_3(self):
+        driver = JitDriver(greens=[], reds=['i', 'val'])
+        class X(object):
+            _value_class_ = True
+            def __init__(self, v):
+                self.v = v
+
+        const = X(5)
+        def f():
+            # Prevent all retracing of side exits. Ensures that the unroll
+            # optimizer will attempt to jump to either the preamble or loop.
+            set_param(driver, 'retrace_limit', -1)
+            set_param(driver, 'threshold', 1)
+            val   = X(0)
+            i     = 0
+            while i < 17:
+                driver.can_enter_jit(i=i, val=val)
+                driver.jit_merge_point(i=i, val=val)
+                # Logical & rather than comparison to confuse range analysis.
+                # Test only succeeds on the first 2 iterations
+                if i & -2 == 0:
+                    val = X(i)
+                else:
+                    val = const
+                i += 1
+            return 0
+
+        self.meta_interp(f, [])
+
     def test_aliased_virtual_states(self):
         # All cases are covered when forcing one component of the virtual state
         # also forces an as yet unseen component.


More information about the pypy-commit mailing list