[pypy-commit] pypy optresult-unroll: fix some tests

fijal noreply at buildbot.pypy.org
Tue Aug 18 18:11:48 CEST 2015


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: optresult-unroll
Changeset: r79044:b3c4f481e9c3
Date: 2015-08-18 18:11 +0200
http://bitbucket.org/pypy/pypy/changeset/b3c4f481e9c3/

Log:	fix some tests

diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
@@ -5934,17 +5934,6 @@
         self.optimize_loop(ops, expected)
 
     def test_value_proven_to_be_constant_after_two_iterations(self):
-        class FakeDescr(AbstractDescr):
-            def __init__(self, name):
-                self.name = name
-            def sort_key(self):
-                return id(self)
-            def is_integer_bounded(self):
-                return False
-
-        for n in ('inst_w_seq', 'inst_index', 'inst_w_list', 'inst_length',
-                  'inst_start', 'inst_step'):
-            self.namespace[n] = FakeDescr(n)
         ops = """
         [p0, p1, p2, p3, i4, p5, i6, p7, p8, p9, p14]
         guard_value(i4, 3) []
@@ -6082,6 +6071,8 @@
             _TYPE = llmemory.GCREF.TO
             def __eq__(self, other):
                 return other.container.intval == 1242
+            def _normalizedcontainer(self):
+                return self
         self.namespace['intobj1242'] = lltype._ptr(llmemory.GCREF,
                                                    IntObj1242())
         expected = """
@@ -7233,7 +7224,6 @@
         p188 = getarrayitem_gc_r(p187, 42, descr=gcarraydescr)
         guard_value(p188, ConstPtr(myptr)) []
         p25 = getfield_gc_r(ConstPtr(myptr), descr=otherdescr)
-        call_n(123, p25, descr=nonwritedescr)
         jump(p25, p187, i184)
         """
         preamble = """
@@ -7241,7 +7231,6 @@
         p188 = getarrayitem_gc_r(p187, 42, descr=gcarraydescr)
         guard_value(p188, ConstPtr(myptr)) []
         p25 = getfield_gc_r(ConstPtr(myptr), descr=otherdescr)
-        call_n(123, p25, descr=nonwritedescr)
         jump(p25, p187, i184)
         """
         short = """
@@ -7252,9 +7241,8 @@
         jump(p25)
         """
         expected = """
-        [p25, p187, i184]
-        call_n(123, p25, descr=nonwritedescr)
-        jump(p25, p187, i184)
+        [p25, p187, i184, p189]
+        jump(p25, p187, i184, p189)
         """
         self.optimize_loop(ops, expected, preamble, expected_short=short)
 
@@ -8134,7 +8122,7 @@
         i4 = int_add(i3, i3)
         i5 = int_add(i4, i4)
         i6 = int_add(i5, i5)
-        #jump(i1, i2, i6, i3)
+        jump(i6, i3)
         """
         self.optimize_loop(ops, expected, expected_short=short)
 
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_util.py b/rpython/jit/metainterp/optimizeopt/test/test_util.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_util.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_util.py
@@ -187,6 +187,19 @@
     T = lltype.GcStruct('TUPLE',
                         ('c', lltype.Signed),
                         ('d', lltype.Ptr(lltype.GcArray(lltype.Ptr(NODE)))))
+
+    W_ROOT = lltype.GcStruct('W_ROOT', ('parent', OBJECT),
+        ('inst_w_seq', llmemory.GCREF), ('inst_index', lltype.Signed),
+        ('inst_w_list', llmemory.GCREF), ('inst_length', lltype.Signed),
+        ('inst_start', lltype.Signed), ('inst_step', lltype.Signed))
+    inst_w_seq = cpu.fielddescrof(W_ROOT, 'inst_w_seq')
+    inst_index = cpu.fielddescrof(W_ROOT, 'inst_index')
+    inst_length = cpu.fielddescrof(W_ROOT, 'inst_length')
+    inst_start = cpu.fielddescrof(W_ROOT, 'inst_start')
+    inst_step = cpu.fielddescrof(W_ROOT, 'inst_step')
+    inst_w_list = cpu.fielddescrof(W_ROOT, 'inst_w_list')
+    w_root_vtable = lltype.malloc(OBJECT_VTABLE, immortal=True)
+    
     tsize = cpu.sizeof(T, False)
     cdescr = cpu.fielddescrof(T, 'c')
     ddescr = cpu.fielddescrof(T, 'd')
@@ -339,6 +352,7 @@
     register_known_gctype(cpu, intobj_noimmut_vtable, INTOBJ_NOIMMUT)
     register_known_gctype(cpu, intobj_immut_vtable,   INTOBJ_IMMUT)
     register_known_gctype(cpu, ptrobj_immut_vtable,   PTROBJ_IMMUT)
+    register_known_gctype(cpu, w_root_vtable, W_ROOT)
 
     namespace = locals()
 


More information about the pypy-commit mailing list