[pypy-svn] r51692 - pypy/branch/gc-in-genc/pypy/translator/c

arigo at codespeak.net arigo at codespeak.net
Wed Feb 20 16:12:34 CET 2008


Author: arigo
Date: Wed Feb 20 16:12:33 2008
New Revision: 51692

Modified:
   pypy/branch/gc-in-genc/pypy/translator/c/database.py
   pypy/branch/gc-in-genc/pypy/translator/c/gc.py
Log:
Some genc tests start to pass.  I didn't think they would any time soon...


Modified: pypy/branch/gc-in-genc/pypy/translator/c/database.py
==============================================================================
--- pypy/branch/gc-in-genc/pypy/translator/c/database.py	(original)
+++ pypy/branch/gc-in-genc/pypy/translator/c/database.py	Wed Feb 20 16:12:33 2008
@@ -75,6 +75,9 @@
             RAWT = self.gctransformer.get_raw_type_for_gc_type(T)
             assert RAWT._gckind == 'raw'
             node = self.gettypedefnode(RAWT, varlength)
+            # the next line is hopefully temporary, pending the
+            # unified-rtti branch
+            self.gcpolicy.fixup_rawtype_rtti(T, node)
         else:
             if isinstance(T, Struct):
                 if isinstance(T, FixedSizeArray):
@@ -145,7 +148,7 @@
         else:
             raise Exception("don't know about type %r" % (T,))
 
-    def getcontainernode(self, container): #, **buildkwds):
+    def getcontainernode(self, container, **buildkwds):
         try:
             node = self.containernodes[container]
         except KeyError:
@@ -161,7 +164,7 @@
                 self.gctransformer.consider_constant(T, container)
 
             nodefactory = ContainerNodeFactory[T.__class__]
-            node = nodefactory(self, T, container) #, **buildkwds)
+            node = nodefactory(self, T, container, **buildkwds)
             self.containernodes[container] = node
             kind = getattr(node, 'nodekind', '?')
             self.containerstats[kind] = self.containerstats.get(kind, 0) + 1

Modified: pypy/branch/gc-in-genc/pypy/translator/c/gc.py
==============================================================================
--- pypy/branch/gc-in-genc/pypy/translator/c/gc.py	(original)
+++ pypy/branch/gc-in-genc/pypy/translator/c/gc.py	Wed Feb 20 16:12:33 2008
@@ -54,6 +54,16 @@
     def rtti_type(self):
         return ''
 
+    def fixup_rawtype_rtti(self, GCTYPE, rawdefnode):
+        # hopefully temporary, pending the unified-rtti branch
+        rawdefnode.gcinfo = None
+        if isinstance(GCTYPE, lltype.RttiStruct):
+            try:
+                rtti = lltype.getRuntimeTypeInfo(GCTYPE)
+            except ValueError:
+                rtti = None
+            self.struct_setup(rawdefnode, rtti)
+
     def OP_GC_PUSH_ALIVE_PYOBJ(self, funcgen, op):
         expr = funcgen.expr(op.args[0])
         if expr == 'NULL':



More information about the Pypy-commit mailing list