[pypy-svn] r63659 - pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp
fijal at codespeak.net
fijal at codespeak.net
Sun Apr 5 05:35:44 CEST 2009
Author: fijal
Date: Sun Apr 5 05:35:44 2009
New Revision: 63659
Modified:
pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/codewriter.py
pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/executor.py
pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py
pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/resoperation.py
Log:
implement int_floordiv_ovf (how it can possibly overflow?)
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/codewriter.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/codewriter.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/codewriter.py Sun Apr 5 05:35:44 2009
@@ -530,7 +530,7 @@
# XXX handle ZeroDivisionError
self.default_serialize_op(op, 'int_mod_ovf')
- def setialize_op_int_floordiv_ovf_zer(self, op):
+ def serialize_op_int_floordiv_ovf_zer(self, op):
# XXX handle ZeroDivisionError
self.default_serialize_op(op, 'int_floordiv_ovf')
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/executor.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/executor.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/executor.py Sun Apr 5 05:35:44 2009
@@ -196,6 +196,16 @@
z = 0
return BoxInt(z)
+def do_int_floordiv_ovf(cpu, args, descr=None):
+ x = args[0].getint()
+ y = args[1].getint()
+ try:
+ z = ovfcheck(x // y)
+ except OverflowError:
+ cpu.set_overflow_error()
+ z = 0
+ return ConstInt(z)
+
# ____________________________________________________________
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py Sun Apr 5 05:35:44 2009
@@ -246,7 +246,7 @@
''' % (_opimpl, _opimpl.upper())).compile()
for _opimpl in ['int_add_ovf', 'int_sub_ovf', 'int_mul_ovf', 'int_mod_ovf',
- 'int_lshift_ovf']:
+ 'int_lshift_ovf', 'int_floordiv_ovf']:
exec py.code.Source('''
@arguments("box", "box")
def opimpl_%s(self, b1, b2):
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/resoperation.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/resoperation.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/resoperation.py Sun Apr 5 05:35:44 2009
@@ -180,7 +180,8 @@
INT_NEG_OVF = 113
INT_MOD_OVF = 114
INT_LSHIFT_OVF = 115
- _OVF_LAST = 115
+ INT_FLOORDIV_OVF = 116
+ _OVF_LAST = 116
_CANRAISE_LAST = 119 # ----- end of can_raise operations -----
_LAST = 119 # for the backend to add more internal operations
More information about the Pypy-commit
mailing list