[pypy-commit] stmgc c7-full-profiling: in-progress
arigo
noreply at buildbot.pypy.org
Fri Oct 3 17:56:54 CEST 2014
Author: Armin Rigo <arigo at tunes.org>
Branch: c7-full-profiling
Changeset: r1443:0e74d9b2380c
Date: 2014-10-03 17:57 +0200
http://bitbucket.org/pypy/stmgc/changeset/0e74d9b2380c/
Log: in-progress
diff --git a/c7/stm/contention.c b/c7/stm/contention.c
--- a/c7/stm/contention.c
+++ b/c7/stm/contention.c
@@ -181,6 +181,7 @@
if (must_abort())
abort_with_mutex();
+ abort(); /* XXX
struct stm_priv_segment_info_s *pseg =
get_priv_segment(STM_SEGMENT->segment_num);
double elapsed =
@@ -188,6 +189,7 @@
STM_TIME_RUN_CURRENT);
marker_copy(pseg->pub.running_thread, pseg,
wait_category, elapsed);
+ */
}
else if (!contmgr.abort_other) {
diff --git a/c7/stm/marker.c b/c7/stm/marker.c
--- a/c7/stm/marker.c
+++ b/c7/stm/marker.c
@@ -79,6 +79,7 @@
return _result;
}
+#if 0 // XXX
static void marker_copy(stm_thread_local_t *tl,
struct stm_priv_segment_info_s *pseg,
enum stm_time_e attribute_to, double time)
@@ -103,6 +104,7 @@
pseg->marker_self[0] = 0;
pseg->marker_other[0] = 0;
}
+#endif
static void marker_fetch_obj_write(uint8_t in_segment_num, object_t *obj,
uintptr_t marker[2])
diff --git a/c7/stm/marker.h b/c7/stm/marker.h
--- a/c7/stm/marker.h
+++ b/c7/stm/marker.h
@@ -4,9 +4,6 @@
static void marker_expand(uintptr_t marker[2], char *segment_base,
char *outmarker);
static void marker_default_for_abort(struct stm_priv_segment_info_s *pseg);
-static void marker_copy(stm_thread_local_t *tl,
- struct stm_priv_segment_info_s *pseg,
- enum stm_time_e attribute_to, double time);
static void marker_contention(int kind, bool abort_other,
uint8_t other_segment_num, object_t *obj);
diff --git a/c7/stm/nursery.c b/c7/stm/nursery.c
--- a/c7/stm/nursery.c
+++ b/c7/stm/nursery.c
@@ -572,11 +572,11 @@
stm_safe_point();
- change_timing_state(STM_TIME_MINOR_GC);
+ timing_event(NULL, STM_GC_MINOR_START, NULL, NULL);
_do_minor_collection(commit);
- change_timing_state(commit ? STM_TIME_BOOKKEEPING : STM_TIME_RUN_CURRENT);
+ timing_event(NULL, STM_GC_MINOR_STOP, NULL, NULL);
}
void stm_collect(long level)
diff --git a/c7/stm/nursery.h b/c7/stm/nursery.h
--- a/c7/stm/nursery.h
+++ b/c7/stm/nursery.h
@@ -1,7 +1,11 @@
-/* '_stm_nursery_section_end' is either NURSERY_END or NSE_SIGxxx */
-#define NSE_SIGPAUSE STM_TIME_WAIT_OTHER
-#define NSE_SIGCOMMITSOON STM_TIME_SYNC_COMMIT_SOON
+/* 'nursery_end' is either NURSERY_END, NSE_SIGxxx, or STM_TR_ABORT_xxx. */
+#define NSE_SIGPAUSE (_STM_NSE_SIGNAL_MAX - 1)
+#define NSE_SIGCOMMITSOON (_STM_NSE_SIGNAL_MAX - 2)
+
+#if !(STM_TR_ABORT_OTHER < NSE_SIGCOMMITSOON)
+# error "STM_TR_ABORT_xxx is too large; increase _STM_NSE_SIGNAL_MAX"
+#endif
static uint32_t highest_overflow_number;
diff --git a/c7/stm/sync.c b/c7/stm/sync.c
--- a/c7/stm/sync.c
+++ b/c7/stm/sync.c
@@ -142,12 +142,11 @@
else {
/* wait for stm_commit_transaction() to finish this
inevitable transaction */
+ stm_thread_local_t *tl = tl_or_null_if_can_abort;
signal_other_to_commit_soon(other_pseg);
- change_timing_state_tl(tl_or_null_if_can_abort,
- STM_TIME_WAIT_INEVITABLE);
+ timing_event_wt_inevitable(tl, other_pseg);
cond_wait(C_INEVITABLE);
- /* don't bother changing the timing state again: the caller
- will very soon go to STM_TIME_RUN_CURRENT */
+ timing_event(tl, STM_WAIT_DONE, NULL, NULL);
}
goto restart;
}
@@ -188,8 +187,9 @@
}
/* No segment available. Wait until release_thread_segment()
signals that one segment has been freed. */
- change_timing_state_tl(tl, STM_TIME_WAIT_FREE_SEGMENT);
+ timing_event(tl, STM_WT_FREE_SEGMENT, NULL, NULL);
cond_wait(C_SEGMENT_FREE);
+ timing_event(tl, STM_WAIT_DONE, NULL, NULL);
/* Return false to the caller, which will call us again */
return false;
diff --git a/c7/stm/timing.h b/c7/stm/timing.h
--- a/c7/stm/timing.h
+++ b/c7/stm/timing.h
@@ -9,3 +9,20 @@
if (stmcb_timing_event != NULL)
stmcb_timing_event(tl, event, marker1, marker2);
}
+
+static inline void timing_event_wt_inevitable(stm_thread_local_t *tl,
+ struct stm_priv_segment_info_s *other_pseg)
+{
+ /* We are not running a transaction yet; can't get the 'self loc' */
+ assert(_has_mutex());
+ if (stmcb_timing_event != NULL) {
+
+ char outmarker[_STM_MARKER_LEN];
+ acquire_marker_lock(other_pseg->pub.segment_base);
+ marker_expand(other_pseg->marker_inev, other_pseg->pub.segment_base,
+ outmarker);
+ release_marker_lock(other_pseg->pub.segment_base);
+
+ stmcb_timing_event(tl, STM_WT_INEVITABLE, NULL, outmarker);
+ }
+}
diff --git a/c7/stmgc.c b/c7/stmgc.c
--- a/c7/stmgc.c
+++ b/c7/stmgc.c
@@ -14,8 +14,8 @@
#include "stm/extra.h"
#include "stm/fprintcolor.h"
#include "stm/weakref.h"
+#include "stm/marker.h"
#include "stm/timing.h"
-#include "stm/marker.h"
#include "stm/misc.c"
#include "stm/list.c"
diff --git a/c7/stmgc.h b/c7/stmgc.h
--- a/c7/stmgc.h
+++ b/c7/stmgc.h
@@ -54,33 +54,6 @@
object_t *ss;
};
-/* Profiling events (in the comments: value for marker1, value for marker2) */
-enum stm_event_e {
- /* always STM_TRANSACTION_START followed later by one of the STM_TR_xxx */
- STM_TRANSACTION_START,
- STM_TR_COMMIT,
- STM_TR_ABORT_WRITE_WRITE, /* self write loc, other write loc */
- STM_TR_ABORT_WRITE_READ, /* self write loc, other = null; or opposite */
- STM_TR_ABORT_INEVITABLE, /* self cur loc, other turned-inev loc */
- STM_TR_ABORT_OTHER, /* ?, ? */
-
- /* always one STM_WT_xxx followed later by STM_WAIT_DONE */
- STM_WT_FREE_SEGMENT,
- STM_WT_SYNC_PAUSE,
- STM_WT_WRITE_READ, /* self write loc, other = null; or opposite */
- STM_WT_INEVITABLE, /* self cur loc, other turned-inev loc */
- STM_WAIT_DONE,
-
- /* start and end of GC cycles */
- STM_GC_MINOR_START,
- STM_GC_MINOR_STOP,
- STM_GC_MAJOR_START,
- STM_GC_MAJOR_STOP,
-
- _STM_TIME_N
-};
-#define _STM_MARKER_LEN 128
-
typedef struct stm_thread_local_s {
/* every thread should handle the shadow stack itself */
struct stm_shadowentry_s *shadowstack, *shadowstack_base;
@@ -150,7 +123,7 @@
#define _STM_CARD_SIZE 32 /* must be >= 32 */
#define _STM_MIN_CARD_COUNT 17
#define _STM_MIN_CARD_OBJ_SIZE (_STM_CARD_SIZE * _STM_MIN_CARD_COUNT)
-#define _STM_NSE_SIGNAL_MAX _STM_TIME_N
+#define _STM_NSE_SIGNAL_MAX 63
#define _STM_FAST_ALLOC (66*1024)
@@ -437,6 +410,33 @@
void stm_flush_timing(stm_thread_local_t *tl, int verbose);
+/* Profiling events (in the comments: value for marker1, value for marker2) */
+enum stm_event_e {
+ /* always STM_TRANSACTION_START followed later by one of the STM_TR_xxx */
+ STM_TRANSACTION_START,
+ STM_TR_COMMIT,
+ STM_TR_ABORT_WRITE_WRITE, /* self write loc, other write loc */
+ STM_TR_ABORT_WRITE_READ, /* self write loc, other = null; or opposite */
+ STM_TR_ABORT_INEVITABLE, /* self cur loc?, other turned-inev loc */
+ STM_TR_ABORT_OTHER, /* ?, ? */
+
+ /* always one STM_WT_xxx followed later by STM_WAIT_DONE */
+ STM_WT_FREE_SEGMENT,
+ STM_WT_SYNC_PAUSE,
+ STM_WT_WRITE_READ, /* self write loc, other = null; or opposite */
+ STM_WT_INEVITABLE, /* self cur loc?, other turned-inev loc */
+ STM_WAIT_DONE,
+
+ /* start and end of GC cycles */
+ STM_GC_MINOR_START,
+ STM_GC_MINOR_STOP,
+ STM_GC_MAJOR_START,
+ STM_GC_MAJOR_STOP,
+
+ _STM_EVENT_N
+};
+#define _STM_MARKER_LEN 128
+
/* The markers pushed in the shadowstack are an odd number followed by a
regular pointer. When needed, this library invokes this callback to
turn this pair into a human-readable explanation. */
More information about the pypy-commit
mailing list