[pypy-commit] pypy default: Add a number of @elidable, now that they can raise.
arigo
noreply at buildbot.pypy.org
Thu Jul 28 18:00:26 CEST 2011
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r46048:a3001c18a307
Date: 2011-07-28 11:52 +0200
http://bitbucket.org/pypy/pypy/changeset/a3001c18a307/
Log: Add a number of @elidable, now that they can raise.
diff --git a/pypy/jit/codewriter/support.py b/pypy/jit/codewriter/support.py
--- a/pypy/jit/codewriter/support.py
+++ b/pypy/jit/codewriter/support.py
@@ -20,6 +20,7 @@
from pypy.rpython.annlowlevel import MixLevelHelperAnnotator
from pypy.jit.metainterp.typesystem import deref
from pypy.rlib import rgc
+from pypy.rlib.jit import elidable
from pypy.rlib.rarithmetic import r_longlong, r_ulonglong, r_uint, intmask
def getargtypes(annotator, values):
@@ -167,9 +168,14 @@
_ll_5_list_ll_arraycopy = rgc.ll_arraycopy
+ at elidable
def _ll_1_gc_identityhash(x):
return lltype.identityhash(x)
+# the following function should not be "@elidable": I can think of
+# a corner case in which id(const) is constant-folded, and then 'const'
+# disappears and is collected too early (possibly causing another object
+# with the same id() to appear).
def _ll_1_gc_id(ptr):
return llop.gc_id(lltype.Signed, ptr)
@@ -177,6 +183,7 @@
return llop.jit_force_virtual(lltype.typeOf(inst), inst)
+ at elidable
def _ll_2_int_floordiv_ovf_zer(x, y):
if y == 0:
raise ZeroDivisionError
@@ -184,16 +191,19 @@
raise OverflowError
return llop.int_floordiv(lltype.Signed, x, y)
+ at elidable
def _ll_2_int_floordiv_ovf(x, y):
if x == -sys.maxint - 1 and y == -1:
raise OverflowError
return llop.int_floordiv(lltype.Signed, x, y)
+ at elidable
def _ll_2_int_floordiv_zer(x, y):
if y == 0:
raise ZeroDivisionError
return llop.int_floordiv(lltype.Signed, x, y)
+ at elidable
def _ll_2_int_mod_ovf_zer(x, y):
if y == 0:
raise ZeroDivisionError
@@ -201,22 +211,26 @@
raise OverflowError
return llop.int_mod(lltype.Signed, x, y)
+ at elidable
def _ll_2_int_mod_ovf(x, y):
if x == -sys.maxint - 1 and y == -1:
raise OverflowError
return llop.int_mod(lltype.Signed, x, y)
+ at elidable
def _ll_2_int_mod_zer(x, y):
if y == 0:
raise ZeroDivisionError
return llop.int_mod(lltype.Signed, x, y)
+ at elidable
def _ll_2_int_lshift_ovf(x, y):
result = x << y
if (result >> y) != x:
raise OverflowError
return result
+ at elidable
def _ll_1_int_abs(x):
if x < 0:
return -x
diff --git a/pypy/rpython/lltypesystem/module/ll_math.py b/pypy/rpython/lltypesystem/module/ll_math.py
--- a/pypy/rpython/lltypesystem/module/ll_math.py
+++ b/pypy/rpython/lltypesystem/module/ll_math.py
@@ -323,6 +323,7 @@
_likely_raise(errno, r)
return r
+ at jit.elidable
def ll_math_sqrt(x):
if x < 0.0:
raise ValueError, "math domain error"
More information about the pypy-commit
mailing list