Author: Maciej Fijalkowski <[email protected]>
Branch: optresult-unroll
Changeset: r79277:6407bf490893
Date: 2015-08-28 14:59 +0200
http://bitbucket.org/pypy/pypy/changeset/6407bf490893/
Log: fix some tests
diff --git a/rpython/jit/metainterp/optimizeopt/info.py
b/rpython/jit/metainterp/optimizeopt/info.py
--- a/rpython/jit/metainterp/optimizeopt/info.py
+++ b/rpython/jit/metainterp/optimizeopt/info.py
@@ -186,7 +186,8 @@
subbox = optforce.force_box(fld)
setfieldop = ResOperation(rop.SETFIELD_GC, [op, subbox],
descr=flddescr)
- self._fields[i] = None
+ if not flddescr.is_always_pure():
+ self._fields[i] = None
optforce.emit_operation(setfieldop)
def _force_at_the_end_of_preamble(self, op, optforce, rec):
@@ -452,7 +453,8 @@
setop = ResOperation(rop.SETARRAYITEM_GC,
[op, ConstInt(i), subbox],
descr=arraydescr)
- self._items[i] = None
+ if not self.arraydescr.is_always_pure():
+ self._items[i] = None
optforce.emit_operation(setop)
optforce.pure_from_args(rop.ARRAYLEN_GC, [op],
ConstInt(len(self._items)))
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
@@ -574,9 +574,20 @@
setfield_gc(p1, p1sub, descr=nextdescr)
jump(i1, p1, p2)
"""
+ expected = """
+ [i1, p2, p3]
+ i3 = getfield_gc_i(p3, descr=valuedescr)
+ escape_n(i3)
+ p1 = new_with_vtable(descr=nodesize)
+ setfield_gc(p1, i1, descr=valuedescr)
+ p1sub = new_with_vtable(descr=nodesize2)
+ setfield_gc(p1sub, i1, descr=valuedescr)
+ setfield_gc(p1, p1sub, descr=nextdescr)
+ jump(i1, p1, p2)
+ """
# The same as test_p123_simple, but with a virtual containing another
# virtual.
- self.optimize_loop(ops, ops)
+ self.optimize_loop(ops, expected)
def test_p123_anti_nested(self):
ops = """
@@ -585,9 +596,9 @@
i3 = getfield_gc_i(p3sub, descr=valuedescr)
escape_n(i3)
p2sub = new_with_vtable(descr=nodesize2)
+ setfield_gc(p2sub, i1, descr=valuedescr)
setfield_gc(p2, p2sub, descr=nextdescr)
p1 = new_with_vtable(descr=nodesize)
- setfield_gc(p2sub, i1, descr=valuedescr)
jump(i1, p1, p2)
"""
# The same as test_p123_simple, but in the end the "old" p2 contains
@@ -3049,9 +3060,9 @@
p3 = force_token()
#
p2 = new_with_vtable(descr=vref_descr)
+ setfield_gc(p2, p3, descr=virtualtokendescr)
+ setfield_gc(p2, NULL, descr=virtualforceddescr)
setfield_gc(p0, p2, descr=nextdescr)
- setfield_gc(p2, NULL, descr=virtualforceddescr)
- setfield_gc(p2, p3, descr=virtualtokendescr)
#
call_may_force_n(i1, descr=mayforcevirtdescr)
guard_not_forced() [i1]
@@ -3060,9 +3071,9 @@
setfield_gc(p2, NULL, descr=virtualtokendescr)
p1 = new_with_vtable(descr=nodesize)
p1b = new_with_vtable(descr=nodesize)
- setfield_gc(p2, p1, descr=virtualforceddescr)
setfield_gc(p1b, 252, descr=valuedescr)
setfield_gc(p1, p1b, descr=nextdescr)
+ setfield_gc(p2, p1, descr=virtualforceddescr)
jump(p0, i1)
"""
self.optimize_loop(ops, expected)
@@ -3089,9 +3100,9 @@
p3 = force_token()
#
p2 = new_with_vtable(descr=vref_descr)
+ setfield_gc(p2, p3, descr=virtualtokendescr)
+ setfield_gc(p2, NULL, descr=virtualforceddescr)
setfield_gc(p0, p2, descr=nextdescr)
- setfield_gc(p2, NULL, descr=virtualforceddescr)
- setfield_gc(p2, p3, descr=virtualtokendescr)
#
call_may_force_n(i1, descr=mayforcevirtdescr)
guard_not_forced() [p2, i1]
@@ -3100,9 +3111,9 @@
setfield_gc(p2, NULL, descr=virtualtokendescr)
p1 = new_with_vtable(descr=nodesize)
p1b = new_with_vtable(descr=nodesize)
- setfield_gc(p2, p1, descr=virtualforceddescr)
setfield_gc(p1b, i1, descr=valuedescr)
setfield_gc(p1, p1b, descr=nextdescr)
+ setfield_gc(p2, p1, descr=virtualforceddescr)
jump(p0, i1)
"""
# the point of this test is that 'i1' should show up in the fail_args
diff --git a/rpython/jit/metainterp/optimizeopt/vstring.py
b/rpython/jit/metainterp/optimizeopt/vstring.py
--- a/rpython/jit/metainterp/optimizeopt/vstring.py
+++ b/rpython/jit/metainterp/optimizeopt/vstring.py
@@ -93,7 +93,7 @@
optforce.get_box_replacement(op).set_forwarded(c_s)
return c_s
self._is_virtual = False
- lengthbox = self.getstrlen(op, optforce.optstring, self.mode)
+ lengthbox = self.getstrlen(op, optforce.optimizer.optstring, self.mode)
newop = ResOperation(self.mode.NEWSTR, [lengthbox])
if not we_are_translated():
newop.name = 'FORCE'
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit