[pypy-svn] r32645 - in pypy/dist/pypy/translator/c: . src

mwh at codespeak.net mwh at codespeak.net
Tue Sep 26 11:58:48 CEST 2006


Author: mwh
Date: Tue Sep 26 11:58:46 2006
New Revision: 32645

Modified:
   pypy/dist/pypy/translator/c/gc.py
   pypy/dist/pypy/translator/c/src/mem.h
Log:
make genc marginally more gc transformer agnostic
(could be made more so)


Modified: pypy/dist/pypy/translator/c/gc.py
==============================================================================
--- pypy/dist/pypy/translator/c/gc.py	(original)
+++ pypy/dist/pypy/translator/c/gc.py	Tue Sep 26 11:58:46 2006
@@ -67,10 +67,14 @@
     transformerclass = gctransform.RefcountingGCTransformer
 
     def common_gcheader_definition(self, defnode):
-        return [('refcount', lltype.Signed)]
+        HDR = defnode.db.gctransformer.HDR
+        return [(name, HDR._flds[name]) for name in HDR._names]
 
     def common_gcheader_initdata(self, defnode):
-        return [CDefinedIntSymbolic('REFCOUNT_IMMORTAL')]
+        gct = defnode.db.gctransformer
+        hdr = gct.gcheaderbuilder.header_of_object(top_container(defnode.obj))
+        HDR = gct.HDR
+        return [getattr(hdr, fldname) for fldname in HDR._names]
 
     # for structs
 

Modified: pypy/dist/pypy/translator/c/src/mem.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/mem.h	(original)
+++ pypy/dist/pypy/translator/c/src/mem.h	Tue Sep 26 11:58:46 2006
@@ -71,12 +71,6 @@
     }
 /*  else { ...}  -- generated by funcgen.py */
 
-
-/* XXX hack to initialize the refcount of global structures: officially,
-   we need a value equal to the number of references to this global from
-   other globals, plus one.  This upper bound "approximation" will do... */
-#define REFCOUNT_IMMORTAL  (INT_MAX/2)
-
 #if RAW_MALLOC_ZERO_FILLED
 
 #define OP_ZERO_MALLOC OP_RAW_MALLOC



More information about the Pypy-commit mailing list