[pypy-commit] pypy reflowing: compute v_result earlier
rlamy
pypy.commits at gmail.com
Mon Nov 21 16:09:50 EST 2016
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: reflowing
Changeset: r88531:37d9b461b481
Date: 2016-11-21 05:01 +0000
http://bitbucket.org/pypy/pypy/changeset/37d9b461b481/
Log: compute v_result earlier
diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
--- a/rpython/annotator/annrpython.py
+++ b/rpython/annotator/annrpython.py
@@ -270,17 +270,20 @@
tag = parent_block, parent_index
self.translator.update_call_graph(parent_graph, graph, tag)
+ def get_result_var(self, position_key):
+ _, block, index = position_key
+ op = block.operations[index]
+ v_result = op.result
+ self.var_def[v_result] = position_key
+ return v_result
- def recursivecall(self, graph, whence, inputcells):
+
+ def recursivecall(self, graph, whence, inputcells, v_result):
if whence is not None:
self.record_call(graph, whence)
- _, block, index = whence
- op = block.operations[index]
- v_result = op.result
- self.var_def[v_result] = whence
- # self.notify[graph.returnblock] is a set of call
- # points to this func which triggers a reflow whenever the
- # return block of this graph has been analysed.
+ 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)
diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py
--- a/rpython/annotator/bookkeeper.py
+++ b/rpython/annotator/bookkeeper.py
@@ -508,9 +508,10 @@
op = None
s_previous_result = s_ImpossibleValue
+ v_result = self.annotator.get_result_var(whence) if whence is not None else None
results = []
for desc in pbc.descriptions:
- results.append(desc.pycall(whence, args, s_previous_result, op))
+ results.append(desc.pycall(whence, args, s_previous_result, v_result, op))
s_result = unionof(*results)
return s_result
diff --git a/rpython/annotator/classdesc.py b/rpython/annotator/classdesc.py
--- a/rpython/annotator/classdesc.py
+++ b/rpython/annotator/classdesc.py
@@ -701,7 +701,7 @@
self._init_classdef()
return self.classdef
- def pycall(self, whence, args, s_previous_result, op=None):
+ def pycall(self, whence, args, s_previous_result, v_result, op=None):
from rpython.annotator.model import SomeInstance, SomeImpossibleValue
classdef = self.getuniqueclassdef()
s_instance = SomeInstance(classdef)
diff --git a/rpython/annotator/description.py b/rpython/annotator/description.py
--- a/rpython/annotator/description.py
+++ b/rpython/annotator/description.py
@@ -312,7 +312,7 @@
else:
return self.specializer(self, inputcells)
- def pycall(self, whence, args, s_previous_result, op=None):
+ def pycall(self, whence, args, s_previous_result, v_result, op=None):
inputcells = self.parse_arguments(args)
result = self.specialize(inputcells, op)
if isinstance(result, FunctionGraph):
@@ -323,7 +323,7 @@
# recreate the args object because inputcells may have been changed
new_args = args.unmatch_signature(self.signature, inputcells)
inputcells = self.parse_arguments(new_args, graph)
- result = annotator.recursivecall(graph, whence, inputcells)
+ result = annotator.recursivecall(graph, whence, inputcells, v_result)
signature = getattr(self.pyobj, '_signature_', None)
if signature:
sigresult = enforce_signature_return(self, signature[1], result)
@@ -437,9 +437,9 @@
s_instance = SomeInstance(self.selfclassdef, flags=self.flags)
return args.prepend(s_instance)
- def pycall(self, whence, args, s_previous_result, op=None):
+ def pycall(self, whence, args, s_previous_result, v_result, op=None):
func_args = self.func_args(args)
- return self.funcdesc.pycall(whence, func_args, s_previous_result, op)
+ return self.funcdesc.pycall(whence, func_args, s_previous_result, v_result, op)
def get_graph(self, args, op):
func_args = self.func_args(args)
@@ -617,9 +617,9 @@
s_self = SomePBC([self.frozendesc])
return args.prepend(s_self)
- def pycall(self, whence, args, s_previous_result, op=None):
+ def pycall(self, whence, args, s_previous_result, v_result, op=None):
func_args = self.func_args(args)
- return self.funcdesc.pycall(whence, func_args, s_previous_result, op)
+ return self.funcdesc.pycall(whence, func_args, s_previous_result, v_result, op)
def get_graph(self, args, op):
func_args = self.func_args(args)
More information about the pypy-commit
mailing list