[pypy-svn] r76986 - in pypy/branch/jit-generator/pypy/jit/metainterp: . test
arigo at codespeak.net
arigo at codespeak.net
Thu Sep 9 19:43:48 CEST 2010
Author: arigo
Date: Thu Sep 9 19:43:46 2010
New Revision: 76986
Modified:
pypy/branch/jit-generator/pypy/jit/metainterp/compile.py
pypy/branch/jit-generator/pypy/jit/metainterp/test/test_compile.py
Log:
Test and fix.
Modified: pypy/branch/jit-generator/pypy/jit/metainterp/compile.py
==============================================================================
--- pypy/branch/jit-generator/pypy/jit/metainterp/compile.py (original)
+++ pypy/branch/jit-generator/pypy/jit/metainterp/compile.py Thu Sep 9 19:43:46 2010
@@ -554,9 +554,11 @@
class PropagateExceptionDescr(AbstractFailDescr):
def handle_fail(self, metainterp_sd, jitdriver_sd):
cpu = metainterp_sd.cpu
- exception = self.cpu.grab_exc_value()
+ exception = cpu.grab_exc_value()
raise metainterp_sd.ExitFrameWithExceptionRef(cpu, exception)
+propagate_exception_descr = PropagateExceptionDescr()
+
def compile_tmp_callback(cpu, jitdriver_sd, greenkey, redboxes):
"""Make a LoopToken that corresponds to assembler code that just
calls back the interpreter. Used temporarily: a fully compiled
@@ -568,7 +570,7 @@
#
k = jitdriver_sd.portal_runner_adr
funcbox = history.ConstInt(heaptracker.adr2int(k))
- args = [funcbox] + greenkey + inputargs
+ callargs = [funcbox] + greenkey + inputargs
#
result_type = jitdriver_sd.result_type
if result_type == history.INT:
@@ -587,9 +589,9 @@
finishargs = [result]
#
jd = jitdriver_sd
- faildescr = PropagateExceptionDescr()
+ faildescr = propagate_exception_descr
operations = [
- ResOperation(rop.CALL, args, result, descr=jd.portal_calldescr),
+ ResOperation(rop.CALL, callargs, result, descr=jd.portal_calldescr),
ResOperation(rop.GUARD_NO_EXCEPTION, [], None, descr=faildescr),
ResOperation(rop.FINISH, finishargs, None, descr=jd.portal_finishtoken)
]
Modified: pypy/branch/jit-generator/pypy/jit/metainterp/test/test_compile.py
==============================================================================
--- pypy/branch/jit-generator/pypy/jit/metainterp/test/test_compile.py (original)
+++ pypy/branch/jit-generator/pypy/jit/metainterp/test/test_compile.py Thu Sep 9 19:43:46 2010
@@ -199,3 +199,19 @@
assert isinstance(fail_descr, compile.PropagateExceptionDescr)
got = cpu.grab_exc_value()
assert lltype.cast_opaque_ptr(lltype.Ptr(EXC), got) == llexc
+ #
+ class FakeMetaInterpSD:
+ class ExitFrameWithExceptionRef(Exception):
+ pass
+ FakeMetaInterpSD.cpu = cpu
+ class FakeJitDriverSD:
+ pass
+ cpu.set_future_value_int(0, -156)
+ cpu.set_future_value_int(1, -178)
+ fail_descr = cpu.execute_token(loop_token)
+ try:
+ fail_descr.handle_fail(FakeMetaInterpSD(), FakeJitDriverSD())
+ except FakeMetaInterpSD.ExitFrameWithExceptionRef, e:
+ assert lltype.cast_opaque_ptr(lltype.Ptr(EXC), e.args[1]) == llexc
+ else:
+ assert 0, "should have raised"
More information about the Pypy-commit
mailing list