[pypy-svn] r74934 - pypy/branch/blackhole-improvement/pypy/jit/metainterp
arigo at codespeak.net
arigo at codespeak.net
Sun May 30 20:56:47 CEST 2010
Author: arigo
Date: Sun May 30 20:56:45 2010
New Revision: 74934
Modified:
pypy/branch/blackhole-improvement/pypy/jit/metainterp/blackhole.py
pypy/branch/blackhole-improvement/pypy/jit/metainterp/jitexc.py
Log:
Fix.
Modified: pypy/branch/blackhole-improvement/pypy/jit/metainterp/blackhole.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/metainterp/blackhole.py (original)
+++ pypy/branch/blackhole-improvement/pypy/jit/metainterp/blackhole.py Sun May 30 20:56:45 2010
@@ -8,7 +8,7 @@
from pypy.rpython.llinterp import LLException
from pypy.jit.codewriter.jitcode import JitCode, SwitchDictDescr
from pypy.jit.codewriter import heaptracker
-from pypy.jit.metainterp.jitexc import JitException, get_llexception
+from pypy.jit.metainterp.jitexc import JitException, get_llexception, reraise
def arguments(*argtypes, **kwds):
@@ -361,11 +361,7 @@
self.position = target
return
# no 'catch_exception' insn follows: just reraise
- if we_are_translated():
- raise Exception, e
- else:
- etype = rclass.ll_type(e)
- raise LLException(etype, e)
+ reraise(e)
def copy_constants(self, registers, constants):
"""Copy jitcode.constants[0] to registers[255],
@@ -758,21 +754,13 @@
def bhimpl_raise(self, excvalue):
e = lltype.cast_opaque_ptr(rclass.OBJECTPTR, excvalue)
assert e
- if we_are_translated():
- raise Exception, e
- else:
- etype = rclass.ll_type(e)
- raise LLException(etype, e)
+ reraise(e)
@arguments("self")
def bhimpl_reraise(self):
e = self.exception_last_value
assert e
- if we_are_translated():
- raise Exception, e
- else:
- etype = rclass.ll_type(e)
- raise LLException(etype, e)
+ reraise(e)
# ----------
# the main hints and recursive calls
Modified: pypy/branch/blackhole-improvement/pypy/jit/metainterp/jitexc.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/metainterp/jitexc.py (original)
+++ pypy/branch/blackhole-improvement/pypy/jit/metainterp/jitexc.py Sun May 30 20:56:45 2010
@@ -1,4 +1,6 @@
from pypy.rpython.annlowlevel import cast_instance_to_base_ptr
+from pypy.rpython.annlowlevel import cast_base_ptr_to_instance
+from pypy.rpython.lltypesystem import rclass
from pypy.rpython.llinterp import LLException
from pypy.rlib.objectmodel import we_are_translated
@@ -26,3 +28,11 @@
if isinstance(e, OverflowError):
return _get_standard_error(cpu.rtyper, OverflowError)
raise # leave other exceptions to be propagated
+
+def reraise(lle):
+ if we_are_translated():
+ e = cast_base_ptr_to_instance(Exception, lle)
+ raise e
+ else:
+ etype = rclass.ll_type(lle)
+ raise LLException(etype, lle)
More information about the Pypy-commit
mailing list