[pypy-commit] pypy default: Fix for "-Ojit --gc=boehm" translations.

arigo noreply at buildbot.pypy.org
Thu Oct 13 18:59:43 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r48015:d296fda58621
Date: 2011-10-13 18:59 +0200
http://bitbucket.org/pypy/pypy/changeset/d296fda58621/

Log:	Fix for "-Ojit --gc=boehm" translations.

diff --git a/pypy/jit/backend/llsupport/gc.py b/pypy/jit/backend/llsupport/gc.py
--- a/pypy/jit/backend/llsupport/gc.py
+++ b/pypy/jit/backend/llsupport/gc.py
@@ -45,6 +45,14 @@
     def freeing_block(self, start, stop):
         pass
 
+    def record_constptrs(self, op, gcrefs_output_list):
+        for i in range(op.numargs()):
+            v = op.getarg(i)
+            if isinstance(v, ConstPtr) and bool(v.value):
+                p = v.value
+                rgc._make_sure_does_not_move(p)
+                gcrefs_output_list.append(p)
+
 # ____________________________________________________________
 
 class GcLLDescr_boehm(GcLLDescription):
@@ -141,6 +149,14 @@
     get_funcptr_for_newstr = None
     get_funcptr_for_newunicode = None
 
+    def rewrite_assembler(self, cpu, operations, gcrefs_output_list):
+        # record all GCREFs too, because Boehm cannot see them and keep them
+        # alive if they end up as constants in the assembler
+        for op in operations:
+            self.record_constptrs(op, gcrefs_output_list)
+        return GcLLDescription.rewrite_assembler(self, cpu, operations,
+                                                 gcrefs_output_list)
+
 
 # ____________________________________________________________
 # All code below is for the hybrid or minimark GC
@@ -757,14 +773,6 @@
             funcptr(llmemory.cast_ptr_to_adr(gcref_struct),
                     llmemory.cast_ptr_to_adr(gcref_newptr))
 
-    def record_constptrs(self, op, gcrefs_output_list):
-        for i in range(op.numargs()):
-            v = op.getarg(i)
-            if isinstance(v, ConstPtr) and bool(v.value):
-                p = v.value
-                rgc._make_sure_does_not_move(p)
-                gcrefs_output_list.append(p)
-
     def rewrite_assembler(self, cpu, operations, gcrefs_output_list):
         # Perform two kinds of rewrites in parallel:
         #


More information about the pypy-commit mailing list