Skip to content

Commit 9fdaede

Browse files
committed
Need writeBarrier between resetting the state and freeContinuation
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]>
1 parent d5dea53 commit 9fdaede

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

runtime/vm/ContinuationHelpers.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ yieldContinuation(J9VMThread *currentThread, BOOLEAN isFinished)
306306
*/
307307
Assert_VM_true(VM_ContinuationHelpers::isMountedWithCarrierThread(*continuationStatePtr, currentThread));
308308
VM_ContinuationHelpers::resetCarrierID(continuationStatePtr);
309+
VM_AtomicSupport::writeBarrier();
309310
/* Logically postUnmountContinuation(), which add the related continuation Object to the rememberedSet or dirty the Card for concurrent marking for future scanning, should be called
310311
* before resetCarrierID(), but the scan might happened before resetCarrierID() if concurrent card clean happens, then the related compensating scan might be
311312
* 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).

0 commit comments

Comments
 (0)