[pypy-commit] pypy reflowing: Inline ann.recursivecall() into its only caller
rlamy
pypy.commits at gmail.com
Fri Nov 25 08:31:03 EST 2016
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: reflowing
Changeset: r88663:ce4e321b09fa
Date: 2016-11-25 05:48 +0000
http://bitbucket.org/pypy/pypy/changeset/ce4e321b09fa/
Log: Inline ann.recursivecall() into its only caller
diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
--- a/rpython/annotator/annrpython.py
+++ b/rpython/annotator/annrpython.py
@@ -294,28 +294,6 @@
self.var_def[v_result] = position_key
return v_result
-
- def recursivecall(self, graph, whence, inputcells, v_result):
- if whence is not None:
- self.record_call(graph, whence)
- if v_result is not None:
- # self.notify[graph.returnblock] is a set of variables to update
- # whenever the return block of this graph has been analysed.
- returnvars = self.notify.setdefault(graph.returnblock, set())
- returnvars.add(v_result)
-
- # generalize the function's input arguments
- self.addpendingblock(graph, graph.startblock, inputcells)
-
- # get the (current) return value
- v = graph.getreturnvar()
- try:
- return self.binding(v)
- except KeyError:
- # the function didn't reach any return statement so far.
- # (some functions actually never do, they always raise exceptions)
- return s_ImpossibleValue
-
def update_var(self, v):
position_key = self.var_def[v]
self.reflowfromposition(position_key)
diff --git a/rpython/annotator/description.py b/rpython/annotator/description.py
--- a/rpython/annotator/description.py
+++ b/rpython/annotator/description.py
@@ -290,7 +290,20 @@
new_args = args.unmatch_signature(self.signature, inputcells)
inputcells = self.parse_arguments(new_args, graph)
annotator = self.bookkeeper.annotator
- result = annotator.recursivecall(graph, whence, inputcells, v_result)
+ 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)
+
+ # generalize the function's input arguments
+ annotator.addpendinggraph(graph, inputcells)
+
+ result = graph.getreturnvar().annotation
+ if result is None:
+ result = s_ImpossibleValue
signature = getattr(self.pyobj, '_signature_', None)
if signature:
sigresult = enforce_signature_return(self, signature[1], result)
More information about the pypy-commit
mailing list