Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r88639:2e8473885ae1 Date: 2016-11-24 15:07 +0100 http://bitbucket.org/pypy/pypy/changeset/2e8473885ae1/
Log: extra passing test diff --git a/rpython/jit/metainterp/test/test_call.py b/rpython/jit/metainterp/test/test_call.py --- a/rpython/jit/metainterp/test/test_call.py +++ b/rpython/jit/metainterp/test/test_call.py @@ -206,7 +206,39 @@ # remaining: only the first call to get_triple(), as a call_i # because we know that x.triple == 0 here. The remaining calls # are removed because equal to the first one. - self.check_resops(call_i=2, cond_call_value_i=0) + self.check_resops(call_i=2, cond_call_value_i=0, + new_with_vtable=2) # escapes: _compute_triple(self) + + def test_cond_call_constant_in_optimizer_5(self): + def _compute_triple(value): + return value * 3 + class X: + def __init__(self, value): + self.value = value + self.triple = 0 + def get_triple(self): + res = jit.conditional_call_elidable(self.triple, + _compute_triple, self.value) + self.triple = res + return res + + myjitdriver = jit.JitDriver(greens = [], reds = 'auto') + def main(n): + total = 0 + while n > 1: + myjitdriver.jit_merge_point() + x = X(n) + total += x.get_triple() + x.get_triple() + x.get_triple() + n -= 10 + return total + + res = self.meta_interp(main, [100]) + assert res == main(100) + # remaining: only the first call to get_triple(), as a call_i + # because we know that x.triple == 0 here. The remaining calls + # are removed because equal to the first one. + self.check_resops(call_i=2, cond_call_value_i=0, + new_with_vtable=0) # all virtual def test_cond_call_multiple_in_optimizer_1(self): # test called several times with the same arguments, but _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit