[pypy-svn] r65144 - pypy/branch/pyjitpl5/pypy/jit/backend/x86
fijal at codespeak.net
fijal at codespeak.net
Thu May 7 19:37:49 CEST 2009
Author: fijal
Date: Thu May 7 19:37:47 2009
New Revision: 65144
Modified:
pypy/branch/pyjitpl5/pypy/jit/backend/x86/regalloc.py
Log:
If we use the result of GUARD_EXCEPTION(OverflowError), explode
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/regalloc.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/regalloc.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/regalloc.py Thu May 7 19:37:47 2009
@@ -16,6 +16,13 @@
REGS = [eax, ecx, edx]
WORD = 4
+class ImplementConstantOverflow(Exception):
+ """ This exception is raised when someone uses the result
+ of GUARD_EXCEPTION(overflowerror). I think codewriter should
+ constant fold it as we know what kind of exception it will
+ be
+ """
+
class TempBox(Box):
def __init__(self):
pass
@@ -281,9 +288,10 @@
if not canfold:
# detect overflow ops
if op.is_ovf():
- num = operations[i + 1].opnum
- assert (num == rop.GUARD_NO_EXCEPTION or
- num == rop.GUARD_EXCEPTION)
+ assert operations[i + 1].is_guard_exception()
+ if (operations[i + 1].opnum == rop.GUARD_EXCEPTION and
+ operations[i + 1].result in self.longevity):
+ raise ImplementConstantOverflow()
nothing = oplist[op.opnum](self, op, operations[i + 1])
i += 1
elif self.can_optimize_cmp_op(op, i, operations):
More information about the Pypy-commit
mailing list