[pypy-commit] pypy less-stringly-ops: do the dispatch of consider_op() inside a method of SpaceOperation
rlamy
noreply at buildbot.pypy.org
Fri Nov 22 00:02:43 CET 2013
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: less-stringly-ops
Changeset: r68277:2b2a6f11274e
Date: 2013-11-21 23:33 +0100
http://bitbucket.org/pypy/pypy/changeset/2b2a6f11274e/
Log: do the dispatch of consider_op() inside a method of SpaceOperation
diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
--- a/rpython/annotator/annrpython.py
+++ b/rpython/annotator/annrpython.py
@@ -584,10 +584,6 @@
def consider_op(self, block, opindex):
op = block.operations[opindex]
argcells = [self.binding(a) for a in op.args]
- consider_meth = getattr(self,'consider_op_'+op.opname,
- None)
- if not consider_meth:
- raise Exception,"unknown op: %r" % op
# let's be careful about avoiding propagated SomeImpossibleValues
# to enter an op; the latter can result in violations of the
@@ -599,7 +595,7 @@
if isinstance(arg, annmodel.SomeImpossibleValue):
raise BlockedInference(self, op, opindex)
try:
- resultcell = consider_meth(*argcells)
+ resultcell = op.consider(self, *argcells)
except annmodel.AnnotatorError as e: # note that UnionError is a subclass
graph = self.bookkeeper.position_key[0]
e.source = gather_error(self, graph, block, opindex)
diff --git a/rpython/flowspace/model.py b/rpython/flowspace/model.py
--- a/rpython/flowspace/model.py
+++ b/rpython/flowspace/model.py
@@ -439,6 +439,12 @@
newresult = mapping.get(self.result, self.result)
return type(self)(self.opname, newargs, newresult, self.offset)
+ def consider(self, annotator, *argcells):
+ consider_meth = getattr(annotator, 'consider_op_' + self.opname, None)
+ if not consider_meth:
+ raise Exception("unknown op: %r" % op)
+ return consider_meth(*argcells)
+
class Atom(object):
def __init__(self, name):
self.__name__ = name # make save_global happy
More information about the pypy-commit
mailing list