Author: Armin Rigo <[email protected]>
Branch: stm-thread
Changeset: r54904:4bc269d8fe3a
Date: 2012-05-05 21:32 +0200
http://bitbucket.org/pypy/pypy/changeset/4bc269d8fe3a/

Log:    Fix fix fix. Good, now targetdemo2 passes (but still with only
        inevitable transactions, which is of course still pointless)

diff --git a/pypy/rlib/rstm.py b/pypy/rlib/rstm.py
--- a/pypy/rlib/rstm.py
+++ b/pypy/rlib/rstm.py
@@ -1,32 +1,38 @@
 from pypy.translator.stm import stmgcintf
 from pypy.rlib.debug import ll_assert
+from pypy.rpython.lltypesystem import lltype
+from pypy.rpython.lltypesystem.lloperation import llop
 
 
 def before_external_call():
+    llop.stm_stop_transaction(lltype.Void)
     stmgcintf.StmOperations.commit_transaction()
-before_external_call._gctransformer_hint_cannot_collect_ = True
 before_external_call._dont_reach_me_in_del_ = True
 before_external_call._transaction_break_ = True
 
 def after_external_call():
     stmgcintf.StmOperations.begin_inevitable_transaction()
-after_external_call._gctransformer_hint_cannot_collect_ = True
+    llop.stm_start_transaction(lltype.Void)
 after_external_call._dont_reach_me_in_del_ = True
 after_external_call._transaction_break_ = True
 
 def enter_callback_call():
-    new_thread = stmgcintf.StmOperations.descriptor_init()
+    token = stmgcintf.StmOperations.descriptor_init()
     stmgcintf.StmOperations.begin_inevitable_transaction()
-    return new_thread
-enter_callback_call._gctransformer_hint_cannot_collect_ = True
+    if token != 1:
+        llop.stm_start_transaction(lltype.Void)
+    #else: the StmGCTLS is not built yet.  leave it to gc_thread_start()
+    return token
 enter_callback_call._dont_reach_me_in_del_ = True
 enter_callback_call._transaction_break_ = True
 
 def leave_callback_call(token):
+    if token != 1:
+        llop.stm_stop_transaction(lltype.Void)
+    #else: the StmGCTLS is already destroyed, done by gc_thread_die()
     stmgcintf.StmOperations.commit_transaction()
     if token == 1:
         stmgcintf.StmOperations.descriptor_done()
-leave_callback_call._gctransformer_hint_cannot_collect_ = True
 leave_callback_call._dont_reach_me_in_del_ = True
 leave_callback_call._transaction_break_ = True
 
diff --git a/pypy/rpython/memory/gctransform/stmframework.py 
b/pypy/rpython/memory/gctransform/stmframework.py
--- a/pypy/rpython/memory/gctransform/stmframework.py
+++ b/pypy/rpython/memory/gctransform/stmframework.py
@@ -14,6 +14,12 @@
     def _declare_functions(self, GCClass, getfn, s_gc, *args):
         super(StmFrameworkGCTransformer, self)._declare_functions(
             GCClass, getfn, s_gc, *args)
+        self.stm_start_ptr = getfn(
+            self.gcdata.gc.start_transaction.im_func,
+            [s_gc], annmodel.s_None)
+        self.stm_stop_ptr = getfn(
+            self.gcdata.gc.stop_transaction.im_func,
+            [s_gc], annmodel.s_None)
         self.stm_writebarrier_ptr = getfn(
             self.gcdata.gc.stm_writebarrier,
             [annmodel.SomeAddress()], annmodel.SomeAddress())
@@ -148,6 +154,7 @@
     def start_transaction(self):
         # When a transaction is aborted, it leaves behind its shadow
         # stack content.  We have to clear it here.
+        XXX
         stackgcdata = self.stackgcdata
         stackgcdata.root_stack_top = stackgcdata.root_stack_base
 
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to