Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r1314:94d281041161 Date: 2014-08-14 15:01 +0200 http://bitbucket.org/pypy/stmgc/changeset/94d281041161/
Log: Fix (shown by demo_random2) diff --git a/c7/stm/core.c b/c7/stm/core.c --- a/c7/stm/core.c +++ b/c7/stm/core.c @@ -1027,7 +1027,7 @@ } #endif -static void abort_with_mutex(void) +static stm_thread_local_t *abort_with_mutex_no_longjmp(void) { assert(_has_mutex()); dprintf(("~~~ ABORT\n")); @@ -1060,6 +1060,12 @@ /* Broadcast C_ABORTED to wake up contention.c */ cond_broadcast(C_ABORTED); + return tl; +} + +static void abort_with_mutex(void) +{ + stm_thread_local_t *tl = abort_with_mutex_no_longjmp(); s_mutex_unlock(); /* It seems to be a good idea, at least in some examples, to sleep diff --git a/c7/stm/core.h b/c7/stm/core.h --- a/c7/stm/core.h +++ b/c7/stm/core.h @@ -272,6 +272,7 @@ static void teardown_core(void); static void abort_with_mutex(void) __attribute__((noreturn)); +static stm_thread_local_t *abort_with_mutex_no_longjmp(void); static void abort_data_structures_from_segment_num(int segment_num); static inline bool was_read_remote(char *base, object_t *obj, diff --git a/c7/stm/forksupport.c b/c7/stm/forksupport.c --- a/c7/stm/forksupport.c +++ b/c7/stm/forksupport.c @@ -181,20 +181,17 @@ assert(tl->associated_segment_num == i); assert(pr->transaction_state == TS_REGULAR); set_gs_register(get_segment_base(i)); + assert(STM_SEGMENT->segment_num == i); - rewind_jmp_buf rjbuf; - stm_rewind_jmp_enterframe(tl, &rjbuf); - if (stm_rewind_jmp_setjmp(tl) == 0) { + s_mutex_lock(); #ifndef NDEBUG - pr->running_pthread = pthread_self(); + pr->running_pthread = pthread_self(); #endif - pr->pub.running_thread->shadowstack = ( - pr->shadowstack_at_start_of_transaction); - strcpy(pr->marker_self, "fork"); - stm_abort_transaction(); - } - stm_rewind_jmp_forget(tl); - stm_rewind_jmp_leaveframe(tl, &rjbuf); + pr->pub.running_thread->shadowstack = ( + pr->shadowstack_at_start_of_transaction); + strcpy(pr->marker_self, "fork"); + abort_with_mutex_no_longjmp(); + s_mutex_unlock(); } static void forksupport_child(void) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit