[pypy-svn] r20199 - in pypy/branch/somepbc-refactoring/pypy: annotation rpython
pedronis at codespeak.net
pedronis at codespeak.net
Wed Nov 23 22:13:32 CET 2005
Author: pedronis
Date: Wed Nov 23 22:13:31 2005
New Revision: 20199
Modified:
pypy/branch/somepbc-refactoring/pypy/annotation/description.py
pypy/branch/somepbc-refactoring/pypy/rpython/rpbc.py
Log:
(arigo, pedronis)
2 more tests pass. Deal with the problem of row_to_consider needing a entered bookkeeper
introduced a further static-method helper on FunctionDesc variant_for_call_site returning
a shape and index and with arguments similar to consider_call_site.
Modified: pypy/branch/somepbc-refactoring/pypy/annotation/description.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/annotation/description.py (original)
+++ pypy/branch/somepbc-refactoring/pypy/annotation/description.py Wed Nov 23 22:13:31 2005
@@ -185,6 +185,17 @@
family.calltable_add_row(args.rawshape(), row)
consider_call_site = staticmethod(consider_call_site)
+ def variant_for_call_site(bookkeeper, family, descs, args):
+ bookkeeper.enter(None)
+ try:
+ row = FunctionDesc.row_to_consider(descs, args)
+ finally:
+ bookkeeper.leave()
+ shape = args.rawshape()
+ index = family.calltable_lookup_row(shape, row)
+ return shape, index
+ variant_for_call_site = staticmethod(variant_for_call_site)
+
def row_to_consider(descs, args):
# see comments in CallFamily
from pypy.annotation.model import s_ImpossibleValue
Modified: pypy/branch/somepbc-refactoring/pypy/rpython/rpbc.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/rpython/rpbc.py (original)
+++ pypy/branch/somepbc-refactoring/pypy/rpython/rpbc.py Wed Nov 23 22:13:31 2005
@@ -224,7 +224,7 @@
else:
XXX_later
- def convert_to_concrete_llfn(self, v, index, shape, llop):
+ def convert_to_concrete_llfn(self, v, shape, index, llop):
"""Convert the variable 'v' to a variable referring to a concrete
low-level function. In case the call table contains multiple rows,
'index' and 'shape' tells which of its items we are interested in.
@@ -252,12 +252,11 @@
bk = self.rtyper.annotator.bookkeeper
args = bk.build_args(opname, hop.args_s[1:])
descs = self.s_pbc.descriptions.keys()
- row = description.FunctionDesc.row_to_consider(descs, args)
- index = self.callfamily.calltable_lookup_row(args.rawshape(), row)
- row_of_graphs = self.callfamily.calltables[args.rawshape()][index]
+ shape, index = description.FunctionDesc.variant_for_call_site(bk, self.callfamily, descs, args)
+ row_of_graphs = self.callfamily.calltables[shape][index]
anygraph = row_of_graphs.itervalues().next() # pick any witness
vfn = hop.inputarg(self, arg=0)
- vlist = [self.convert_to_concrete_llfn(vfn, index, args.rawshape(),
+ vlist = [self.convert_to_concrete_llfn(vfn, shape, index,
hop.llops)]
vlist += callparse.callparse(self.rtyper, anygraph, hop, opname)
rresult = callparse.getrresult(self.rtyper, anygraph)
More information about the Pypy-commit
mailing list