[pypy-commit] stmgc c7-refactor: Comments

arigo noreply at buildbot.pypy.org
Tue Feb 18 20:00:08 CET 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: c7-refactor
Changeset: r770:a55008e93bb1
Date: 2014-02-18 19:59 +0100
http://bitbucket.org/pypy/stmgc/changeset/a55008e93bb1/

Log:	Comments

diff --git a/c7/stm/core.c b/c7/stm/core.c
--- a/c7/stm/core.c
+++ b/c7/stm/core.c
@@ -257,6 +257,9 @@
     STM_PSEGMENT->safe_point = SP_NO_TRANSACTION;
     STM_PSEGMENT->transaction_state = TS_NONE;
 
+    /* we did cond_broadcast() above already, in
+       try_wait_for_other_safe_points().  It may wake up
+       other threads in cond_wait() for a free segment. */
     mutex_unlock();
 }
 
diff --git a/c7/stm/nursery.c b/c7/stm/nursery.c
--- a/c7/stm/nursery.c
+++ b/c7/stm/nursery.c
@@ -243,7 +243,7 @@
 
 static void align_nursery_at_transaction_start(void)
 {
-    /* When the transaction start, we must align the 'nursery_current'
+    /* When the transaction starts, we must align the 'nursery_current'
        and set creation markers for the part of the section the follows.
     */
     uintptr_t c = (uintptr_t)STM_SEGMENT->nursery_current;
diff --git a/c7/stm/sync.c b/c7/stm/sync.c
--- a/c7/stm/sync.c
+++ b/c7/stm/sync.c
@@ -227,6 +227,13 @@
         if (i == STM_SEGMENT->segment_num)
             continue;    /* ignore myself */
 
+        /* If the other thread is SP_NO_TRANSACTION, then it can be
+           ignored here: as long as we have the mutex, it will remain
+           SP_NO_TRANSACTION.  If it is already at a suitable safe point,
+           it must be in a cond_wait(), so it will not resume as long
+           as we hold the mutex.  Thus the only cases is if it is
+           SP_RUNNING, or at the wrong kind of safe point.
+        */
         struct stm_priv_segment_info_s *other_pseg = get_priv_segment(i);
         if (other_pseg->safe_point == SP_RUNNING ||
             (requested_safe_point_kind == SP_SAFE_POINT_CAN_COLLECT &&


More information about the pypy-commit mailing list