Author: Ronan Lamy <[email protected]>
Branch:
Changeset: r76376:8e572d5558aa
Date: 2015-03-14 19:01 +0000
http://bitbucket.org/pypy/pypy/changeset/8e572d5558aa/
Log: Kill unused op.getitem_key and op.getitem_idx_key
diff --git a/rpython/annotator/binaryop.py b/rpython/annotator/binaryop.py
--- a/rpython/annotator/binaryop.py
+++ b/rpython/annotator/binaryop.py
@@ -132,13 +132,11 @@
impl = pair(s_c1, s_o2).getitem
return read_can_only_throw(impl, s_c1, s_o2)
- def getitem_idx_key((s_c1, s_o2)):
+ def getitem_idx((s_c1, s_o2)):
impl = pair(s_c1, s_o2).getitem
return impl()
- getitem_idx_key.can_only_throw = _getitem_can_only_throw
+ getitem_idx.can_only_throw = _getitem_can_only_throw
- getitem_idx = getitem_idx_key
- getitem_key = getitem_idx_key
class __extend__(pairtype(SomeType, SomeType),
@@ -565,14 +563,10 @@
return lst1.listdef.read_item()
getitem.can_only_throw = []
- getitem_key = getitem
-
def getitem_idx((lst1, int2)):
return lst1.listdef.read_item()
getitem_idx.can_only_throw = [IndexError]
- getitem_idx_key = getitem_idx
-
def setitem((lst1, int2), s_value):
lst1.listdef.mutate()
lst1.listdef.generalize(s_value)
@@ -588,14 +582,10 @@
return SomeChar(no_nul=str1.no_nul)
getitem.can_only_throw = []
- getitem_key = getitem
-
def getitem_idx((str1, int2)):
return SomeChar(no_nul=str1.no_nul)
getitem_idx.can_only_throw = [IndexError]
- getitem_idx_key = getitem_idx
-
def mul((str1, int2)): # xxx do we want to support this
return SomeString(no_nul=str1.no_nul)
@@ -604,14 +594,10 @@
return SomeUnicodeCodePoint()
getitem.can_only_throw = []
- getitem_key = getitem
-
def getitem_idx((str1, int2)):
return SomeUnicodeCodePoint()
getitem_idx.can_only_throw = [IndexError]
- getitem_idx_key = getitem_idx
-
def mul((str1, int2)): # xxx do we want to support this
return SomeUnicodeString()
diff --git a/rpython/flowspace/operation.py b/rpython/flowspace/operation.py
--- a/rpython/flowspace/operation.py
+++ b/rpython/flowspace/operation.py
@@ -422,8 +422,6 @@
add_operator('delattr', 2, dispatch=1, pyfunc=delattr)
add_operator('getitem', 2, dispatch=2, pure=True)
add_operator('getitem_idx', 2, dispatch=2, pure=True)
-add_operator('getitem_key', 2, dispatch=2, pure=True)
-add_operator('getitem_idx_key', 2, dispatch=2, pure=True)
add_operator('setitem', 3, dispatch=2)
add_operator('delitem', 2, dispatch=2)
add_operator('getslice', 3, dispatch=1, pyfunc=do_getslice, pure=True)
@@ -686,8 +684,6 @@
# the annotator tests
op.getitem.canraise = [IndexError, KeyError, Exception]
op.getitem_idx.canraise = [IndexError, KeyError, Exception]
-op.getitem_key.canraise = [IndexError, KeyError, Exception]
-op.getitem_idx_key.canraise = [IndexError, KeyError, Exception]
op.setitem.canraise = [IndexError, KeyError, Exception]
op.delitem.canraise = [IndexError, KeyError, Exception]
op.contains.canraise = [Exception] # from an r_dict
diff --git a/rpython/flowspace/test/test_objspace.py
b/rpython/flowspace/test/test_objspace.py
--- a/rpython/flowspace/test/test_objspace.py
+++ b/rpython/flowspace/test/test_objspace.py
@@ -867,7 +867,7 @@
raise
graph = self.codetest(f)
simplify_graph(graph)
- assert self.all_operations(graph) == {'getitem_idx_key': 1}
+ assert self.all_operations(graph) == {'getitem_idx': 1}
g = lambda: None
def f(c, x):
@@ -877,7 +877,7 @@
g()
graph = self.codetest(f)
simplify_graph(graph)
- assert self.all_operations(graph) == {'getitem_idx_key': 1,
+ assert self.all_operations(graph) == {'getitem_idx': 1,
'simple_call': 2}
def f(c, x):
@@ -896,7 +896,7 @@
raise
graph = self.codetest(f)
simplify_graph(graph)
- assert self.all_operations(graph) == {'getitem_key': 1}
+ assert self.all_operations(graph) == {'getitem': 1}
def f(c, x):
try:
@@ -915,7 +915,7 @@
graph = self.codetest(f)
simplify_graph(graph)
self.show(graph)
- assert self.all_operations(graph) == {'getitem_idx_key': 1}
+ assert self.all_operations(graph) == {'getitem_idx': 1}
def f(c, x):
try:
@@ -933,7 +933,7 @@
return -1
graph = self.codetest(f)
simplify_graph(graph)
- assert self.all_operations(graph) == {'getitem_key': 1}
+ assert self.all_operations(graph) == {'getitem': 1}
def f(c, x):
try:
diff --git a/rpython/rtyper/rlist.py b/rpython/rtyper/rlist.py
--- a/rpython/rtyper/rlist.py
+++ b/rpython/rtyper/rlist.py
@@ -268,13 +268,9 @@
v_res = hop.gendirectcall(llfn, c_func_marker, c_basegetitem, v_lst,
v_index)
return r_lst.recast(hop.llops, v_res)
- rtype_getitem_key = rtype_getitem
-
def rtype_getitem_idx((r_lst, r_int), hop):
return pair(r_lst, r_int).rtype_getitem(hop, checkidx=True)
- rtype_getitem_idx_key = rtype_getitem_idx
-
def rtype_setitem((r_lst, r_int), hop):
if hop.has_implicit_exception(IndexError):
spec = dum_checkidx
diff --git a/rpython/rtyper/rmodel.py b/rpython/rtyper/rmodel.py
--- a/rpython/rtyper/rmodel.py
+++ b/rpython/rtyper/rmodel.py
@@ -285,11 +285,9 @@
# default implementation for checked getitems
- def rtype_getitem_idx_key((r_c1, r_o1), hop):
+ def rtype_getitem_idx((r_c1, r_o1), hop):
return pair(r_c1, r_o1).rtype_getitem(hop)
- rtype_getitem_idx = rtype_getitem_idx_key
- rtype_getitem_key = rtype_getitem_idx_key
# ____________________________________________________________
diff --git a/rpython/rtyper/rstr.py b/rpython/rtyper/rstr.py
--- a/rpython/rtyper/rstr.py
+++ b/rpython/rtyper/rstr.py
@@ -580,13 +580,9 @@
hop.exception_cannot_occur()
return hop.gendirectcall(llfn, v_str, v_index)
- rtype_getitem_key = rtype_getitem
-
def rtype_getitem_idx((r_str, r_int), hop):
return pair(r_str, r_int).rtype_getitem(hop, checkidx=True)
- rtype_getitem_idx_key = rtype_getitem_idx
-
def rtype_mul((r_str, r_int), hop):
str_repr = r_str.repr
v_str, v_int = hop.inputargs(str_repr, Signed)
diff --git a/rpython/translator/simplify.py b/rpython/translator/simplify.py
--- a/rpython/translator/simplify.py
+++ b/rpython/translator/simplify.py
@@ -203,8 +203,6 @@
for exit in block.exits:
if exit.exitcase is IndexError:
postfx.append('idx')
- elif exit.exitcase is KeyError:
- postfx.append('key')
if postfx:
Op = getattr(op, '_'.join(['getitem'] + postfx))
newop = Op(*last_op.args)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit