Author: Armin Rigo <[email protected]>
Branch: jit-constptr-2
Changeset: r83472:db567242f29f
Date: 2016-04-01 00:01 +0200
http://bitbucket.org/pypy/pypy/changeset/db567242f29f/

Log:    more fixes

diff --git a/rpython/jit/backend/llsupport/gcreftracer.py 
b/rpython/jit/backend/llsupport/gcreftracer.py
--- a/rpython/jit/backend/llsupport/gcreftracer.py
+++ b/rpython/jit/backend/llsupport/gcreftracer.py
@@ -1,4 +1,6 @@
+from rpython.rlib import rgc
 from rpython.rtyper.lltypesystem import lltype, llmemory, rffi
+from rpython.rtyper.lltypesystem.lloperation import llop
 from rpython.jit.backend.llsupport.symbolic import WORD
 
 
@@ -14,7 +16,8 @@
     length = obj.array_length
     addr = obj.array_base_addr
     while i < length:
-        gc._trace_callback(callback, arg, addr + i * WORD)
+        p = rffi.cast(llmemory.Address, addr + i * WORD)
+        gc._trace_callback(callback, arg, p)
         i += 1
 lambda_gcrefs_trace = lambda: gcrefs_trace
 
@@ -22,16 +25,17 @@
     # careful about the order here: the allocation of the GCREFTRACER
     # can trigger a GC.  So we must write the gcrefs into the raw
     # array only afterwards...
+    rgc.register_custom_trace_hook(GCREFTRACER, lambda_gcrefs_trace)
+    length = len(gcrefs)
     tr = lltype.malloc(GCREFTRACER)
+    # --no GC from here--
     tr.array_base_addr = array_base_addr
-    tr.array_length = 0    # incremented as we populate the array_base_addr
+    tr.array_length = length
     i = 0
-    length = len(gcrefs)
     while i < length:
         p = rffi.cast(rffi.SIGNEDP, array_base_addr + i * WORD)
-        # --no GC from here--
         p[0] = rffi.cast(lltype.Signed, gcrefs[i])
-        tr.array_length += 1
-        # --no GC until here--
         i += 1
+    llop.gc_writebarrier(lltype.Void, tr)
+    # --no GC until here--
     return tr
diff --git a/rpython/jit/backend/llsupport/test/test_gcreftracer.py 
b/rpython/jit/backend/llsupport/test/test_gcreftracer.py
--- a/rpython/jit/backend/llsupport/test/test_gcreftracer.py
+++ b/rpython/jit/backend/llsupport/test/test_gcreftracer.py
@@ -9,6 +9,7 @@
     def _trace_callback(self, callback, arg, addr):
         assert callback == "callback"
         assert arg == "arg"
+        assert lltype.typeOf(addr) == llmemory.Address
         self.called.append(addr)
 
 
diff --git a/rpython/jit/backend/x86/assembler.py 
b/rpython/jit/backend/x86/assembler.py
--- a/rpython/jit/backend/x86/assembler.py
+++ b/rpython/jit/backend/x86/assembler.py
@@ -524,6 +524,12 @@
             r_uint(rawstart + looppos),
             r_uint(rawstart + size_excluding_failure_stuff),
             r_uint(rawstart)))
+        debug_print("       gc table: 0x%x" % r_uint(rawstart))
+        debug_print("       function: 0x%x" % r_uint(rawstart + functionpos))
+        debug_print("           loop: 0x%x" % r_uint(rawstart + looppos))
+        debug_print("       failures: 0x%x" % r_uint(rawstart +
+                                                 size_excluding_failure_stuff))
+        debug_print("            end: 0x%x" % r_uint(rawstart + full_size))
         debug_stop("jit-backend-addr")
         self.patch_pending_failure_recoveries(rawstart)
         #
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to