[pypy-svn] r69281 - pypy/trunk/pypy/annotation
fijal at codespeak.net
fijal at codespeak.net
Sat Nov 14 14:40:21 CET 2009
Author: fijal
Date: Sat Nov 14 14:40:21 2009
New Revision: 69281
Modified:
pypy/trunk/pypy/annotation/description.py
Log:
(arigo, fijal) Improve speec of jitting by not looping over all
callfamilies (2/2)
Modified: pypy/trunk/pypy/annotation/description.py
==============================================================================
--- pypy/trunk/pypy/annotation/description.py (original)
+++ pypy/trunk/pypy/annotation/description.py Sat Nov 14 14:40:21 2009
@@ -14,6 +14,7 @@
"""
overridden = False
normalized = False
+ modified = True
def __init__(self, desc):
self.descs = { desc: True }
@@ -21,6 +22,7 @@
self.total_calltable_size = 0
def update(self, other):
+ self.modified = True
self.normalized = self.normalized or other.normalized
self.descs.update(other.descs)
for shape, table in other.calltables.items():
@@ -33,7 +35,7 @@
# call at which call site. Each call site gets a row of graphs,
# sharable with other call sites. Each column is a FunctionDesc.
# There is one such table per "call shape".
- table = self.calltables.setdefault(callshape, [])
+ table = self.calltables.get(callshape, [])
for i, existing_row in enumerate(table):
if existing_row == row: # XXX maybe use a dict again here?
return i
@@ -43,6 +45,7 @@
try:
self.calltable_lookup_row(callshape, row)
except LookupError:
+ self.modified = True
table = self.calltables.setdefault(callshape, [])
table.append(row)
self.total_calltable_size += 1
@@ -802,6 +805,15 @@
self.knowntype = new_or_old_class(pyobj)
assert bool(pyobj), "__nonzero__ unsupported on frozen PBC %r" %(pyobj,)
+ def has_attribute(self, attr):
+ if attr in self.attrcache:
+ return True
+ try:
+ self._read_attribute(attr)
+ return True
+ except AttributeError:
+ return False
+
def read_attribute(self, attr):
try:
return self.attrcache[attr]
More information about the Pypy-commit
mailing list