[pypy-commit] pypy ssa-flow: give Variables the right name from the start
rlamy
noreply at buildbot.pypy.org
Wed Nov 12 19:43:11 CET 2014
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: ssa-flow
Changeset: r74489:390372be1886
Date: 2013-08-15 17:41 +0100
http://bitbucket.org/pypy/pypy/changeset/390372be1886/
Log: give Variables the right name from the start
diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py
--- a/rpython/flowspace/flowcontext.py
+++ b/rpython/flowspace/flowcontext.py
@@ -81,12 +81,8 @@
self.last_exception = last_exception
def fixeggblocks(graph):
- varnames = graph.func.func_code.co_varnames
for block in graph.iterblocks():
if isinstance(block, SpamBlock):
- for name, w_value in zip(varnames, block.framestate.mergeable):
- if isinstance(w_value, Variable):
- w_value.rename(name)
del block.framestate # memory saver
eliminate_empty_blocks(graph)
SSA_to_SSI(graph)
@@ -494,6 +490,10 @@
block = None
newblock = SpamBlock(newstate)
+ varnames = self.pycode.co_varnames
+ for name, w_value in zip(varnames, newstate.mergeable):
+ if isinstance(w_value, Variable):
+ w_value.rename(name)
# unconditionally link the current block to the newblock
outputargs = currentstate.getoutputargs(newstate)
link = Link(outputargs, newblock)
diff --git a/rpython/flowspace/pygraph.py b/rpython/flowspace/pygraph.py
--- a/rpython/flowspace/pygraph.py
+++ b/rpython/flowspace/pygraph.py
@@ -13,7 +13,7 @@
from rpython.flowspace.flowcontext import SpamBlock
data = [None] * code.co_nlocals
for i in range(code.formalargcount):
- data[i] = Variable()
+ data[i] = Variable(code.co_varnames[i])
state = FrameState(data + [Constant(None), Constant(None)], [], 0)
initialblock = SpamBlock(state)
super(PyGraph, self).__init__(self._sanitize_funcname(func), initialblock)
More information about the pypy-commit
mailing list