diff options
author | Ben Gamari <ben@smart-cactus.org> | 2023-03-22 09:21:32 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2023-04-24 06:00:40 -0400 |
commit | e5a4c2e415fdd49fcd7f0f6e46b04994566a2674 (patch) | |
tree | 0bdf0dd8b6d2ed99b149f33ab4090accc7285cdf /rts | |
parent | e19861134edf8a744408b647ee85ae75bd0c3db3 (diff) | |
download | haskell-e5a4c2e415fdd49fcd7f0f6e46b04994566a2674.tar.gz |
Use relaxed atomics to manipulate TSO status fields
Diffstat (limited to 'rts')
-rw-r--r-- | rts/HeapStackCheck.cmm | 7 | ||||
-rw-r--r-- | rts/Schedule.c | 2 | ||||
-rw-r--r-- | rts/StgStartup.cmm | 4 |
3 files changed, 7 insertions, 6 deletions
diff --git a/rts/HeapStackCheck.cmm b/rts/HeapStackCheck.cmm index 18cd9eef6f..a3bd539518 100644 --- a/rts/HeapStackCheck.cmm +++ b/rts/HeapStackCheck.cmm @@ -96,9 +96,10 @@ import CLOSURE stg_ret_p_info; * the stack is already too big. */ -#define PRE_RETURN(why,what_next) \ - StgTSO_what_next(CurrentTSO) = what_next::I16; \ - StgRegTable_rRet(BaseReg) = why; \ +// N.B. the access to what_next may synchronize with throwToMsg +#define PRE_RETURN(why,what_next) \ + %relaxed StgTSO_what_next(CurrentTSO) = what_next::I16; \ + StgRegTable_rRet(BaseReg) = why; \ R1 = BaseReg; /* Remember that the return address is *removed* when returning to a diff --git a/rts/Schedule.c b/rts/Schedule.c index 685862a08b..66043c26ab 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -2491,7 +2491,7 @@ suspendThread (StgRegTable *reg, bool interruptible) traceEventStopThread(cap, tso, THREAD_SUSPENDED_FOREIGN_CALL, 0); // XXX this might not be necessary --SDM - tso->what_next = ThreadRunGHC; + RELAXED_STORE(&tso->what_next, ThreadRunGHC); threadPaused(cap,tso); diff --git a/rts/StgStartup.cmm b/rts/StgStartup.cmm index f69c0dea87..51ea545a8c 100644 --- a/rts/StgStartup.cmm +++ b/rts/StgStartup.cmm @@ -77,9 +77,9 @@ INFO_TABLE_RET(stg_stop_thread, STOP_FRAME, Sp = Sp + SIZEOF_StgStopFrame - SIZEOF_StgDeadThreadFrame; SET_HDR(Sp, stg_dead_thread_info, CCS_SYSTEM); - StgDeadThreadFrame_result(Sp) = R1; + %release StgDeadThreadFrame_result(Sp) = R1; - StgTSO_what_next(CurrentTSO) = ThreadComplete::I16; + %relaxed StgTSO_what_next(CurrentTSO) = ThreadComplete::I16; SAVE_THREAD_STATE(); |