[pypy-svn] r31726 - in pypy/dist/pypy/translator/backendopt: . test
mwh at codespeak.net
mwh at codespeak.net
Sun Aug 27 13:50:07 CEST 2006
Author: mwh
Date: Sun Aug 27 13:50:06 2006
New Revision: 31726
Modified:
pypy/dist/pypy/translator/backendopt/removenoops.py
pypy/dist/pypy/translator/backendopt/test/test_removenoops.py
Log:
kill the remove_void transformation -- it mutated the startblocks input args
without caring about the type of any function pointers. and nothing used it.
Modified: pypy/dist/pypy/translator/backendopt/removenoops.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/removenoops.py (original)
+++ pypy/dist/pypy/translator/backendopt/removenoops.py Sun Aug 27 13:50:06 2006
@@ -46,19 +46,6 @@
def remove_same_as(graph):
remove_unaryops(graph, ["same_as"])
-
-def remove_void(translator):
- for graph in translator.graphs:
- args = [arg for arg in graph.startblock.inputargs
- if arg.concretetype is not Void]
- graph.startblock.inputargs = args
- for block in graph.iterblocks():
- for op in block.operations:
- if op.opname in ('direct_call', 'indirect_call'):
- args = [arg for arg in op.args
- if arg.concretetype is not Void]
- op.args = args
-
def remove_duplicate_casts(graph, translator):
simplify.join_blocks(graph)
num_removed = 0
Modified: pypy/dist/pypy/translator/backendopt/test/test_removenoops.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/test/test_removenoops.py (original)
+++ pypy/dist/pypy/translator/backendopt/test/test_removenoops.py Sun Aug 27 13:50:06 2006
@@ -1,4 +1,4 @@
-from pypy.translator.backendopt.removenoops import remove_void, remove_same_as, \
+from pypy.translator.backendopt.removenoops import remove_same_as, \
remove_unaryops, remove_duplicate_casts, remove_superfluous_keep_alive
from pypy.translator.backendopt.inline import simple_inline_function
from pypy.translator.backendopt.test.test_propagate import getops, get_graph, check_graph
@@ -13,39 +13,6 @@
import py
log = py.log.Producer('test_backendoptimization')
-
-def annotate_and_remove_void(f, annotate):
- t = TranslationContext()
- t.buildannotator().build_types(f, annotate)
- t.buildrtyper().specialize()
- remove_void(t)
- return t
-
-def test_remove_void_args():
- def f(i):
- return [1,2,3,i][i]
- t = annotate_and_remove_void(f, [int])
- for graph in t.graphs:
- assert checkgraph(graph) is None
- for arg in graph.startblock.inputargs:
- assert arg.concretetype is not lltype.Void
- interp = LLInterpreter(t.rtyper)
- assert interp.eval_graph(graphof(t, f), [0]) == 1
-
-def test_remove_void_in_struct():
- t = annotate_and_remove_void(simple_method, [int])
- #t.view()
- for graph in t.graphs:
- log('func : ' + graph.name)
- log('graph: ' + str(graph))
- assert checkgraph(graph) is None
- #for fieldname in self.struct._names: #XXX helper (in lltype?) should remove these voids
- # type_ = getattr(struct, fieldname)
- # log('fieldname=%(fieldname)s , type_=%(type_)s' % locals())
- # assert _type is not lltype.Void
- #interp = LLInterpreter(t.flowgraphs, t.rtyper)
- #assert interp.eval_function(f, [0]) == 1
-
def test_remove_same_as():
def nothing(x):
return x
More information about the Pypy-commit
mailing list