Author: Remi Meier Branch: Changeset: r1110:5a0622b6bff5 Date: 2014-03-27 18:59 +0100 http://bitbucket.org/pypy/stmgc/changeset/5a0622b6bff5/
Log: some tweaks that didn't help diff --git a/htm-c7/stmgc.c b/htm-c7/stmgc.c --- a/htm-c7/stmgc.c +++ b/htm-c7/stmgc.c @@ -8,8 +8,8 @@ //struct stm_segment_info_s _stm_segment; __thread struct stm_segment_info_s* _stm_segment; -#define TRANSIENT_RETRY_MAX 5 -#define GIL_RETRY_MAX 5 +#define TRANSIENT_RETRY_MAX 10 +#define GIL_RETRY_MAX 10 #define ABORT_GIL_LOCKED 1 @@ -17,7 +17,7 @@ static __thread int gil_transactions = 0; static __thread int htm_transactions = 0; -__thread struct htm_transaction_info_s _htm_info; +__thread struct htm_transaction_info_s _htm_info __attribute__((aligned(64))); #define smp_spinloop() asm volatile ("pause":::"memory") @@ -32,13 +32,12 @@ static int spin_and_acquire_gil(stm_thread_local_t *tl) { int n = 5; - while ((n --> 0) && mutex_locked(&_stm_gil)) { + while (n-- > 0) { + if (!mutex_locked(&_stm_gil)) + return 0; smp_spinloop(); } - if (!mutex_locked(&_stm_gil)) - return 0; - acquire_gil(tl); return 1; } @@ -274,10 +273,10 @@ void stm_register_thread_local(stm_thread_local_t *tl) { objects_pointing_to_nursery = list_create(); young_weakrefs = list_create(); - _stm_segment = malloc(sizeof(struct stm_segment_info_s)); + _stm_segment = tl_malloc(sizeof(struct stm_segment_info_s)); tl->thread_local_obj = NULL; - tl->shadowstack_base = (object_t **)malloc(768*1024); + tl->shadowstack_base = (object_t **)tl_malloc(768*1024); assert(tl->shadowstack_base); tl->shadowstack = tl->shadowstack_base; tl->last_abort__bytes_in_nursery = 0; @@ -288,11 +287,11 @@ "in %p\ngil_transactions: %d\nhtm_transactions: %d\nratio: %f\n", tl, gil_transactions, htm_transactions, (float)gil_transactions / (float)htm_transactions); - free(tl->shadowstack_base); + //free(tl->shadowstack_base); list_free(objects_pointing_to_nursery); list_free(young_weakrefs); - free(_stm_segment); + //free(_stm_segment); } diff --git a/htm-c7/stmgc.h b/htm-c7/stmgc.h --- a/htm-c7/stmgc.h +++ b/htm-c7/stmgc.h @@ -18,7 +18,7 @@ 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; +extern __thread struct htm_transaction_info_s _htm_info __attribute__((aligned(64))); typedef void* stm_jmpbuf_t[5]; /* for use with __builtin_setjmp() */ @@ -43,6 +43,7 @@ struct stm_segment_info_s { stm_jmpbuf_t *jmpbuf_ptr; /* compat only -- always NULL */ char *nursery_current; /* updated... */ + int segment_num; /* compat only -- always NULL */ }; //extern struct stm_segment_info_s _stm_segment; extern __thread struct stm_segment_info_s *_stm_segment; _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit