[pypy-commit] pypy stmgc-c4: Add missing canmallocgcs. Ops that don't do malloc but can contain a GC safe-

Raemi noreply at buildbot.pypy.org
Wed Nov 13 12:17:38 CET 2013


Author: Remi Meier <remi.meier at gmail.com>
Branch: stmgc-c4
Changeset: r68005:e5e15daf8958
Date: 2013-11-13 12:16 +0100
http://bitbucket.org/pypy/pypy/changeset/e5e15daf8958/

Log:	Add missing canmallocgcs. Ops that don't do malloc but can contain a
	GC safe- point (e.g. BecomeInevitable) need to have
	canmallocgc=True...

diff --git a/TODO b/TODO
--- a/TODO
+++ b/TODO
@@ -1,3 +1,14 @@
+------------------------------------------------------------
+
+POSSIBLE BUG:
+investigate if another thread can force a jitframe. Thus,
+making a transaction break *after* a guard_not_forced
+would be wrong, as the force will only be visible after
+the break. (The GIL doesn't get released inbetween
+the GUARD and the next call that is allowed to, so no
+problems there)..
+Solution, move transaction breaks right before guard_not_forced, maybe
+
 ------------------------------------------------------------
 
 should stm_thread_local_obj always be read & writeable? would
diff --git a/rpython/memory/gctransform/stmframework.py b/rpython/memory/gctransform/stmframework.py
--- a/rpython/memory/gctransform/stmframework.py
+++ b/rpython/memory/gctransform/stmframework.py
@@ -97,6 +97,7 @@
         self.default(hop)
         self.pop_roots(hop, livevars)
 
+    # sync with lloperation.py
     gct_stm_become_inevitable                       = _gct_with_roots_pushed
     gct_stm_set_transaction_length                  = _gct_with_roots_pushed
     gct_stm_stop_all_other_threads                  = _gct_with_roots_pushed
diff --git a/rpython/rtyper/lltypesystem/lloperation.py b/rpython/rtyper/lltypesystem/lloperation.py
--- a/rpython/rtyper/lltypesystem/lloperation.py
+++ b/rpython/rtyper/lltypesystem/lloperation.py
@@ -410,6 +410,9 @@
     # direct_calls and maybe several casts, but it looks less heavy-weight
     # to keep them as operations until the genc stage)
 
+    # NOTE: use canmallocgc for all operations that can contain a collection.
+    #       that includes all that do 'BecomeInevitable' or otherwise contain
+    #       possible GC safe-points! (also sync with stmframework.py)
     'stm_initialize':         LLOp(),
     'stm_finalize':           LLOp(),
     'stm_barrier':            LLOp(sideeffects=False),
@@ -429,7 +432,7 @@
     'stm_commit_transaction': LLOp(),
     'stm_begin_inevitable_transaction': LLOp(),
     'stm_should_break_transaction': LLOp(sideeffects=False),
-    'stm_set_transaction_length': LLOp(),
+    'stm_set_transaction_length': LLOp(canmallocgc=True),
     'stm_change_atomic':      LLOp(),
     'stm_get_atomic':         LLOp(sideeffects=False),
     'stm_perform_transaction':LLOp(canmallocgc=True),
@@ -447,7 +450,7 @@
 
     'stm_abort_info_push':    LLOp(),
     'stm_abort_info_pop':     LLOp(),
-    'stm_inspect_abort_info': LLOp(sideeffects=False),
+    'stm_inspect_abort_info': LLOp(sideeffects=False, canmallocgc=True),
 
     'stm_get_adr_of_private_rev_num':LLOp(),
     'stm_get_adr_of_read_barrier_cache':LLOp(),
diff --git a/rpython/translator/stm/inevitable.py b/rpython/translator/stm/inevitable.py
--- a/rpython/translator/stm/inevitable.py
+++ b/rpython/translator/stm/inevitable.py
@@ -21,6 +21,7 @@
     'stm_threadlocalref_get', 'stm_threadlocalref_set',
     'stm_threadlocalref_count', 'stm_threadlocalref_addr',
     'jit_assembler_call', 'gc_writebarrier',
+    'shrink_array',
     ])
 ALWAYS_ALLOW_OPERATIONS |= set(lloperation.enum_tryfold_ops())
 


More information about the pypy-commit mailing list