[pypy-svn] r67167 - pypy/branch/pyjitpl5/pypy/translator/cli

antocuni at codespeak.net antocuni at codespeak.net
Mon Aug 24 17:31:16 CEST 2009


Author: antocuni
Date: Mon Aug 24 17:31:16 2009
New Revision: 67167

Modified:
   pypy/branch/pyjitpl5/pypy/translator/cli/opcodes.py
Log:
catch ArithmeticException only if needed


Modified: pypy/branch/pyjitpl5/pypy/translator/cli/opcodes.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/translator/cli/opcodes.py	(original)
+++ pypy/branch/pyjitpl5/pypy/translator/cli/opcodes.py	Mon Aug 24 17:31:16 2009
@@ -18,9 +18,10 @@
 def _abs(type_):
     return [PushAllArgs, 'call %s class [mscorlib]System.Math::Abs(%s)' % (type_, type_), StoreResult]
 
-def _check_ovf(op):
-    mapping = [('[mscorlib]System.OverflowException', 'exceptions.OverflowError'),
-               ('[mscorlib]System.ArithmeticException', 'exceptions.OverflowError')]
+def _check_ovf(op, catch_arithmexic_exception=False):
+    mapping = [('[mscorlib]System.OverflowException', 'exceptions.OverflowError')]
+    if catch_arithmexic_exception:
+        mapping.append(('[mscorlib]System.ArithmeticException', 'exceptions.OverflowError'))
     return [MapException(op, mapping)]
 
 def _check_zer(op):
@@ -174,7 +175,7 @@
     'int_sub_ovf':              _check_ovf('sub.ovf'),
     'int_mul_ovf':              _check_ovf('mul.ovf'),
     'int_floordiv_ovf':         _check_ovf('div'),
-    'int_mod_ovf':              _check_ovf('rem'),
+    'int_mod_ovf':              _check_ovf('rem', catch_arithmexic_exception=True),
     'int_lt_ovf':               'clt',
     'int_le_ovf':               _not('cgt'),
     'int_eq_ovf':               'ceq',



More information about the Pypy-commit mailing list