[pypy-commit] pypy concurrent-marksweep: Translation fix.

arigo noreply at buildbot.pypy.org
Sat Oct 8 10:25:59 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: concurrent-marksweep
Changeset: r47873:58cca100f3ed
Date: 2011-10-08 09:08 +0200
http://bitbucket.org/pypy/pypy/changeset/58cca100f3ed/

Log:	Translation fix.

diff --git a/pypy/rpython/memory/gc/concurrentms.py b/pypy/rpython/memory/gc/concurrentms.py
--- a/pypy/rpython/memory/gc/concurrentms.py
+++ b/pypy/rpython/memory/gc/concurrentms.py
@@ -1,6 +1,7 @@
 import time, sys
 from pypy.rpython.lltypesystem import lltype, llmemory, llarena, llgroup, rffi
 from pypy.rpython.lltypesystem.llmemory import raw_malloc_usage
+from pypy.translator.tool.cbuild import ExternalCompilationInfo
 from pypy.rlib.objectmodel import we_are_translated, running_on_llinterp
 from pypy.rlib.debug import ll_assert
 from pypy.rlib.rarithmetic import ovfcheck, LONG_BIT, r_uint
@@ -663,10 +664,24 @@
         else:
             return llmemory.cast_adr_to_int(obj)
 
+# ____________________________________________________________
+#
+# Hack to read the first byte of a location, which may be the
+# "mark" byte in an object or, if the location is free, the lowest
+# byte of the "next" pointer.
 
-def maybe_read_mark_byte(addr):
+def emulate_read_mark_byte(addr):
     "NOT_RPYTHON"
     try:
         return addr.ptr.mark
     except AttributeError:
         return '\x00'
+
+eci = ExternalCompilationInfo(
+    post_include_bits = ["""
+        #define pypy_concurrentms_read_byte(addr)  (*(char*)(addr))
+    """])
+maybe_read_mark_byte = rffi.llexternal("pypy_concurrentms_read_byte",
+                                       [llmemory.Address], lltype.Char,
+                                       compilation_info=eci, _nowrapper=True,
+                                       _callable=emulate_read_mark_byte)


More information about the pypy-commit mailing list