[pypy-commit] pypy ClassRepr: create ClassRepr.init_vtable()

rlamy noreply at buildbot.pypy.org
Mon Oct 13 16:52:40 CEST 2014


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: ClassRepr
Changeset: r73917:3e758488822c
Date: 2014-10-13 15:40 +0100
http://bitbucket.org/pypy/pypy/changeset/3e758488822c/

Log:	create ClassRepr.init_vtable()

diff --git a/rpython/rtyper/rclass.py b/rpython/rtyper/rclass.py
--- a/rpython/rtyper/rclass.py
+++ b/rpython/rtyper/rclass.py
@@ -290,14 +290,18 @@
     def getvtable(self):
         """Return a ptr to the vtable of this type."""
         if self.vtable is None:
-            self.vtable = malloc(self.vtable_type, immortal=True)
-            self.setup_vtable(self.vtable, self)
+            self.init_vtable()
         return cast_vtable_to_typeptr(self.vtable)
 
     def getruntime(self, expected_type):
         assert expected_type == CLASSTYPE
         return self.getvtable()
 
+    def init_vtable(self):
+        """Create the actual vtable"""
+        self.vtable = malloc(self.vtable_type, immortal=True)
+        self.setup_vtable(self.vtable, self)
+
     def setup_vtable(self, vtable, rsubcls):
         """Initialize the 'self' portion of the 'vtable' belonging to the
         given subclass."""


More information about the pypy-commit mailing list