Skip to content

Commit

Permalink
Need writeBarrier between resetting the state and freeContinuation
Browse files Browse the repository at this point in the history
For weak memory ordering system such as PowerPC, we need to writeBarrier
between resetting the state of continuation(set the state to unmounted)
and freeing continuation/postUnmountContinuation during continuation
unmounting to avoid potential assert/issue caused by inconsist state
(in case the instructions are reordered).

Signed-off-by: hulin <[email protected]>
  • Loading branch information
LinHu2016 committed Dec 6, 2023
1 parent d5dea53 commit 9fdaede
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions runtime/vm/ContinuationHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ yieldContinuation(J9VMThread *currentThread, BOOLEAN isFinished)
*/
Assert_VM_true(VM_ContinuationHelpers::isMountedWithCarrierThread(*continuationStatePtr, currentThread));
VM_ContinuationHelpers::resetCarrierID(continuationStatePtr);
VM_AtomicSupport::writeBarrier();
/* Logically postUnmountContinuation(), which add the related continuation Object to the rememberedSet or dirty the Card for concurrent marking for future scanning, should be called
* before resetCarrierID(), but the scan might happened before resetCarrierID() if concurrent card clean happens, then the related compensating scan might be
* missed due to the continuation still is stated as mounted(we don't scan any mounted continuation, it should be scanned during root scanning via J9VMThread->currentContinuation).
Expand Down

0 comments on commit 9fdaede

Please sign in to comment.