[pypy-svn] r51754 - pypy/branch/unified-rtti/pypy/rpython/memory/gctransform

arigo at codespeak.net arigo at codespeak.net
Thu Feb 21 17:59:19 CET 2008


Author: arigo
Date: Thu Feb 21 17:59:18 2008
New Revision: 51754

Modified:
   pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/boehm.py
   pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/refcounting.py
   pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/transform.py
Log:
Shuffle in preparation of porting the framework transformer.


Modified: pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/boehm.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/boehm.py	(original)
+++ pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/boehm.py	Thu Feb 21 17:59:18 2008
@@ -16,6 +16,7 @@
 
     def __init__(self, translator, inline=False):
         super(BoehmGCTransformer, self).__init__(translator, inline=inline)
+        self.newgcheaderbuilder(self.HDR, self.TYPEINFO)
         self.finalizer_funcptrs = {}
 
         atomic_mh = mallocHelpers()

Modified: pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/refcounting.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/refcounting.py	(original)
+++ pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/refcounting.py	Thu Feb 21 17:59:18 2008
@@ -48,6 +48,7 @@
 
         # create incref, etc  graph
 
+        self.newgcheaderbuilder(self.HDR, self.TYPEINFO)
         gchelpers = self.gchelpers
         gc_header_offset = gchelpers.gc_header_offset
         HDRPTR = lltype.Ptr(self.HDR)

Modified: pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/transform.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/transform.py	(original)
+++ pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/transform.py	Thu Feb 21 17:59:18 2008
@@ -13,7 +13,6 @@
 from pypy.annotation import model as annmodel
 from pypy.rpython import rmodel, annlowlevel
 from pypy.rpython.memory import gc
-from pypy.rpython.memory.gcheader import GCHeaderBuilder
 from pypy.rpython.memory.gctransform.support import var_ispyobj
 from pypy.rpython.annlowlevel import MixLevelHelperAnnotator
 from pypy.rpython.rtyper import LowLevelOpList
@@ -502,12 +501,6 @@
 
     def __init__(self, translator, inline=False):
         super(GCTransformer, self).__init__(translator, inline=inline)
-        # at the moment, all GC transformers define a HDR structure that
-        # is added in front of all GC objects, and a TYPEINFO structure
-        # that works as RuntimeTypeInfo
-        self.gcheaderbuilder = GCHeaderBuilder(self.HDR, self.TYPEINFO)
-        self.gchelpers = GCHelpers(self.gcheaderbuilder)
-        self.rtticache = {}
 
         mh = mallocHelpers()
         mh.allocate = llmemory.raw_malloc
@@ -533,6 +526,16 @@
             self.stack_malloc_fixedsize_ptr = self.inittime_helper(
                 ll_stack_malloc_fixedsize, [lltype.Signed], llmemory.Address)
 
+    def newgcheaderbuilder(self, HDR, TYPEINFO):
+        from pypy.rpython.memory.gcheader import GCHeaderBuilder
+        self.setgcheaderbuilder(GCHeaderBuilder(HDR, TYPEINFO))
+
+    def setgcheaderbuilder(self, gcheaderbuilder):
+        # at the moment, all GC transformers are based on a GCHeaderBuilder.
+        self.gcheaderbuilder = gcheaderbuilder
+        self.gchelpers = GCHelpers(gcheaderbuilder)
+        self.rtticache = {}
+        if self.translator:
             self.gc_runtime_type_info_ptr = self.inittime_helper(
                 self.gchelpers.gc_runtime_type_info, [llmemory.Address],
                 RTTIPTR)



More information about the Pypy-commit mailing list