[pypy-svn] r56416 - in pypy/branch/oo-jit/pypy: jit/rainbow jit/rainbow/test rpython/ootypesystem
antocuni at codespeak.net
antocuni at codespeak.net
Thu Jul 10 15:57:04 CEST 2008
Author: antocuni
Date: Thu Jul 10 15:57:02 2008
New Revision: 56416
Modified:
pypy/branch/oo-jit/pypy/jit/rainbow/codewriter.py
pypy/branch/oo-jit/pypy/jit/rainbow/test/test_0tlc.py
pypy/branch/oo-jit/pypy/rpython/ootypesystem/ootype.py
Log:
make sure to check all subclasses when computing methodcodes. This fixes test_0tlc.
Modified: pypy/branch/oo-jit/pypy/jit/rainbow/codewriter.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/rainbow/codewriter.py (original)
+++ pypy/branch/oo-jit/pypy/jit/rainbow/codewriter.py Thu Jul 10 15:57:02 2008
@@ -1908,7 +1908,7 @@
def fill_methodcodes(self, INSTANCE, methname, graph2tsgraph):
class2typedesc = self.interpreter.class2typedesc
- TYPES = [INSTANCE] + INSTANCE._subclasses
+ TYPES = INSTANCE._all_subclasses()
for T in TYPES:
descindex = self.structtypedesc_position(T)
desc = self.structtypedescs[descindex]
Modified: pypy/branch/oo-jit/pypy/jit/rainbow/test/test_0tlc.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/rainbow/test/test_0tlc.py (original)
+++ pypy/branch/oo-jit/pypy/jit/rainbow/test/test_0tlc.py Thu Jul 10 15:57:02 2008
@@ -73,6 +73,3 @@
class TestOOType(OOTypeMixin, BaseTestTLC):
type_system = "ootype"
to_rstr = staticmethod(OOSupport.to_rstr)
-
- def test_nth_item(self):
- py.test.skip('in progress')
Modified: pypy/branch/oo-jit/pypy/rpython/ootypesystem/ootype.py
==============================================================================
--- pypy/branch/oo-jit/pypy/rpython/ootypesystem/ootype.py (original)
+++ pypy/branch/oo-jit/pypy/rpython/ootypesystem/ootype.py Thu Jul 10 15:57:02 2008
@@ -118,6 +118,21 @@
assert isinstance(INSTANCE, Instance)
self._subclasses.append(INSTANCE)
+ def _all_subclasses(self):
+ """
+ Transitive closure on self._subclasses.
+
+ Return a set containing all direct and indirect subclasses,
+ including itself.
+ """
+ res = set()
+ stack = [self]
+ while stack:
+ item = stack.pop()
+ res.add(item)
+ stack += item._subclasses
+ return res
+
def _add_fields(self, fields):
fields = fields.copy() # mutated below
for name, defn in fields.iteritems():
More information about the Pypy-commit
mailing list