Author: Hakan Ardo <ha...@debian.org> Branch: jit-short_from_state Changeset: r45088:973af537a99e Date: 2011-06-23 19:40 +0200 http://bitbucket.org/pypy/pypy/changeset/973af537a99e/
Log: manually reintroduced changes from this branch diff --git a/pypy/module/pypyjit/test_pypy_c/model.py b/pypy/module/pypyjit/test_pypy_c/model.py --- a/pypy/module/pypyjit/test_pypy_c/model.py +++ b/pypy/module/pypyjit/test_pypy_c/model.py @@ -75,6 +75,10 @@ Function.__init__(self, *args, **kwds) self.ids = {} self.code = self.chunks[0].getcode() + if not self.code and len(self.chunks)>1 and \ + isinstance(self.chunks[1], TraceForOpcode): + # First chunk might be missing the debug_merge_point op + self.code = self.chunks[1].getcode() if self.code: self.compute_ids(self.ids) @@ -132,8 +136,9 @@ def _allops(self, include_debug_merge_points=False, opcode=None): opcode_name = opcode for chunk in self.flatten_chunks(): - opcode = chunk.getopcode() - if opcode_name is None or opcode.__class__.__name__ == opcode_name: + opcode = chunk.getopcode() + if opcode_name is None or \ + (opcode and opcode.__class__.__name__ == opcode_name): for op in self._ops_for_chunk(chunk, include_debug_merge_points): yield op diff --git a/pypy/module/pypyjit/test_pypy_c/test_array.py b/pypy/module/pypyjit/test_pypy_c/test_array.py --- a/pypy/module/pypyjit/test_pypy_c/test_array.py +++ b/pypy/module/pypyjit/test_pypy_c/test_array.py @@ -123,6 +123,9 @@ i20 = int_ge(i18, i8) guard_false(i20, descr=...) f21 = getarrayitem_raw(i13, i18, descr=...) + i14 = int_sub(i6, 1) + i15 = int_ge(i14, i8) + guard_false(i15, descr=...) f23 = getarrayitem_raw(i13, i14, descr=...) f24 = float_add(f21, f23) f26 = getarrayitem_raw(i13, i6, descr=...) @@ -171,7 +174,10 @@ ... i17 = int_and(i14, 255) f18 = getarrayitem_raw(i8, i17, descr=...) - f20 = getarrayitem_raw(i8, i9, descr=...) + i19s = int_sub_ovf(i6, 1) + guard_no_overflow(descr=...) + i22s = int_and(i19s, 255) + f20 = getarrayitem_raw(i8, i22s, descr=...) f21 = float_add(f18, f20) f23 = getarrayitem_raw(i8, i10, descr=...) f24 = float_add(f21, f23) diff --git a/pypy/module/pypyjit/test_pypy_c/test_boolrewrite.py b/pypy/module/pypyjit/test_pypy_c/test_boolrewrite.py --- a/pypy/module/pypyjit/test_pypy_c/test_boolrewrite.py +++ b/pypy/module/pypyjit/test_pypy_c/test_boolrewrite.py @@ -39,19 +39,19 @@ # log = self.run(src, [], threshold=400) assert log.result == res - loop, = log.loops_by_filename(self.filepath) - le_ops = log.opnames(loop.ops_by_id('lt')) - ge_ops = log.opnames(loop.ops_by_id('ge')) - assert le_ops.count('int_lt') == 1 - # - if opt_expected: - assert ge_ops.count('int_ge') == 0 - else: - # if this assert fails it means that the optimization was - # applied even if we don't expect to. Check whether the - # optimization is valid, and either fix the code or fix the - # test :-) - assert ge_ops.count('int_ge') == 1 + for loop in log.loops_by_filename(self.filepath): + le_ops = log.opnames(loop.ops_by_id('lt')) + ge_ops = log.opnames(loop.ops_by_id('ge')) + assert le_ops.count('int_lt') == 1 + # + if opt_expected: + assert ge_ops.count('int_ge') == 0 + else: + # if this assert fails it means that the optimization was + # applied even if we don't expect to. Check whether the + # optimization is valid, and either fix the code or fix the + # test :-) + assert ge_ops.count('int_ge') == 1 def test_boolrewrite_reflex(self): """ @@ -87,19 +87,19 @@ """ % (a, b) log = self.run(src, [], threshold=400) assert log.result == res - loop, = log.loops_by_filename(self.filepath) - le_ops = log.opnames(loop.ops_by_id('lt')) - gt_ops = log.opnames(loop.ops_by_id('gt')) - assert le_ops.count('int_lt') == 1 - # - if opt_expected: - assert gt_ops.count('int_gt') == 0 - else: - # if this assert fails it means that the optimization was - # applied even if we don't expect to. Check whether the - # optimization is valid, and either fix the code or fix the - # test :-) - assert gt_ops.count('int_gt') == 1 + for loop in log.loops_by_filename(self.filepath): + le_ops = log.opnames(loop.ops_by_id('lt')) + gt_ops = log.opnames(loop.ops_by_id('gt')) + assert le_ops.count('int_lt') == 1 + # + if opt_expected: + assert gt_ops.count('int_gt') == 0 + else: + # if this assert fails it means that the optimization was + # applied even if we don't expect to. Check whether the + # optimization is valid, and either fix the code or fix the + # test :-) + assert gt_ops.count('int_gt') == 1 def test_boolrewrite_allcases_inverse(self): diff --git a/pypy/module/pypyjit/test_pypy_c/test_intbound.py b/pypy/module/pypyjit/test_pypy_c/test_intbound.py --- a/pypy/module/pypyjit/test_pypy_c/test_intbound.py +++ b/pypy/module/pypyjit/test_pypy_c/test_intbound.py @@ -145,6 +145,7 @@ guard_no_overflow(descr=...) i14 = int_add_ovf(i7, 1) guard_no_overflow(descr=...) + i16s = int_sub(i8, 1) i16 = int_add_ovf(i6, 1) guard_no_overflow(descr=...) i19 = int_add(i8, 1) diff --git a/pypy/module/pypyjit/test_pypy_c/test_misc.py b/pypy/module/pypyjit/test_pypy_c/test_misc.py --- a/pypy/module/pypyjit/test_pypy_c/test_misc.py +++ b/pypy/module/pypyjit/test_pypy_c/test_misc.py @@ -106,6 +106,7 @@ assert log.result == 1000 * 999 / 2 loop, = log.loops_by_filename(self.filepath) assert loop.match(""" + i11 = getfield_gc(p4, descr=<.* .*W_AbstractSeqIterObject.inst_index .*>) i16 = int_ge(i11, i12) guard_false(i16, descr=<Guard3>) i17 = int_mul(i11, i14) @@ -163,6 +164,7 @@ assert log.result == 1000000 loop, = log.loops_by_filename(self.filepath) assert loop.match(""" + i12 = getfield_gc(p4, descr=...) i16 = int_ge(i12, i13) guard_false(i16, descr=<Guard3>) p17 = getarrayitem_gc(p15, i12, descr=<GcPtrArrayDescr>) @@ -179,7 +181,7 @@ i28 = int_add_ovf(i10, i25) guard_no_overflow(descr=<Guard7>) --TICK-- - jump(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, i28, i25, i19, i13, p14, p15, descr=<Loop0>) + jump(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, i28, i25, i13, p14, p15, descr=<Loop0>) """) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit