Author: Remi Meier <remi.me...@gmail.com> Branch: stmgc-c4 Changeset: r67845:06bd16504902 Date: 2013-11-04 22:28 +0100 http://bitbucket.org/pypy/pypy/changeset/06bd16504902/
Log: make sure roots are pushed around jit_assembler_call and barriers get invalidated around it and stm_partial_commit_and_resume_other_threads diff --git a/rpython/memory/gctransform/framework.py b/rpython/memory/gctransform/framework.py --- a/rpython/memory/gctransform/framework.py +++ b/rpython/memory/gctransform/framework.py @@ -654,6 +654,11 @@ gct_indirect_call = gct_direct_call + def gct_jit_assembler_call(self, hop): + livevars = self.push_roots(hop) + self.default(hop) + self.pop_roots(hop, livevars) + def gct_fv_gc_malloc(self, hop, flags, TYPE, *args): op = hop.spaceop PTRTYPE = op.result.concretetype diff --git a/rpython/translator/stm/breakfinder.py b/rpython/translator/stm/breakfinder.py --- a/rpython/translator/stm/breakfinder.py +++ b/rpython/translator/stm/breakfinder.py @@ -5,6 +5,8 @@ 'stm_commit_transaction', 'stm_begin_inevitable_transaction', 'stm_perform_transaction', + 'stm_partial_commit_and_resume_other_threads', # new priv_revision + 'jit_assembler_call', ]) diff --git a/rpython/translator/stm/test/test_writebarrier.py b/rpython/translator/stm/test/test_writebarrier.py --- a/rpython/translator/stm/test/test_writebarrier.py +++ b/rpython/translator/stm/test/test_writebarrier.py @@ -556,6 +556,31 @@ assert self.barriers == ['a2i'] + def test_transaction_breaking_ops(self): + class X: + pass + x = X() + x2 = X() + + def f1(f): + x.a = x2 # write barrier + llop.stm_commit_transaction(lltype.Void) + x.a = x2 + llop.stm_begin_inevitable_transaction(lltype.Void) + x.a = x2 + llop.stm_partial_commit_and_resume_other_threads(lltype.Void) + x.a = x2 + llop.jit_assembler_call(lltype.Void) + x.a = x2 + llop.stm_perform_transaction(lltype.Void) + x.a = x2 + return x + + self.interpret(f1, [1]) + assert self.barriers == ['I2W']*6 + + + external_release_gil = rffi.llexternal('external_release_gil', [], lltype.Void, _callable=lambda: None, random_effects_on_gcobjs=True, diff --git a/rpython/translator/stm/test/transform_support.py b/rpython/translator/stm/test/transform_support.py --- a/rpython/translator/stm/test/transform_support.py +++ b/rpython/translator/stm/test/transform_support.py @@ -180,6 +180,15 @@ def op_stm_begin_inevitable_transaction(self): self.transaction_break() + def op_stm_partial_commit_and_resume_other_threads(self): + self.transaction_break() + + def op_jit_assembler_call(self): + self.transaction_break() # dummy for test_writebarrier.py + + def op_stm_perform_transaction(self): + self.transaction_break() # dummy for test_writebarrier.py + def op_gc_writebarrier(self, p): raise Exception("should have been removed") _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit