Skip to content

Commit

Permalink
Merge pull request #18651 from LinHu2016/v0.42.0-release
Browse files Browse the repository at this point in the history
(0.42) Fix PowerPC specific issues
  • Loading branch information
pshipton committed Dec 19, 2023
2 parents 4fb12e9 + 7097526 commit cfcd5ea
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions runtime/vm/ContinuationHelpers.cpp
Expand Up @@ -152,6 +152,7 @@ synchronizeWithConcurrentGCScan(J9VMThread *currentThread, j9object_t continuati
{
ContinuationState oldContinuationState = 0;
ContinuationState returnContinuationState = 0;

/* Set pending state and carrier id, GC need to distinguish between fully mounted (don't scan) vs pending to be mounted (do scan) cases. */
do {
oldContinuationState = *continuationStatePtr;
Expand All @@ -167,10 +168,11 @@ synchronizeWithConcurrentGCScan(J9VMThread *currentThread, j9object_t continuati
* but only up to small finite number of times.
*/
do {
if (VM_ContinuationHelpers::isConcurrentlyScanned(returnContinuationState)) {
oldContinuationState = *continuationStatePtr;
if (VM_ContinuationHelpers::isConcurrentlyScanned(oldContinuationState)) {
omrthread_monitor_enter(currentThread->publicFlagsMutex);
/* Wait till potentially concurrent GC scans are complete */
do {
for(;;) {
oldContinuationState = *continuationStatePtr;
if (VM_ContinuationHelpers::isConcurrentlyScanned(oldContinuationState)) {
PUSH_OBJECT_IN_SPECIAL_FRAME(currentThread, continuationObject);
Expand All @@ -183,20 +185,21 @@ synchronizeWithConcurrentGCScan(J9VMThread *currentThread, j9object_t continuati
continuationObject = POP_OBJECT_IN_SPECIAL_FRAME(currentThread);
/* Object might have moved - update its address and the address of the state slot. */
continuationStatePtr = VM_ContinuationHelpers::getContinuationStateAddress(currentThread, continuationObject);
continue;
} else {
break;
}
} while (false);
}
omrthread_monitor_exit(currentThread->publicFlagsMutex);
}
/* Remove pending state */
oldContinuationState = *continuationStatePtr;
Assert_VM_true(VM_ContinuationHelpers::isMountedWithCarrierThread(oldContinuationState, currentThread));
Assert_VM_true(VM_ContinuationHelpers::isPendingToBeMounted(oldContinuationState));
ContinuationState newContinuationState = oldContinuationState;
VM_ContinuationHelpers::resetPendingState(&newContinuationState);
returnContinuationState = VM_AtomicSupport::lockCompareExchange(continuationStatePtr, oldContinuationState, newContinuationState);
} while (oldContinuationState != returnContinuationState);
Assert_VM_false(VM_ContinuationHelpers::isPendingToBeMounted(*continuationStatePtr));
Assert_VM_false(VM_ContinuationHelpers::isConcurrentlyScanned(*continuationStatePtr));

return continuationObject;
}
Expand Down

0 comments on commit cfcd5ea

Please sign in to comment.