Author: Remi Meier <[email protected]>
Branch: quad-color-gc
Changeset: r86318:31c6daaf8842
Date: 2016-08-19 15:44 +0200
http://bitbucket.org/pypy/pypy/changeset/31c6daaf8842/

Log:    try to emit functions defined by the gctransformer

diff --git a/rpython/memory/gctransform/framework.py 
b/rpython/memory/gctransform/framework.py
--- a/rpython/memory/gctransform/framework.py
+++ b/rpython/memory/gctransform/framework.py
@@ -208,6 +208,8 @@
                 self.graphs_to_inline[graph] = True
             return annhelper.graph2const(graph)
 
+        self.autoregister_ptrs = []
+
         self.frameworkgc_setup_ptr = getfn(frameworkgc_setup, [],
                                            annmodel.s_None)
         # for tests
diff --git a/rpython/memory/gctransform/qcgcframework.py 
b/rpython/memory/gctransform/qcgcframework.py
--- a/rpython/memory/gctransform/qcgcframework.py
+++ b/rpython/memory/gctransform/qcgcframework.py
@@ -5,7 +5,6 @@
 VISIT_FPTR = lltype.Ptr(lltype.FuncType([llmemory.Address], lltype.Void))
 
 class QcgcFrameworkGCTransformer(BaseFrameworkGCTransformer):
-    autoregister_ptrs = list()
 
     def build_root_walker(self):
         return QcgcRootWalker(self)
@@ -28,8 +27,8 @@
             gc.trace(obj, invokecallback, visit_fn)
         pypy_trace_cb.c_name = "pypy_trace_cb"
         self.autoregister_ptrs.append(
-            getfn(pypy_trace_cb, [SomeAddress(),
-                                     SomePtr(VISIT_FPTR)],
+            getfn(pypy_trace_cb,
+                  [SomeAddress(), SomePtr(VISIT_FPTR)],
                   s_None))
 
     def push_roots(self, hop, keep_current_args=False):
diff --git a/rpython/rtyper/tool/rffi_platform.py 
b/rpython/rtyper/tool/rffi_platform.py
--- a/rpython/rtyper/tool/rffi_platform.py
+++ b/rpython/rtyper/tool/rffi_platform.py
@@ -895,7 +895,7 @@
 
     eci = ExternalCompilationInfo(
             include_dirs = [library_dir],
-            # includes = [],
+            includes = ["qcgc.h"],
             separate_module_sources = [separate_source],  # XXX
             separate_module_files = [os.path.join(library_dir, f) for f in
                 ["qcgc.c", "arena.c", "allocator.c", "bag.c", "event_logger.c",
diff --git a/rpython/translator/c/gc.py b/rpython/translator/c/gc.py
--- a/rpython/translator/c/gc.py
+++ b/rpython/translator/c/gc.py
@@ -333,6 +333,8 @@
         return FrameworkGcRuntimeTypeInfo_OpaqueNode
 
     def gc_startup_code(self):
+        for c_fnptr in self.db.gctransformer.autoregister_ptrs:
+            self.db.get(c_fnptr.value)
         fnptr = self.db.gctransformer.frameworkgc_setup_ptr.value
         yield '%s();' % (self.db.get(fnptr),)
 
@@ -469,12 +471,13 @@
 
         return eci
 
-    def gc_startup_code(self):
-        if sys.platform == 'win32':
-            pass # yield 'assert(GC_all_interior_pointers == 0);'
-        else:
-            yield 'GC_all_interior_pointers = 0;'
-        yield 'boehm_gc_startup_code();'
+    # def gc_startup_code(self):
+    #     super(QcgcFrameworkGcPolicy, self).gc_startup_code()
+        # if sys.platform == 'win32':
+        #     pass # yield 'assert(GC_all_interior_pointers == 0);'
+        # else:
+        #     yield 'GC_all_interior_pointers = 0;'
+        # yield 'boehm_gc_startup_code();'
 
 name_to_gcpolicy = {
     'boehm': BoehmGcPolicy,
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to