Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r50873:d373deb39b4d Date: 2011-12-26 15:22 +0100 http://bitbucket.org/pypy/pypy/changeset/d373deb39b4d/
Log: Simplify the graph before turning it into a generator, to get rid of the extra variables passed around. diff --git a/pypy/translator/generator.py b/pypy/translator/generator.py --- a/pypy/translator/generator.py +++ b/pypy/translator/generator.py @@ -2,7 +2,7 @@ from pypy.objspace.flow.model import Variable, Constant, FunctionGraph from pypy.translator.unsimplify import insert_empty_startblock from pypy.translator.unsimplify import split_block -from pypy.translator.simplify import eliminate_empty_blocks +from pypy.translator.simplify import eliminate_empty_blocks, simplify_graph from pypy.tool.sourcetools import func_with_new_name from pypy.interpreter.argument import Signature @@ -64,6 +64,7 @@ def next(self): entry = self.current self.current = None + assert entry is not None # else, recursive generator invocation (next_entry, return_value) = func(entry) self.current = next_entry return return_value @@ -91,6 +92,10 @@ block.inputargs = [v_entry1] def tweak_generator_body_graph(Entry, graph): + # First, always run simplify_graph in order to reduce the number of + # variables passed around + simplify_graph(graph) + # assert graph.startblock.operations[0].opname == 'generator_mark' graph.startblock.operations.pop(0) # _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit