[pypy-svn] r65300 - in pypy/branch/pyjitpl5/pypy/jit/backend/cli: . test
antocuni at codespeak.net
antocuni at codespeak.net
Mon May 18 21:21:47 CEST 2009
Author: antocuni
Date: Mon May 18 21:21:45 2009
New Revision: 65300
Modified:
pypy/branch/pyjitpl5/pypy/jit/backend/cli/method.py
pypy/branch/pyjitpl5/pypy/jit/backend/cli/runner.py
pypy/branch/pyjitpl5/pypy/jit/backend/cli/test/test_zrpy_exception.py
Log:
translate .NET OverflowException into RPython OverflowError when caught in the generated code. One more test passing
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/cli/method.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/cli/method.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/cli/method.py Mon May 18 21:21:45 2009
@@ -104,6 +104,12 @@
t_InputArgs = dotnet.typeof(InputArgs)
self.av_inputargs = MethodArgument(1,t_InputArgs )
self.exc_value_field = t_InputArgs.GetField('exc_value')
+ if cpu.rtyper:
+ self.av_OverflowError = ConstObj(ootype.cast_to_object(cpu.ll_ovf_exc))
+ self.av_ZeroDivisionError = ConstObj(ootype.cast_to_object(cpu.ll_zero_exc))
+ else:
+ self.av_OverflowError = None
+ self.av_ZeroDivisionError = None
# ----
self.emit_load_inputargs()
self.emit_preamble()
@@ -253,6 +259,10 @@
for exctype in exctypes:
v = self.il.DeclareLocal(exctype)
self.il.BeginCatchBlock(exctype)
+ if exctype == dotnet.typeof(System.OverflowException) and self.av_OverflowError:
+ # translate OverflowException into excpetions.OverflowError
+ self.il.Emit(OpCodes.Pop)
+ self.av_OverflowError.load(self)
self.il.Emit(OpCodes.Stloc, v)
self.av_inputargs.load(self)
self.il.Emit(OpCodes.Ldloc, v)
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/cli/runner.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/cli/runner.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/cli/runner.py Mon May 18 21:21:45 2009
@@ -25,6 +25,17 @@
self.stats = stats
self.translate_support_code = translate_support_code
self.inputargs = None
+ self.ll_ovf_exc = self._get_prebuilt_exc(OverflowError)
+ self.ll_zero_exc = self._get_prebuilt_exc(ZeroDivisionError)
+
+ def _get_prebuilt_exc(self, cls):
+ if self.rtyper is None:
+ return System.Exception()
+ else:
+ bk = self.rtyper.annotator.bookkeeper
+ clsdef = bk.getuniqueclassdef(cls)
+ return self.rtyper.exceptiondata.get_standard_ll_exc_instance(
+ self.rtyper, clsdef)
def get_inputargs(self):
if self.inputargs is None:
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/cli/test/test_zrpy_exception.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/cli/test/test_zrpy_exception.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/cli/test/test_zrpy_exception.py Mon May 18 21:21:45 2009
@@ -17,8 +17,7 @@
test_exception_four_cases = skip_loop
test_bridge_from_interpreter_exc = skip_loop
test_bridge_from_interpreter_exc_2 = skip_loop
-
- test_int_ovf = skip
- test_int_lshift_ovf = skip
+ test_int_lshift_ovf = skip_loop
+
More information about the Pypy-commit
mailing list