[pypy-commit] pypy reflowing: Attach notifications to variables rather than blocks
rlamy
pypy.commits at gmail.com
Fri Nov 25 08:31:04 EST 2016
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: reflowing
Changeset: r88664:4b2aca8c3977
Date: 2016-11-25 06:55 +0000
http://bitbucket.org/pypy/pypy/changeset/4b2aca8c3977/
Log: Attach notifications to variables rather than blocks
diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
--- a/rpython/annotator/annrpython.py
+++ b/rpython/annotator/annrpython.py
@@ -294,6 +294,10 @@
self.var_def[v_result] = position_key
return v_result
+ def add_notification(self, v_src, v_target):
+ successors = self.notify.setdefault(v_src, set())
+ successors.add(v_target)
+
def update_var(self, v):
position_key = self.var_def[v]
self.reflowfromposition(position_key)
@@ -449,6 +453,10 @@
return repr(graph) + blk + opid
def flowin(self, graph, block):
+ for v in block.inputargs:
+ if v in self.notify:
+ for v2 in self.notify[v]:
+ self.update_var(v2)
try:
i = 0
while i < len(block.operations):
@@ -534,10 +542,6 @@
constraints = knowntypedata.get(link.exitcase, {})
self.follow_link(graph, link, constraints)
- if block in self.notify:
- for v in self.notify[block]:
- self.update_var(v)
-
def follow_link(self, graph, link, constraints):
assert not (isinstance(link.exitcase, (types.ClassType, type)) and
issubclass(link.exitcase, BaseException))
diff --git a/rpython/annotator/description.py b/rpython/annotator/description.py
--- a/rpython/annotator/description.py
+++ b/rpython/annotator/description.py
@@ -293,10 +293,7 @@
if whence is not None:
annotator.record_call(graph, whence)
if v_result is not None:
- # annotator.notify[graph.returnblock] is a set of variables to update
- # whenever the return block of this graph has been analysed.
- returnvars = annotator.notify.setdefault(graph.returnblock, set())
- returnvars.add(v_result)
+ annotator.add_notification(graph.getreturnvar(), v_result)
# generalize the function's input arguments
annotator.addpendinggraph(graph, inputcells)
More information about the pypy-commit
mailing list