Author: Ronan Lamy <[email protected]>
Branch: reflowing
Changeset: r88532:db07794f9b14
Date: 2016-11-21 05:25 +0000
http://bitbucket.org/pypy/pypy/changeset/db07794f9b14/
Log: Remove s_previous_result argument:
The annotation that is passed in is, in general, unrelated to the
thing being annotated.
diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py
--- a/rpython/annotator/bookkeeper.py
+++ b/rpython/annotator/bookkeeper.py
@@ -493,25 +493,23 @@
"""
if emulated is None:
whence = self.position_key
- # fish the existing annotation for the result variable,
- # needed by some kinds of specialization.
- fn, block, i = self.position_key
+ elif emulated is True:
+ whence = None
+ else:
+ whence = emulated
+
+ if whence is not None:
+ fn, block, i = whence
op = block.operations[i]
- s_previous_result = self.annotator.annotation(op.result)
- if s_previous_result is None:
- s_previous_result = s_ImpossibleValue
+ v_result = op.result
+ self.annotator.var_def[v_result] = whence
else:
- if emulated is True:
- whence = None
- else:
- whence = emulated # callback case
op = None
- s_previous_result = s_ImpossibleValue
+ v_result = None
- 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,
v_result, op))
+ results.append(desc.pycall(whence, args, 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, v_result, op=None):
+ def pycall(self, whence, args, 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, v_result, op=None):
+ def pycall(self, whence, args, v_result, op=None):
inputcells = self.parse_arguments(args)
result = self.specialize(inputcells, op)
if isinstance(result, FunctionGraph):
@@ -331,11 +331,6 @@
annotator.addpendingblock(
graph, graph.returnblock, [sigresult])
result = sigresult
- # Some specializations may break the invariant of returning
- # annotations that are always more general than the previous time.
- # We restore it here:
- from rpython.annotator.model import unionof
- result = unionof(result, s_previous_result)
return result
def get_graph(self, args, op):
@@ -437,9 +432,9 @@
s_instance = SomeInstance(self.selfclassdef, flags=self.flags)
return args.prepend(s_instance)
- def pycall(self, whence, args, s_previous_result, v_result, op=None):
+ def pycall(self, whence, args, v_result, op=None):
func_args = self.func_args(args)
- return self.funcdesc.pycall(whence, func_args, s_previous_result,
v_result, op)
+ return self.funcdesc.pycall(whence, func_args, v_result, op)
def get_graph(self, args, op):
func_args = self.func_args(args)
@@ -617,9 +612,9 @@
s_self = SomePBC([self.frozendesc])
return args.prepend(s_self)
- def pycall(self, whence, args, s_previous_result, v_result, op=None):
+ def pycall(self, whence, args, v_result, op=None):
func_args = self.func_args(args)
- return self.funcdesc.pycall(whence, func_args, s_previous_result,
v_result, op)
+ return self.funcdesc.pycall(whence, func_args, v_result, op)
def get_graph(self, args, op):
func_args = self.func_args(args)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit