[pypy-svn] r62480 - pypy/branch/pyjitpl5/pypy/jit/metainterp
fijal at codespeak.net
fijal at codespeak.net
Tue Mar 3 16:44:14 CET 2009
Author: fijal
Date: Tue Mar 3 16:44:13 2009
New Revision: 62480
Modified:
pypy/branch/pyjitpl5/pypy/jit/metainterp/virtualizable.py
Log:
allow for searching also in parent structures. I *hope* this is the correct
thing to do
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/virtualizable.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/virtualizable.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/virtualizable.py Tue Mar 3 16:44:13 2009
@@ -5,12 +5,22 @@
from pypy.annotation.model import lltype_to_annotation
from pypy.rlib.objectmodel import we_are_translated
+def get_field(cpu, STRUCT, fieldname):
+ s = STRUCT
+ while True:
+ if fieldname in s._flds:
+ return cpu.fielddescrof(s, fieldname)
+ if 'super' in s._flds:
+ s = s.super
+ else:
+ raise AttributeError("%r has no attribute %s" % (STRUCT, fieldname))
+
class VirtualizableDesc(history.AbstractValue):
hash = 0
def __init__(self, cpu, TOPSTRUCT):
"NOT_RPYTHON"
- self.virtuals = [cpu.fielddescrof(TOPSTRUCT, 'inst_' + name) for
+ self.virtuals = [get_field(cpu, TOPSTRUCT, 'inst_' + name) for
name in TOPSTRUCT._hints['virtuals']]
initialize_virtualizable(cpu, TOPSTRUCT.access)
self.vable_base = cpu.fielddescrof(TOPSTRUCT, 'vable_base')
More information about the Pypy-commit
mailing list