aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpenser Bauman <sabauma@gmail.com>2015-10-08 14:53:26 -0400
committerSpenser Bauman <sabauma@gmail.com>2015-10-08 14:53:26 -0400
commit4f82f555c5656efed051f6f4790e2764a17b29c0 (patch)
treebedf0ed20f637c583b1511aa0333e79e81042363 /rpython
parent- add a hack to check that the operation in the test and the descr both agree (diff)
downloadpypy-4f82f555c5656efed051f6f4790e2764a17b29c0.tar.gz
pypy-4f82f555c5656efed051f6f4790e2764a17b29c0.tar.bz2
pypy-4f82f555c5656efed051f6f4790e2764a17b29c0.zip
fix some more test cases
Diffstat (limited to 'rpython')
-rw-r--r--rpython/jit/metainterp/optimizeopt/pure.py6
-rw-r--r--rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py4
-rw-r--r--rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py54
-rw-r--r--rpython/jit/metainterp/optimizeopt/test/test_unroll.py6
-rw-r--r--rpython/jit/metainterp/optimizeopt/test/test_util.py2
5 files changed, 37 insertions, 35 deletions
diff --git a/rpython/jit/metainterp/optimizeopt/pure.py b/rpython/jit/metainterp/optimizeopt/pure.py
index b97e2527a5..42a957b3ca 100644
--- a/rpython/jit/metainterp/optimizeopt/pure.py
+++ b/rpython/jit/metainterp/optimizeopt/pure.py
@@ -1,3 +1,4 @@
+from rpython.rtyper.rclass import IR_QUASIIMMUTABLE
from rpython.jit.metainterp.optimizeopt.optimizer import Optimization, REMOVED
from rpython.jit.metainterp.resoperation import rop, OpHelpers, AbstractResOp,\
ResOperation
@@ -198,8 +199,9 @@ class OptPure(Optimization):
# XXX quasi immutable descrs, are they pure or not?
if not we_are_translated():
descr = op.getdescr()
- if not descr.is_always_pure():
- assert "quasiimmut" in str(descr.S._immutable_field(descr.fieldname))
+ # Kind of weird that this returns a boolean or one of the IR_*
+ # family
+ assert descr.is_always_pure() in (True, IR_QUASIIMMUTABLE)
return self.optimize_default(op)
optimize_GETFIELD_GC_PURE_R = optimize_GETFIELD_GC_PURE_I
optimize_GETFIELD_GC_PURE_F = optimize_GETFIELD_GC_PURE_I
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
index 076d5dd784..d80f5c9c0d 100644
--- a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
@@ -1531,7 +1531,7 @@ class BaseTestOptimizeBasic(BaseTestBasic):
setfield_gc(p1, i1, descr=valuedescr)
#
# some operations on which the above setfield_gc cannot have effect
- i3 = getarrayitem_gc_pure_i(p3, 1, descr=arraydescr)
+ i3 = getarrayitem_gc_i(p3, 1, descr=arraydescr)
i4 = getarrayitem_gc_i(p3, i3, descr=arraydescr)
i5 = int_add(i3, i4)
setarrayitem_gc(p3, 0, i5, descr=arraydescr)
@@ -1543,7 +1543,7 @@ class BaseTestOptimizeBasic(BaseTestBasic):
expected = """
[p1, i1, i2, p3]
#
- i3 = getarrayitem_gc_pure_i(p3, 1, descr=arraydescr)
+ i3 = getarrayitem_gc_i(p3, 1, descr=arraydescr)
i4 = getarrayitem_gc_i(p3, i3, descr=arraydescr)
i5 = int_add(i3, i4)
#
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
index 1ad62b83e7..8a23cc0878 100644
--- a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
@@ -1423,7 +1423,7 @@ class OptimizeOptTest(BaseTestWithUnroll):
def test_getfield_gc_pure_2(self):
ops = """
[i]
- i1 = getfield_gc_pure_i(ConstPtr(myptr), descr=valuedescr)
+ i1 = getfield_gc_pure_i(ConstPtr(myptr3), descr=valuedescr3)
jump(i1)
"""
expected = """
@@ -1437,16 +1437,16 @@ class OptimizeOptTest(BaseTestWithUnroll):
ops = """
[]
p1 = escape_r()
- p2 = getfield_gc_pure_r(p1, descr=nextdescr)
+ p2 = getfield_gc_pure_r(p1, descr=nextdescr3)
escape_n(p2)
- p3 = getfield_gc_pure_r(p1, descr=nextdescr)
+ p3 = getfield_gc_pure_r(p1, descr=nextdescr3)
escape_n(p3)
jump()
"""
expected = """
[]
p1 = escape_r()
- p2 = getfield_gc_pure_r(p1, descr=nextdescr)
+ p2 = getfield_gc_pure_r(p1, descr=nextdescr3)
escape_n(p2)
escape_n(p2)
jump()
@@ -2667,7 +2667,7 @@ class OptimizeOptTest(BaseTestWithUnroll):
ops = """
[p1, p2]
p3 = getarrayitem_gc_r(p1, 0, descr=arraydescr2)
- i4 = getfield_gc_pure_i(ConstPtr(myptr), descr=valuedescr)
+ i4 = getfield_gc_pure_i(ConstPtr(myptr3), descr=valuedescr3)
p5 = getarrayitem_gc_r(p1, 0, descr=arraydescr2)
escape_n(p3)
escape_n(i4)
@@ -2678,7 +2678,7 @@ class OptimizeOptTest(BaseTestWithUnroll):
[p1, p2]
p3 = getarrayitem_gc_r(p1, 0, descr=arraydescr2)
escape_n(p3)
- escape_n(5)
+ escape_n(7)
escape_n(p3)
jump(p1, p2)
"""
@@ -3303,8 +3303,8 @@ class OptimizeOptTest(BaseTestWithUnroll):
[p8, p11, i24]
p26 = new(descr=ssize)
setfield_gc(p26, i24, descr=adescr)
- i34 = getfield_gc_pure_i(p11, descr=abisdescr)
- i35 = getfield_gc_pure_i(p26, descr=adescr)
+ i34 = getfield_gc_i(p11, descr=abisdescr)
+ i35 = getfield_gc_i(p26, descr=adescr)
i36 = int_add_ovf(i34, i35)
guard_no_overflow() []
jump(p8, p11, i35)
@@ -4879,11 +4879,11 @@ class OptimizeOptTest(BaseTestWithUnroll):
def test_add_sub_ovf_virtual_unroll(self):
ops = """
[p15]
- i886 = getfield_gc_pure_i(p15, descr=valuedescr)
+ i886 = getfield_gc_i(p15, descr=valuedescr)
i888 = int_sub_ovf(i886, 1)
guard_no_overflow() []
escape_n(i888)
- i4360 = getfield_gc_pure_i(p15, descr=valuedescr)
+ i4360 = getfield_gc_i(p15, descr=valuedescr)
i4362 = int_add_ovf(i4360, 1)
guard_no_overflow() []
i4360p = int_sub_ovf(i4362, 1)
@@ -4973,8 +4973,8 @@ class OptimizeOptTest(BaseTestWithUnroll):
def test_pure(self):
ops = """
[p42]
- p53 = getfield_gc_r(ConstPtr(myptr), descr=nextdescr)
- p59 = getfield_gc_pure_r(p53, descr=valuedescr)
+ p53 = getfield_gc_r(ConstPtr(myptr3), descr=nextdescr3)
+ p59 = getfield_gc_pure_r(p53, descr=valuedescr3)
i61 = call_i(1, p59, descr=nonwritedescr)
jump(p42)
"""
@@ -5003,7 +5003,7 @@ class OptimizeOptTest(BaseTestWithUnroll):
ops = """
[p3]
p1 = escape_r()
- p2 = getfield_gc_pure_r(p1, descr=nextdescr)
+ p2 = getfield_gc_pure_r(p1, descr=nextdescr3)
setfield_gc(p1, p3, descr=otherdescr)
escape_n(p2)
jump(p3)
@@ -5011,7 +5011,7 @@ class OptimizeOptTest(BaseTestWithUnroll):
expected = """
[p3]
p1 = escape_r()
- p2 = getfield_gc_pure_r(p1, descr=nextdescr)
+ p2 = getfield_gc_pure_r(p1, descr=nextdescr3)
setfield_gc(p1, p3, descr=otherdescr)
escape_n(p2)
jump(p3)
@@ -5022,7 +5022,7 @@ class OptimizeOptTest(BaseTestWithUnroll):
ops = """
[]
p1 = escape_r()
- p2 = getfield_gc_pure_r(p1, descr=nextdescr)
+ p2 = getfield_gc_r(p1, descr=nextdescr)
p3 = escape_r()
setfield_gc(p3, p1, descr=nextdescr)
jump()
@@ -7496,7 +7496,7 @@ class OptimizeOptTest(BaseTestWithUnroll):
def test_forced_virtual_pure_getfield(self):
ops = """
[p0]
- p1 = getfield_gc_pure_r(p0, descr=valuedescr)
+ p1 = getfield_gc_pure_r(p0, descr=valuedescr3)
jump(p1)
"""
self.optimize_loop(ops, ops)
@@ -7780,14 +7780,14 @@ class OptimizeOptTest(BaseTestWithUnroll):
def test_loopinvariant_getarrayitem_gc_pure(self):
ops = """
[p9, i1]
- i843 = getarrayitem_gc_pure_i(p9, i1, descr=arraydescr)
+ i843 = getarrayitem_gc_pure_i(p9, i1, descr=arrayimmutdescr)
call_n(i843, descr=nonwritedescr)
jump(p9, i1)
"""
expected = """
[p9, i1, i843]
call_n(i843, descr=nonwritedescr)
- ifoo = arraylen_gc(p9, descr=arraydescr)
+ ifoo = arraylen_gc(p9, descr=arrayimmutdescr)
jump(p9, i1, i843)
"""
self.optimize_loop(ops, expected)
@@ -7796,7 +7796,7 @@ class OptimizeOptTest(BaseTestWithUnroll):
ops = """
[p0]
p1 = getfield_gc_r(p0, descr=nextdescr)
- p2 = getarrayitem_gc_pure_r(p1, 7, descr=gcarraydescr)
+ p2 = getarrayitem_gc_r(p1, 7, descr=gcarraydescr)
call_n(p2, descr=nonwritedescr)
jump(p0)
"""
@@ -7811,14 +7811,14 @@ class OptimizeOptTest(BaseTestWithUnroll):
i1 = arraylen_gc(p1, descr=gcarraydescr)
i2 = int_ge(i1, 8)
guard_true(i2) []
- p2 = getarrayitem_gc_pure_r(p1, 7, descr=gcarraydescr)
- jump(p2, p1)
+ p2 = getarrayitem_gc_r(p1, 7, descr=gcarraydescr)
+ jump(p1, p2)
"""
expected = """
- [p0, p2, p1]
+ [p0, p1, p2]
call_n(p2, descr=nonwritedescr)
i3 = arraylen_gc(p1, descr=gcarraydescr) # Should be killed by backend
- jump(p0, p2, p1)
+ jump(p0, p1, p2)
"""
self.optimize_loop(ops, expected, expected_short=short)
@@ -7993,7 +7993,7 @@ class OptimizeOptTest(BaseTestWithUnroll):
def test_dont_mixup_equal_boxes(self):
ops = """
[p8]
- i9 = getfield_gc_pure_i(p8, descr=valuedescr)
+ i9 = getfield_gc_pure_i(p8, descr=valuedescr3)
i10 = int_gt(i9, 0)
guard_true(i10) []
i29 = int_lshift(i9, 1)
@@ -8552,7 +8552,7 @@ class OptimizeOptTest(BaseTestWithUnroll):
[p10]
p52 = getfield_gc_r(p10, descr=nextdescr) # inst_storage
p54 = getarrayitem_gc_r(p52, 0, descr=arraydescr)
- p69 = getfield_gc_pure_r(p54, descr=otherdescr) # inst_w_function
+ p69 = getfield_gc_r(p54, descr=otherdescr) # inst_w_function
quasiimmut_field(p69, descr=quasiimmutdescr)
guard_not_invalidated() []
@@ -8816,13 +8816,13 @@ class OptimizeOptTest(BaseTestWithUnroll):
def test_constant_float_pure(self):
ops = """
[p0]
- f0 = getarrayitem_gc_pure_f(p0, 3, descr=floatarraydescr)
+ f0 = getarrayitem_gc_pure_f(p0, 3, descr=floatarrayimmutdescr)
guard_value(f0, 1.03) []
jump(p0)
"""
expected = """
[p0]
- ifoo = arraylen_gc(p0, descr=floatarraydescr)
+ ifoo = arraylen_gc(p0, descr=floatarrayimmutdescr)
jump(p0)
"""
self.optimize_loop(ops, expected)
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_unroll.py b/rpython/jit/metainterp/optimizeopt/test/test_unroll.py
index a412978b0a..eaef3ca9a5 100644
--- a/rpython/jit/metainterp/optimizeopt/test/test_unroll.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_unroll.py
@@ -220,10 +220,10 @@ class TestUnroll(BaseTestUnroll):
def test_double_getfield_plus_pure(self):
loop = """
[p0]
- pc = getfield_gc_pure_r(p0, descr=nextdescr)
+ pc = getfield_gc_pure_r(p0, descr=nextdescr3)
escape_n(p0) # that should flush the caches
- p1 = getfield_gc_r(pc, descr=nextdescr)
- i0 = getfield_gc_i(p1, descr=valuedescr)
+ p1 = getfield_gc_r(pc, descr=nextdescr3)
+ i0 = getfield_gc_i(p1, descr=valuedescr3)
jump(p0)
"""
es, loop, preamble = self.optimize(loop)
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_util.py b/rpython/jit/metainterp/optimizeopt/test/test_util.py
index 4f507be0b7..8de36ea379 100644
--- a/rpython/jit/metainterp/optimizeopt/test/test_util.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_util.py
@@ -251,7 +251,7 @@ class LLtypeMixin(object):
tsize = cpu.sizeof(T, None)
cdescr = cpu.fielddescrof(T, 'c')
ddescr = cpu.fielddescrof(T, 'd')
- arraydescr3 = cpu.arraydescrof(lltype.GcArray(lltype.Ptr(NODE)))
+ arraydescr3 = cpu.arraydescrof(lltype.GcArray(lltype.Ptr(NODE3)))
U = lltype.GcStruct('U',
('parent', OBJECT),