Author: Armin Rigo <ar...@tunes.org>
Branch: marker
Changeset: r1194:937201ff1335
Date: 2014-05-02 17:46 +0200
http://bitbucket.org/pypy/stmgc/changeset/937201ff1335/

Log:    More symmetrically, put <read at unknown location> also in the
        "other" field when reporting a contention where "self" writes and
        "other" reads.

diff --git a/c7/stm/marker.c b/c7/stm/marker.c
--- a/c7/stm/marker.c
+++ b/c7/stm/marker.c
@@ -165,32 +165,27 @@
 
     /* For some categories, we can also collect the relevant information
        for the other segment. */
+    char *outmarker = abort_other ? other_pseg->marker_self
+                                  : my_pseg->marker_other;
     switch (kind) {
     case WRITE_WRITE_CONTENTION:
         marker_fetch_obj_write(other_segment_num, obj, other_marker);
+       marker_expand(other_marker, other_segment_base, outmarker);
         break;
     case INEVITABLE_CONTENTION:
         assert(abort_other == false);
         other_marker[0] = other_pseg->marker_inev[0];
         other_marker[1] = other_pseg->marker_inev[1];
+       marker_expand(other_marker, other_segment_base, outmarker);
         break;
+    case WRITE_READ_CONTENTION:
+       strcpy(outmarker, "<read at unknown location>");
+       break;
     default:
-        other_marker[0] = 0;
-        other_marker[1] = 0;
+       outmarker[0] = 0;
         break;
     }
 
-    marker_expand(other_marker, other_segment_base,
-                  abort_other ? other_pseg->marker_self
-                              : my_pseg->marker_other);
-
-    if (abort_other && other_pseg->marker_self[0] == 0) {
-        if (kind == WRITE_READ_CONTENTION)
-            strcpy(other_pseg->marker_self, "<read at unknown location>");
-        else
-            strcpy(other_pseg->marker_self, "<no location information>");
-    }
-
     release_marker_lock(other_segment_base);
 }
 
diff --git a/c7/test/test_marker.py b/c7/test/test_marker.py
--- a/c7/test/test_marker.py
+++ b/c7/test/test_marker.py
@@ -260,7 +260,8 @@
         tl = self.get_stm_thread_local()
         assert tl.longest_marker_state == lib.STM_TIME_RUN_ABORTED_WRITE_READ
         assert ffi.string(tl.longest_marker_self) == '19'
-        assert ffi.string(tl.longest_marker_other) == ''
+        assert ffi.string(tl.longest_marker_other) == (
+            '<read at unknown location>')
 
     def test_double_remote_markers_cb_write_write(self):
         @ffi.callback("void(char *, uintptr_t, object_t *, char *, size_t)")
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to