Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r892:e739af01aa02 Date: 2014-02-27 16:57 +0100 http://bitbucket.org/pypy/stmgc/changeset/e739af01aa02/
Log: Kill SP_SAFE_POINT_CANNOT_COLLECT. diff --git a/c7/stm/contention.c b/c7/stm/contention.c --- a/c7/stm/contention.c +++ b/c7/stm/contention.c @@ -75,11 +75,6 @@ assert(other_pseg->transaction_state == TS_MUST_ABORT); other_pseg->pub.nursery_end = NSE_SIGNAL; - /* we will issue a safe point and wait: */ - STM_PSEGMENT->safe_point = SP_SAFE_POINT_CANNOT_COLLECT; - // XXX do we really need a safe_point here? It seems we can - // kill it and the whole SP_SAFE_POINT_CANNOT_COLLECT - /* wait, hopefully until the other thread broadcasts "I'm done aborting" (spurious wake-ups are ok). */ dprintf(("contention: wait C_SAFE_POINT...\n")); @@ -90,7 +85,7 @@ /* now we return into _stm_write_slowpath() and will try again to acquire the write lock on our object. */ - STM_PSEGMENT->safe_point = SP_RUNNING; + assert(STM_PSEGMENT->safe_point == SP_RUNNING); } mutex_unlock(); diff --git a/c7/stm/core.c b/c7/stm/core.c --- a/c7/stm/core.c +++ b/c7/stm/core.c @@ -353,10 +353,10 @@ minor_collection(/*commit=*/ true); mutex_lock(); - STM_PSEGMENT->safe_point = SP_SAFE_POINT_CAN_COLLECT; + STM_PSEGMENT->safe_point = SP_SAFE_POINT; /* wait until the other thread is at a safe-point */ - wait_for_other_safe_points(SP_SAFE_POINT_CANNOT_COLLECT); + wait_for_other_safe_points(); /* the rest of this function either runs atomically without releasing the mutex, or aborts the current thread. */ diff --git a/c7/stm/core.h b/c7/stm/core.h --- a/c7/stm/core.h +++ b/c7/stm/core.h @@ -131,8 +131,7 @@ enum /* safe_point */ { SP_NO_TRANSACTION=0, SP_RUNNING, - SP_SAFE_POINT_CANNOT_COLLECT, - SP_SAFE_POINT_CAN_COLLECT, + SP_SAFE_POINT, }; enum /* transaction_state */ { TS_NONE=0, diff --git a/c7/stm/sync.c b/c7/stm/sync.c --- a/c7/stm/sync.c +++ b/c7/stm/sync.c @@ -226,12 +226,12 @@ void _stm_start_safe_point(void) { assert(STM_PSEGMENT->safe_point == SP_RUNNING); - STM_PSEGMENT->safe_point = SP_SAFE_POINT_CAN_COLLECT; + STM_PSEGMENT->safe_point = SP_SAFE_POINT; } void _stm_stop_safe_point(void) { - assert(STM_PSEGMENT->safe_point == SP_SAFE_POINT_CAN_COLLECT); + assert(STM_PSEGMENT->safe_point == SP_SAFE_POINT); STM_PSEGMENT->safe_point = SP_RUNNING; if (STM_PSEGMENT->transaction_state == TS_MUST_ABORT) @@ -240,7 +240,7 @@ #endif -static void wait_for_other_safe_points(int requested_safe_point_kind) +static void wait_for_other_safe_points(void) { /* Must be called with the mutex. When all other threads are in a safe point of at least the requested kind, returns. Otherwise, @@ -261,12 +261,9 @@ in the cond_wait() in this same function. */ - /* XXX review what occurs for the other kind! */ - assert(requested_safe_point_kind == SP_SAFE_POINT_CANNOT_COLLECT); - restart: assert(_has_mutex()); - assert(STM_PSEGMENT->safe_point == SP_SAFE_POINT_CAN_COLLECT); + assert(STM_PSEGMENT->safe_point == SP_SAFE_POINT); if (STM_PSEGMENT->transaction_state == TS_MUST_ABORT) abort_with_mutex(); @@ -282,10 +279,7 @@ SP_RUNNING, or at the wrong kind of safe point. */ struct stm_priv_segment_info_s *other_pseg = get_priv_segment(i); - if (other_pseg->safe_point == SP_RUNNING || - (requested_safe_point_kind == SP_SAFE_POINT_CAN_COLLECT && - other_pseg->safe_point == SP_SAFE_POINT_CANNOT_COLLECT)) { - + if (other_pseg->safe_point == SP_RUNNING) { /* we need to wait for this thread. Use NSE_SIGNAL to ask it (and possibly all other threads in the same case) to enter a safe-point soon. */ @@ -324,7 +318,7 @@ while (STM_SEGMENT->nursery_end == NSE_SIGNAL) { dprintf(("collectable_safe_point...\n")); - STM_PSEGMENT->safe_point = SP_SAFE_POINT_CAN_COLLECT; + STM_PSEGMENT->safe_point = SP_SAFE_POINT; STM_SEGMENT->nursery_end = NURSERY_END; /* signal all the threads blocked in diff --git a/c7/stm/sync.h b/c7/stm/sync.h --- a/c7/stm/sync.h +++ b/c7/stm/sync.h @@ -27,5 +27,5 @@ static void wait_for_end_of_inevitable_transaction(bool can_abort); /* see the source for an exact description */ -static void wait_for_other_safe_points(int requested_safe_point_kind); +static void wait_for_other_safe_points(void); static void collectable_safe_point(void); _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit