[pypy-commit] pypy stmgc-c8: add become_inevitable to make sure that a piece of raw memory is only given to

Raemi noreply at buildbot.pypy.org
Wed Apr 1 11:12:59 CEST 2015


Author: Remi Meier <remi.meier at inf.ethz.ch>
Branch: stmgc-c8
Changeset: r76668:61dcdb6f958a
Date: 2015-04-01 11:14 +0200
http://bitbucket.org/pypy/pypy/changeset/61dcdb6f958a/

Log:	add become_inevitable to make sure that a piece of raw memory is
	only given to one transaction at a time (JITFRAMEINFO is
	stm_dont_track_raw_access and hence may have been given to and
	modified by two transactions doing an assemble_loop)

diff --git a/rpython/jit/backend/llsupport/assembler.py b/rpython/jit/backend/llsupport/assembler.py
--- a/rpython/jit/backend/llsupport/assembler.py
+++ b/rpython/jit/backend/llsupport/assembler.py
@@ -71,6 +71,12 @@
         # the address of the function called by 'new'
         gc_ll_descr = self.cpu.gc_ll_descr
         gc_ll_descr.initialize()
+        if self.cpu.gc_ll_descr.stm:
+            from rpython.rlib import rstm
+            # become inevitable so that the raw-memory used later
+            # will only be modified by one thread at a time
+            rstm.become_inevitable()
+
         if hasattr(gc_ll_descr, 'minimal_size_in_nursery'):
             self.gc_minimal_size_in_nursery = gc_ll_descr.minimal_size_in_nursery
         else:
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
@@ -86,6 +86,12 @@
         if WORD == 8:
             self.pending_memoryerror_trampoline_from = []
             self.error_trampoline_64 = 0
+
+        if self.cpu.gc_ll_descr.stm:
+            # become inevitable so that the raw-memory used later
+            # will only be modified by one thread at a time
+            rstm.become_inevitable()
+
         self.mc = codebuf.MachineCodeBlockWrapper()
         #assert self.datablockwrapper is None --- but obscure case
         # possible, e.g. getting MemoryError and continuing


More information about the pypy-commit mailing list