Author: Carl Friedrich Bolz <[email protected]>
Branch: spaceops-are-variables
Changeset: r74245:2d79939d2e76
Date: 2014-10-26 13:41 +0100
http://bitbucket.org/pypy/pypy/changeset/2d79939d2e76/
Log: fix the annotator
diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
--- a/rpython/annotator/annrpython.py
+++ b/rpython/annotator/annrpython.py
@@ -581,8 +581,8 @@
elif resultcell == annmodel.s_ImpossibleValue:
raise BlockedInference(self, op, -1) # the operation cannot succeed
assert isinstance(resultcell, annmodel.SomeObject)
- assert isinstance(op.result, Variable)
- self.setbinding(op.result, resultcell) # bind resultcell to op.result
+ assert isinstance(op, Variable)
+ self.setbinding(op, resultcell) # bind resultcell to op
class BlockedInference(Exception):
diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py
--- a/rpython/annotator/bookkeeper.py
+++ b/rpython/annotator/bookkeeper.py
@@ -96,7 +96,7 @@
yield op
# some blocks are partially annotated
- if annotation(op.result) is None:
+ if annotation(op) is None:
break # ignore the unannotated part
for call_op in call_sites():
@@ -152,7 +152,7 @@
s_callable = self.immutablevalue(adtmeth.func)
args_s = [lltype_to_annotation(adtmeth.ll_ptrtype)] + args_s
if isinstance(s_callable, SomePBC):
- s_result = annotation(call_op.result)
+ s_result = annotation(call_op)
if s_result is None:
s_result = s_ImpossibleValue
args = call_op.build_args(args_s)
@@ -502,7 +502,7 @@
# needed by some kinds of specialization.
fn, block, i = self.position_key
op = block.operations[i]
- s_previous_result = self.annotator.annotation(op.result)
+ s_previous_result = self.annotator.annotation(op)
if s_previous_result is None:
s_previous_result = s_ImpossibleValue
else:
diff --git a/rpython/annotator/specialize.py b/rpython/annotator/specialize.py
--- a/rpython/annotator/specialize.py
+++ b/rpython/annotator/specialize.py
@@ -31,11 +31,11 @@
argnames, vararg, kwarg = graph.signature
assert vararg, "graph should have a *arg at this point"
assert not kwarg, "where does this **arg come from??"
+ starargs = [Variable('stararg%d'%i) for i in range(nb_extra_args)]
+ newtup = op.newtuple(*starargs)
argscopy = [Variable(v) for v in graph.getargs()]
- starargs = [Variable('stararg%d'%i) for i in range(nb_extra_args)]
+ argscopy[-1] = newtup
newstartblock = Block(argscopy[:-1] + starargs)
- newtup = op.newtuple(*starargs)
- newtup.result = argscopy[-1]
newstartblock.operations.append(newtup)
newstartblock.closeblock(Link(argscopy, graph.startblock))
graph.startblock = newstartblock
diff --git a/rpython/annotator/test/test_annrpython.py
b/rpython/annotator/test/test_annrpython.py
--- a/rpython/annotator/test/test_annrpython.py
+++ b/rpython/annotator/test/test_annrpython.py
@@ -75,7 +75,7 @@
block = Block([x])
fun = FunctionGraph("f", block)
block.operations.append(oper)
- block.closeblock(Link([oper.result], fun.returnblock))
+ block.closeblock(Link([oper], fun.returnblock))
a = self.RPythonAnnotator()
a.addpendingblock(fun, fun.startblock, [annmodel.SomeInteger()])
a.complete()
@@ -98,11 +98,11 @@
fun = FunctionGraph("f", headerblock)
headerblock.operations.append(conditionop)
- headerblock.exitswitch = conditionop.result
+ headerblock.exitswitch = conditionop
headerblock.closeblock(Link([i1], fun.returnblock, False),
Link([i1], whileblock, True))
whileblock.operations.append(decop)
- whileblock.closeblock(Link([decop.result], headerblock))
+ whileblock.closeblock(Link([decop], headerblock))
a = self.RPythonAnnotator()
a.addpendingblock(fun, fun.startblock, [annmodel.SomeInteger()])
@@ -135,12 +135,12 @@
fun = FunctionGraph("f", startblock)
startblock.closeblock(Link([i1, Constant(0)], headerblock))
headerblock.operations.append(conditionop)
- headerblock.exitswitch = conditionop.result
+ headerblock.exitswitch = conditionop
headerblock.closeblock(Link([sum2], fun.returnblock, False),
Link([i2, sum2], whileblock, True))
whileblock.operations.append(addop)
whileblock.operations.append(decop)
- whileblock.closeblock(Link([decop.result, addop.result], headerblock))
+ whileblock.closeblock(Link([decop, addop], headerblock))
a = self.RPythonAnnotator()
a.addpendingblock(fun, fun.startblock, [annmodel.SomeInteger()])
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit