Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r49836:299a1d66e8a2 Date: 2011-11-26 20:26 +0100 http://bitbucket.org/pypy/pypy/changeset/299a1d66e8a2/
Log: When hitting a too large value, cleanly give up jit-compilation instead of crashing with ValueError. diff --git a/pypy/jit/metainterp/resume.py b/pypy/jit/metainterp/resume.py --- a/pypy/jit/metainterp/resume.py +++ b/pypy/jit/metainterp/resume.py @@ -93,11 +93,13 @@ TAGMASK = 3 -def tag(value, tagbits): - if tagbits >> 2: - raise ValueError +def tag(value, tagbits, giveup=True): + assert 0 <= tagbits <= 3 sx = value >> 13 if sx != 0 and sx != -1: + if giveup: + from pypy.jit.metainterp import compile + compile.giveup() raise ValueError return rffi.r_short(value<<2|tagbits) @@ -152,7 +154,7 @@ # unhappiness, probably a symbolic return self._newconst(const) try: - return tag(val, TAGINT) + return tag(val, TAGINT, giveup=False) except ValueError: pass tagged = self.large_ints.get(val, UNASSIGNED) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit