[pypy-commit] pypy stm-thread-2: Fixes

arigo noreply at buildbot.pypy.org
Fri Sep 7 11:57:48 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: stm-thread-2
Changeset: r57207:f2fc42d472f0
Date: 2012-09-07 11:57 +0200
http://bitbucket.org/pypy/pypy/changeset/f2fc42d472f0/

Log:	Fixes

diff --git a/pypy/rpython/memory/gc/stmgc.py b/pypy/rpython/memory/gc/stmgc.py
--- a/pypy/rpython/memory/gc/stmgc.py
+++ b/pypy/rpython/memory/gc/stmgc.py
@@ -4,7 +4,7 @@
 from pypy.rpython.memory.gc.base import GCBase, MovingGCBase
 from pypy.rpython.memory.support import mangle_hash
 from pypy.rpython.annlowlevel import llhelper
-from pypy.rlib.rarithmetic import LONG_BIT
+from pypy.rlib.rarithmetic import LONG_BIT, r_uint
 from pypy.rlib.debug import ll_assert, debug_start, debug_stop, fatalerror
 from pypy.rlib.debug import debug_print
 from pypy.module.thread import ll_thread
@@ -124,6 +124,9 @@
 GCFLAG_HAS_SHADOW        = first_gcflag << 5
 GCFLAG_FIXED_HASH        = first_gcflag << 6
 
+GCFLAG_PREBUILT          = GCFLAG_GLOBAL | GCFLAG_NOT_WRITTEN
+REV_INITIAL              = r_uint(1)
+
 
 def always_inline(fn):
     fn._always_inline_ = True
@@ -304,8 +307,10 @@
         hdr.tid = self.combine(typeid16, flags)
 
     def init_gc_object_immortal(self, addr, typeid16, flags=0):
-        flags |= GCFLAG_GLOBAL
+        flags |= GCFLAG_PREBUILT
         self.init_gc_object(addr, typeid16, flags)
+        hdr = llmemory.cast_adr_to_ptr(addr, lltype.Ptr(self.HDR))
+        hdr.revision = REV_INITIAL
 
     def obj_revision(self, obj):
         return hdr_revision(self.header(obj))
diff --git a/pypy/translator/c/genc.py b/pypy/translator/c/genc.py
--- a/pypy/translator/c/genc.py
+++ b/pypy/translator/c/genc.py
@@ -473,12 +473,13 @@
         from pypy.rpython.lltypesystem import rffi
         from pypy.rpython.annlowlevel import MixLevelHelperAnnotator
         entrypoint = self.entrypoint
-        stm = self.config.translation.stm
+        stm_nogc = (self.config.translation.stm and
+                    self.config.translation.gc == "none")
         #
         def entrypoint_wrapper(argc, argv):
-            if stm:
-                from pypy.translator.stm.funcgen import _stm_init_function
-                _stm_init_function()
+            if stm_nogc:
+                from pypy.translator.stm.funcgen import _stm_nogc_init_function
+                _stm_nogc_init_function()
             list = [""] * argc
             i = 0
             while i < argc:
diff --git a/pypy/translator/stm/funcgen.py b/pypy/translator/stm/funcgen.py
--- a/pypy/translator/stm/funcgen.py
+++ b/pypy/translator/stm/funcgen.py
@@ -39,8 +39,8 @@
     XXX
     return funcgen.OP_DIRECT_CALL(op)
 
-def _stm_init_function():
-    """Called at process start-up."""
+def _stm_nogc_init_function():
+    """Called at process start-up when running with no GC."""
     StmOperations.descriptor_init()
     StmOperations.begin_inevitable_transaction()
 


More information about the pypy-commit mailing list