Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r78891:7a82bbfa8b25 Date: 2015-08-11 13:56 +0100 http://bitbucket.org/pypy/pypy/changeset/7a82bbfa8b25/
Log: (cfbolz, arigo) Improve the error message in the case where the same jitdriver is used twice (this is about the case of reds='auto' only) diff --git a/rpython/jit/codewriter/support.py b/rpython/jit/codewriter/support.py --- a/rpython/jit/codewriter/support.py +++ b/rpython/jit/codewriter/support.py @@ -79,6 +79,9 @@ assert methname == 'jit_merge_point', ( "reds='auto' is supported only for jit drivers which " "calls only jit_merge_point. Found a call to %s" % methname) + if jitdriver.numreds is not None: + raise AssertionError("there are multiple jit_merge_points " + "with the same jitdriver") # # compute the set of live variables across the jit_marker alive_v = set() @@ -96,10 +99,7 @@ v.concretetype is not lltype.Void] reds_v = sort_vars(reds_v) op.args.extend(reds_v) - if jitdriver.numreds is None: - jitdriver.numreds = len(reds_v) - else: - assert jitdriver.numreds == len(reds_v), 'inconsistent number of reds_v' + jitdriver.numreds = len(reds_v) def split_before_jit_merge_point(graph, portalblock, portalopindex): """Split the block just before the 'jit_merge_point', diff --git a/rpython/jit/metainterp/test/test_warmspot.py b/rpython/jit/metainterp/test/test_warmspot.py --- a/rpython/jit/metainterp/test/test_warmspot.py +++ b/rpython/jit/metainterp/test/test_warmspot.py @@ -558,6 +558,22 @@ assert res == 7 - 3 self.check_trace_count(2) + def test_jitdriver_single_jit_merge_point(self): + jitdriver = JitDriver(greens=[], reds='auto') + def g1(n): + jitdriver.jit_merge_point() + return n + def g2(): + jitdriver.jit_merge_point() + def f(n): + if n: + g1(n) + else: + g2() + e = py.test.raises(AssertionError, self.meta_interp, f, [42]) + assert str(e.value) == ("there are multiple jit_merge_points " + "with the same jitdriver") + class TestLLWarmspot(WarmspotTests, LLJitMixin): CPUClass = runner.LLGraphCPU _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit