Author: Remi Meier Branch: Changeset: r1101:f0d999963700 Date: 2014-03-27 13:58 +0100 http://bitbucket.org/pypy/stmgc/changeset/f0d999963700/
Log: add htm_transaction_info diff --git a/htm-c7/stmgc.c b/htm-c7/stmgc.c --- a/htm-c7/stmgc.c +++ b/htm-c7/stmgc.c @@ -16,12 +16,14 @@ static __thread int gil_transactions = 0; static __thread int htm_transactions = 0; +__thread struct htm_transaction_info_s _htm_info; #define smp_spinloop() asm volatile ("pause":::"memory") static void acquire_gil(stm_thread_local_t *tl) { if (pthread_mutex_lock(&_stm_gil) == 0) { _stm_tloc = tl; + _htm_info.use_gil = 1; return; } abort(); @@ -53,6 +55,11 @@ void stm_start_inevitable_transaction(stm_thread_local_t *tl) { /* set_transaction_length(pc) */ + /* fprintf(stderr, "previous tr: retry: %d gil: %d\n", */ + /* _htm_info.retry_counter, _htm_info.use_gil); */ + _htm_info.retry_counter = 0; + _htm_info.use_gil = 0; + if (mutex_locked(&_stm_gil)) { if (spin_and_acquire_gil(tl)) return; @@ -91,6 +98,7 @@ acquire_gil(tl); } else { /* transient abort */ + _htm_info.retry_counter++; transient_retry_counter--; if (transient_retry_counter > 0) { smp_spinloop(); diff --git a/htm-c7/stmgc.h b/htm-c7/stmgc.h --- a/htm-c7/stmgc.h +++ b/htm-c7/stmgc.h @@ -13,6 +13,14 @@ #define STM_NB_SEGMENTS 4 +#define HTM_INFO_AVAILABLE 1 +struct htm_transaction_info_s { + int retry_counter; /* only counting transient aborts of HTM */ + int use_gil; /* in GIL mode? 0=HTM */ +}; +extern __thread struct htm_transaction_info_s _htm_info; + + typedef struct { /* empty */ } stm_jmpbuf_t; typedef struct object_s { @@ -29,6 +37,7 @@ extern stm_thread_local_t *_stm_tloc; extern char *_stm_nursery_current, *_stm_nursery_end; + struct stm_segment_info_s { stm_jmpbuf_t *jmpbuf_ptr; /* compat only -- always NULL */ char *nursery_current; /* compat only -- always NULL */ _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit