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

mwh at codespeak.net mwh at codespeak.net
Wed May 17 16:48:12 CEST 2006


Author: mwh
Date: Wed May 17 16:48:10 2006
New Revision: 27367

Modified:
   pypy/dist/pypy/translator/c/gc.py
   pypy/dist/pypy/translator/c/src/address.h
Log:
do the declarations necessary for address hiding in genc in a slightly saner
way.


Modified: pypy/dist/pypy/translator/c/gc.py
==============================================================================
--- pypy/dist/pypy/translator/c/gc.py	(original)
+++ pypy/dist/pypy/translator/c/gc.py	Wed May 17 16:48:10 2006
@@ -44,7 +44,7 @@
         return []
 
     def pre_gc_code(self):
-        return []
+        return ['typedef void *GC_hidden_pointer;']
 
     def gc_startup_code(self):
         return []
@@ -80,12 +80,6 @@
     def common_gcheader_initdata(self, defnode):
         return [REFCOUNT_IMMORTAL()]
 
-    def pre_gc_code(self):
-        return ['#define HIDE_POINTER(p) (p)',
-                '#define REVEAL_POINTER(p) (p)',
-                'typedef void *GC_hidden_pointer;']
-
-
     # for structs
 
     def struct_setup(self, structdefnode, rtti):
@@ -222,6 +216,9 @@
             yield '#include <gc/gc.h>'
             yield '#define USING_BOEHM_GC'
 
+    def pre_gc_code(self):
+        return []
+
     def gc_startup_code(self):
         if sys.platform == 'win32':
             pass # yield 'assert(GC_all_interior_pointers == 0);'
@@ -350,11 +347,6 @@
     def pre_pre_gc_code(self):
         yield '#define USING_NO_GC'
 
-    def pre_gc_code(self):
-        return ['#define HIDE_POINTER(p) (p)',
-                '#define REVEAL_POINTER(p) (p)',
-                'typedef void *GC_hidden_pointer;']
-
 
 class FrameworkGcPolicy(BasicGcPolicy):
     transformerclass = gctransform.FrameworkGCTransformer
@@ -375,9 +367,6 @@
         fnptr = self.db.gctransformer.frameworkgc_setup_ptr.value
         yield '%s();' % (self.db.get(fnptr),)
 
-    def pre_gc_code(self):
-        return []
-
     def OP_GC_RELOAD_POSSIBLY_MOVED(self, funcgen, op):
         args = [funcgen.expr(v) for v in op.args]
         # XXX this more or less assumes mark-and-sweep gc

Modified: pypy/dist/pypy/translator/c/src/address.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/address.h	(original)
+++ pypy/dist/pypy/translator/c/src/address.h	Wed May 17 16:48:10 2006
@@ -16,3 +16,10 @@
 #define OP_ADR_LT(x,y,r)	  r = ((x) <  (y))
 #define OP_ADR_GE(x,y,r)	  r = ((x) >= (y))
 
+#ifndef HIDE_POINTER
+#define HIDE_POINTER(p) (p)
+#ifdef REVEAL_POINTER
+#error HIDE_POINTER but not REVEAL_POINTER?
+#endif
+#define REVEAL_POINTER(p) (p)
+#endif



More information about the Pypy-commit mailing list