Author: Ronan Lamy <[email protected]>
Branch: ClassRepr
Changeset: r73919:71bedd75041c
Date: 2014-10-13 15:52 +0100
http://bitbucket.org/pypy/pypy/changeset/71bedd75041c/
Log: make ClassRepr.setup_vtable() non-recursive
diff --git a/rpython/rtyper/rclass.py b/rpython/rtyper/rclass.py
--- a/rpython/rtyper/rclass.py
+++ b/rpython/rtyper/rclass.py
@@ -300,7 +300,13 @@
def init_vtable(self):
"""Create the actual vtable"""
self.vtable = malloc(self.vtable_type, immortal=True)
- self.setup_vtable(self.vtable, self)
+ vtable_part = self.vtable
+ r_parentcls = self
+ while r_parentcls.classdef is not None:
+ r_parentcls.setup_vtable(vtable_part, self)
+ vtable_part = vtable_part.super
+ r_parentcls = r_parentcls.rbase
+ r_parentcls.setup_vtable(vtable_part, self)
def setup_vtable(self, vtable, rsubcls):
"""Initialize the 'self' portion of the 'vtable' belonging to the
@@ -331,9 +337,6 @@
if attrvalue is not None:
assign(mangled_name, attrvalue)
- # then initialize the 'super' portion of the vtable
- self.rbase.setup_vtable(vtable.super, rsubcls)
-
def fromtypeptr(self, vcls, llops):
"""Return the type pointer cast to self's vtable type."""
self.setup()
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit