[pypy-commit] pypy exception-cannot-occur: Add some exception_cannot_occur/exception_is_here.
arigo
noreply at buildbot.pypy.org
Sun Apr 1 20:08:52 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch: exception-cannot-occur
Changeset: r54126:7adda6345851
Date: 2012-04-01 19:17 +0200
http://bitbucket.org/pypy/pypy/changeset/7adda6345851/
Log: Add some exception_cannot_occur/exception_is_here.
diff --git a/pypy/rlib/rerased.py b/pypy/rlib/rerased.py
--- a/pypy/rlib/rerased.py
+++ b/pypy/rlib/rerased.py
@@ -111,10 +111,10 @@
return identity.leave_tunnel(self.bookkeeper)
def specialize_call(self, hop):
+ hop.exception_cannot_occur()
if hop.r_result.lowleveltype is lltype.Void:
return hop.inputconst(lltype.Void, None)
[v] = hop.inputargs(hop.args_r[0])
- hop.exception_cannot_occur()
return hop.args_r[0].rtype_unerase(hop, v)
return erase, unerase
@@ -155,6 +155,7 @@
def specialize_call(self, hop):
[v] = hop.inputargs(hop.args_r[0])
assert isinstance(hop.s_result, annmodel.SomeInteger)
+ hop.exception_cannot_occur()
return hop.args_r[0].rtype_unerase_int(hop, v)
def ll_unerase_int(gcref):
diff --git a/pypy/rpython/lltypesystem/rbuiltin.py b/pypy/rpython/lltypesystem/rbuiltin.py
--- a/pypy/rpython/lltypesystem/rbuiltin.py
+++ b/pypy/rpython/lltypesystem/rbuiltin.py
@@ -9,6 +9,7 @@
from pypy.rpython.rbool import bool_repr
def rtype_builtin_isinstance(hop):
+ hop.exception_cannot_occur()
if hop.s_result.is_constant():
return hop.inputconst(lltype.Bool, hop.s_result.const)
if hop.args_r[0] == pyobj_repr or hop.args_r[1] == pyobj_repr:
diff --git a/pypy/rpython/ootypesystem/rbuiltin.py b/pypy/rpython/ootypesystem/rbuiltin.py
--- a/pypy/rpython/ootypesystem/rbuiltin.py
+++ b/pypy/rpython/ootypesystem/rbuiltin.py
@@ -7,12 +7,14 @@
from pypy.rpython.error import TyperError
def rtype_new(hop):
+ hop.exception_cannot_occur()
assert hop.args_s[0].is_constant()
vlist = hop.inputargs(ootype.Void)
return hop.genop('new', vlist,
resulttype = hop.r_result.lowleveltype)
def rtype_oonewarray(hop):
+ hop.exception_cannot_occur()
assert hop.args_s[0].is_constant()
vlist = hop.inputarg(ootype.Void, arg=0)
vlength = hop.inputarg(ootype.Signed, arg=1)
@@ -20,23 +22,27 @@
resulttype = hop.r_result.lowleveltype)
def rtype_null(hop):
+ hop.exception_cannot_occur()
assert hop.args_s[0].is_constant()
TYPE = hop.args_s[0].const
nullvalue = ootype.null(TYPE)
return hop.inputconst(TYPE, nullvalue)
def rtype_classof(hop):
+ hop.exception_cannot_occur()
assert isinstance(hop.args_s[0], annmodel.SomeOOInstance)
vlist = hop.inputargs(hop.args_r[0])
return hop.genop('classof', vlist,
resulttype = ootype.Class)
def rtype_subclassof(hop):
+ hop.exception_cannot_occur()
vlist = hop.inputargs(rootype.ooclass_repr, rootype.ooclass_repr)
return hop.genop('subclassof', vlist,
resulttype = ootype.Bool)
def rtype_instanceof(hop):
+ hop.exception_cannot_occur()
INSTANCE = hop.args_v[1].value
v_inst = hop.inputarg(hop.args_r[0], arg=0)
c_cls = hop.inputconst(ootype.Void, INSTANCE)
@@ -44,23 +50,27 @@
resulttype=ootype.Bool)
def rtype_runtimenew(hop):
+ hop.exception_cannot_occur()
vlist = hop.inputargs(rootype.ooclass_repr)
return hop.genop('runtimenew', vlist,
resulttype = hop.r_result.lowleveltype)
def rtype_ooupcast(hop):
+ hop.exception_cannot_occur()
assert isinstance(hop.args_s[0].const, ootype.Instance)
assert isinstance(hop.args_s[1], annmodel.SomeOOInstance)
v_inst = hop.inputarg(hop.args_r[1], arg=1)
return hop.genop('ooupcast', [v_inst], resulttype = hop.r_result.lowleveltype)
def rtype_oodowncast(hop):
+ hop.exception_cannot_occur()
assert isinstance(hop.args_s[0].const, ootype.Instance)
assert isinstance(hop.args_s[1], annmodel.SomeOOInstance)
v_inst = hop.inputarg(hop.args_r[1], arg=1)
return hop.genop('oodowncast', [v_inst], resulttype = hop.r_result.lowleveltype)
def rtype_cast_to_object(hop):
+ hop.exception_cannot_occur()
assert isinstance(hop.args_s[0], annmodel.SomeOOStaticMeth) or \
isinstance(hop.args_s[0], annmodel.SomeOOClass) or \
isinstance(hop.args_s[0].ootype, ootype.OOType)
@@ -68,12 +78,14 @@
return hop.genop('cast_to_object', [v_inst], resulttype = hop.r_result.lowleveltype)
def rtype_cast_from_object(hop):
+ hop.exception_cannot_occur()
assert isinstance(hop.args_s[0].const, ootype.OOType)
assert isinstance(hop.args_s[1], annmodel.SomeOOObject)
v_inst = hop.inputarg(hop.args_r[1], arg=1)
return hop.genop('cast_from_object', [v_inst], resulttype = hop.r_result.lowleveltype)
def rtype_builtin_isinstance(hop):
+ hop.exception_cannot_occur()
if hop.s_result.is_constant():
return hop.inputconst(ootype.Bool, hop.s_result.const)
@@ -99,6 +111,7 @@
return ootype.subclassof(c1, class_)
def rtype_instantiate(hop):
+ hop.exception_cannot_occur()
if hop.args_s[0].is_constant():
## INSTANCE = hop.s_result.rtyper_makerepr(hop.rtyper).lowleveltype
## v_instance = hop.inputconst(ootype.Void, INSTANCE)
diff --git a/pypy/rpython/rbuiltin.py b/pypy/rpython/rbuiltin.py
--- a/pypy/rpython/rbuiltin.py
+++ b/pypy/rpython/rbuiltin.py
@@ -605,6 +605,7 @@
def rtype_offsetof(hop):
TYPE, field = hop.inputargs(lltype.Void, lltype.Void)
+ hop.exception_cannot_occur()
return hop.inputconst(lltype.Signed,
llmemory.offsetof(TYPE.value, field.value))
@@ -626,6 +627,7 @@
# keepalive_until_here
def rtype_keepalive_until_here(hop):
+ hop.exception_cannot_occur()
for v in hop.args_v:
hop.genop('keepalive', [v], resulttype=lltype.Void)
return hop.inputconst(lltype.Void, None)
diff --git a/pypy/rpython/rrange.py b/pypy/rpython/rrange.py
--- a/pypy/rpython/rrange.py
+++ b/pypy/rpython/rrange.py
@@ -107,8 +107,10 @@
if isinstance(hop.r_result, AbstractRangeRepr):
if hop.r_result.step != 0:
c_rng = hop.inputconst(Void, hop.r_result.RANGE)
+ hop.exception_is_here()
return hop.gendirectcall(hop.r_result.ll_newrange, c_rng, vstart, vstop)
else:
+ hop.exception_is_here()
return hop.gendirectcall(hop.r_result.ll_newrangest, vstart, vstop, vstep)
else:
# cannot build a RANGE object, needs a real list
@@ -117,6 +119,7 @@
if isinstance(ITEMTYPE, Ptr):
ITEMTYPE = ITEMTYPE.TO
cLIST = hop.inputconst(Void, ITEMTYPE)
+ hop.exception_is_here()
return hop.gendirectcall(ll_range2list, cLIST, vstart, vstop, vstep)
rtype_builtin_xrange = rtype_builtin_range
diff --git a/pypy/rpython/test/test_extregistry.py b/pypy/rpython/test/test_extregistry.py
--- a/pypy/rpython/test/test_extregistry.py
+++ b/pypy/rpython/test/test_extregistry.py
@@ -114,6 +114,7 @@
_about_ = dummy_func
s_result_annotation = annmodel.SomeInteger()
def specialize_call(self, hop):
+ hop.exception_cannot_occur()
return hop.inputconst(lltype.Signed, 42)
def func():
More information about the pypy-commit
mailing list