[pypy-commit] pypy callfamily: cleanup
rlamy
noreply at buildbot.pypy.org
Mon Apr 20 04:52:40 CEST 2015
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: callfamily
Changeset: r76841:053f28ada18a
Date: 2015-04-20 03:52 +0100
http://bitbucket.org/pypy/pypy/changeset/053f28ada18a/
Log: cleanup
diff --git a/rpython/rtyper/rpbc.py b/rpython/rtyper/rpbc.py
--- a/rpython/rtyper/rpbc.py
+++ b/rpython/rtyper/rpbc.py
@@ -70,6 +70,17 @@
class ConcreteCallTableRow(dict):
"""A row in a concrete call table."""
+ @classmethod
+ def from_row(cls, rtyper, row):
+ concreterow = cls()
+ for funcdesc, graph in row.items():
+ llfn = rtyper.getcallable(graph)
+ concreterow[funcdesc] = llfn
+ assert len(concreterow) > 0
+ # 'typeOf(llfn)' should be the same for all graphs
+ concreterow.fntype = typeOf(llfn)
+ return concreterow
+
class LLCallTable(object):
"""A call table of a call family with low-level functions."""
@@ -124,17 +135,9 @@
concreterows = {}
for shape, rows in callfamily.calltables.items():
for index, row in enumerate(rows):
- concreterow = ConcreteCallTableRow()
- for funcdesc, graph in row.items():
- llfn = rtyper.getcallable(graph)
- concreterow[funcdesc] = llfn
- assert len(concreterow) > 0
- # 'llfn' should be the same for all graphs
- concreterow.fntype = typeOf(llfn)
+ concreterow = ConcreteCallTableRow.from_row(rtyper, row)
concreterows[shape, index] = concreterow
-
- for row in concreterows.values():
- llct.add(row)
+ llct.add(concreterow)
for (shape, index), row in concreterows.items():
existingindex, biggerrow = llct.lookup(row)
More information about the pypy-commit
mailing list