[pypy-commit] pypy stmgc-c8: merge heads

arigo noreply at buildbot.pypy.org
Sun Jun 21 09:27:43 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c8
Changeset: r78221:e4e69af5598c
Date: 2015-06-21 09:27 +0200
http://bitbucket.org/pypy/pypy/changeset/e4e69af5598c/

Log:	merge heads

diff --git a/rpython/translator/stm/src_stm/extracode.h b/rpython/translator/stm/src_stm/extracode.h
--- a/rpython/translator/stm/src_stm/extracode.h
+++ b/rpython/translator/stm/src_stm/extracode.h
@@ -133,12 +133,13 @@
         }
     }
 
+    uintptr_t next_instr = marker->odd_number >> 1;
+
     ll = _fetch_strlen(segment_base, co_lnotab);
     if (ll > 0) {
         long lnotablen = ll;
         unsigned char *lnotab = (unsigned char *)_fetch_stritems(segment_base,
                                                                  co_lnotab);
-        uintptr_t next_instr = marker->odd_number >> 1;
         line = co_firstlineno;
         uintptr_t ii, curaddr = 0;
         for (ii = 0; ii < lnotablen; ii += 2) {
@@ -151,8 +152,9 @@
 
     int result;
     result = snprintf(outputbuf, outputbufsize,
-                      "File \"%s%.*s\", line %ld, in %.*s%s",
-                      fntrunc, (int)fnlen, fn, line, (int)nlen, name, ntrunc);
+                      "File \"%s%.*s\", line %ld, in %.*s%s (#%ld)",
+                      fntrunc, (int)fnlen, fn, line, (int)nlen,
+                      name, ntrunc, next_instr);
     if (result >= outputbufsize)
         result = outputbufsize - 1;
     if (result < 0)
diff --git a/rpython/translator/stm/src_stm/revision b/rpython/translator/stm/src_stm/revision
--- a/rpython/translator/stm/src_stm/revision
+++ b/rpython/translator/stm/src_stm/revision
@@ -1,1 +1,1 @@
-9cb167448d92
+9ffba4fe03df
diff --git a/rpython/translator/stm/src_stm/stm/core.c b/rpython/translator/stm/src_stm/stm/core.c
--- a/rpython/translator/stm/src_stm/stm/core.c
+++ b/rpython/translator/stm/src_stm/stm/core.c
@@ -1365,7 +1365,8 @@
     }
 
     if (STM_PSEGMENT->active_queues)
-        queues_deactivate_all(/*at_commit=*/true);
+        queues_deactivate_all(get_priv_segment(STM_SEGMENT->segment_num),
+                              /*at_commit=*/true);
 
     invoke_and_clear_user_callbacks(0);   /* for commit */
 
@@ -1476,6 +1477,9 @@
 #endif
     tl->thread_local_obj = pseg->threadlocal_at_start_of_transaction;
 
+    if (pseg->active_queues)
+        queues_deactivate_all(pseg, /*at_commit=*/false);
+
 
     /* Set the next nursery_mark: first compute the value that
        nursery_mark must have had at the start of the aborted transaction */
@@ -1521,9 +1525,6 @@
     if (tl->mem_clear_on_abort)
         memset(tl->mem_clear_on_abort, 0, tl->mem_bytes_to_clear_on_abort);
 
-    if (STM_PSEGMENT->active_queues)
-        queues_deactivate_all(/*at_commit=*/false);
-
     invoke_and_clear_user_callbacks(1);   /* for abort */
 
     if (is_abort(STM_SEGMENT->nursery_end)) {
@@ -1570,6 +1571,8 @@
 {
     int num_waits = 0;
 
+    timing_become_inevitable();
+
  retry_from_start:
     assert(STM_PSEGMENT->transaction_state == TS_REGULAR);
     _stm_collectable_safe_point();
@@ -1619,7 +1622,6 @@
         if (!_validate_and_turn_inevitable())
             return;
     }
-    timing_become_inevitable();
     soon_finished_or_inevitable_thread_segment();
     STM_PSEGMENT->transaction_state = TS_INEVITABLE;
 
diff --git a/rpython/translator/stm/src_stm/stm/queue.c b/rpython/translator/stm/src_stm/stm/queue.c
--- a/rpython/translator/stm/src_stm/stm/queue.c
+++ b/rpython/translator/stm/src_stm/stm/queue.c
@@ -126,16 +126,21 @@
     }
 }
 
-static void queues_deactivate_all(bool at_commit)
+static void queues_deactivate_all(struct stm_priv_segment_info_s *pseg,
+                                  bool at_commit)
 {
-    queue_lock_acquire();
+#pragma push_macro("STM_PSEGMENT")
+#pragma push_macro("STM_SEGMENT")
+#undef STM_PSEGMENT
+#undef STM_SEGMENT
+    spinlock_acquire(pseg->active_queues_lock);
 
     bool added_any_old_entries = false;
     bool finished_more_tasks = false;
     wlog_t *item;
-    TREE_LOOP_FORWARD(STM_PSEGMENT->active_queues, item) {
+    TREE_LOOP_FORWARD(pseg->active_queues, item) {
         stm_queue_t *queue = (stm_queue_t *)item->addr;
-        stm_queue_segment_t *seg = &queue->segs[STM_SEGMENT->segment_num - 1];
+        stm_queue_segment_t *seg = &queue->segs[pseg->pub.segment_num - 1];
         queue_entry_t *head, *freehead;
 
         if (at_commit) {
@@ -188,16 +193,17 @@
 
     } TREE_LOOP_END;
 
-    tree_free(STM_PSEGMENT->active_queues);
-    STM_PSEGMENT->active_queues = NULL;
+    tree_free(pseg->active_queues);
+    pseg->active_queues = NULL;
 
-    queue_lock_release();
+    spinlock_release(pseg->active_queues_lock);
 
-    assert(_has_mutex());
     if (added_any_old_entries)
         cond_broadcast(C_QUEUE_OLD_ENTRIES);
     if (finished_more_tasks)
         cond_broadcast(C_QUEUE_FINISHED_MORE_TASKS);
+#pragma pop_macro("STM_SEGMENT")
+#pragma pop_macro("STM_PSEGMENT")
 }
 
 void stm_queue_put(object_t *qobj, stm_queue_t *queue, object_t *newitem)
diff --git a/rpython/translator/stm/src_stm/stm/queue.h b/rpython/translator/stm/src_stm/stm/queue.h
--- a/rpython/translator/stm/src_stm/stm/queue.h
+++ b/rpython/translator/stm/src_stm/stm/queue.h
@@ -1,4 +1,5 @@
 /* Imported by rpython/translator/stm/import_stmgc.py */
-static void queues_deactivate_all(bool at_commit);
+static void queues_deactivate_all(struct stm_priv_segment_info_s *pseg,
+                                  bool at_commit);
 static void collect_active_queues(void);           /* minor collections */
 static void mark_visit_from_active_queues(void);   /* major collections */


More information about the pypy-commit mailing list