Skip to content

(0.46) Fix the references in continunation java stacks for scavenger backout #19574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions runtime/gc_glue_java/ScavengerBackOutScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,4 +328,51 @@ MM_ScavengerBackOutScanner::backoutUnfinalizedObjects(MM_EnvironmentStandard *en
env->getGCEnvironment()->_unfinalizedObjectBuffer->flush(env);
}
#endif /* J9VM_GC_FINALIZATION */

/**
* Backout the continuation objects.
* Move continuation backout processing in scanAllSlots(), scavenger abort would never happen after continuationObjectList processing
* (so only need to backout list._head from _priorHead).
* Here walk the lists in the Evacuate region only for helping to back out the references in java stacks of the unmounted continuations.
*/
void
MM_ScavengerBackOutScanner::backoutContinuationObjects(MM_EnvironmentStandard *env)
{
#if defined(OMR_GC_CONCURRENT_SCAVENGER)
if (_extensions->isConcurrentScavengerEnabled()) {
/**
* For ConcurrentScavenge no need to backout stack references,
* since they will be fixed up to point to the new version of the object
* (if not already do so), later during marking when continuation objects are found live.
*/
return;
} else
#endif /* OMR_GC_CONCURRENT_SCAVENGER */
{
MM_Heap *heap = _extensions->heap;
MM_HeapRegionManager *regionManager = heap->getHeapRegionManager();
MM_HeapRegionDescriptorStandard *region = NULL;
bool const compressed = _extensions->compressObjectReferences();
GC_HeapRegionIteratorStandard regionIterator(regionManager);

while (NULL != (region = regionIterator.nextRegion())) {
if (_scavenger->isObjectInEvacuateMemory((omrobjectptr_t )region->getLowAddress())) {
MM_HeapRegionDescriptorStandardExtension *regionExtension = MM_ConfigurationDelegate::getHeapRegionDescriptorStandardExtension(env, region);
for (uintptr_t i = 0; i < regionExtension->_maxListIndex; i++) {
MM_ContinuationObjectList *list = &regionExtension->_continuationObjectLists[i];
if (!list->wasEmpty()) {
omrobjectptr_t object = list->getPriorList();
while (NULL != object) {
omrobjectptr_t next = _extensions->accessBarrier->getContinuationLink(object);
MM_ForwardedHeader forwardHeader(object, compressed);
Assert_MM_false(forwardHeader.isForwardedPointer());
_scavenger->getDelegate()->scanContinuationNativeSlots(env, object, SCAN_REASON_BACKOUT);
object = next;
}
}
}
}
}
}
}
#endif /* defined(OMR_GC_MODRON_SCAVENGER) */
12 changes: 7 additions & 5 deletions runtime/gc_glue_java/ScavengerBackOutScanner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class MM_ScavengerBackOutScanner : public MM_RootScanner
void backoutUnfinalizedObjects(MM_EnvironmentStandard *env);
void backoutFinalizableObjects(MM_EnvironmentStandard *env);
#endif
void backoutContinuationObjects(MM_EnvironmentStandard *env);

public:
MM_ScavengerBackOutScanner(MM_EnvironmentBase *env, bool singleThread, MM_Scavenger *scavenger)
Expand Down Expand Up @@ -117,11 +118,12 @@ class MM_ScavengerBackOutScanner : public MM_RootScanner

/* empty, move ownable synchronizer backout processing in scanAllSlots() */
virtual void scanOwnableSynchronizerObjects(MM_EnvironmentBase *env) {}
/**
* empty, move continuation backout processing in scanAllSlots(), scavenger abort would never happen after continuationObjectList processing
* so only need to backout list._head from _priorHead
*/
virtual void scanContinuationObjects(MM_EnvironmentBase *env) {}
virtual void scanContinuationObjects(MM_EnvironmentBase *env)
{
reportScanningStarted(RootScannerEntity_ContinuationObjects);
backoutContinuationObjects(MM_EnvironmentStandard::getEnvironment(env));
reportScanningEnded(RootScannerEntity_ContinuationObjects);
}
};
#endif /* defined(OMR_GC_MODRON_SCAVENGER) */

Expand Down
11 changes: 0 additions & 11 deletions runtime/gc_glue_java/ScavengerDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,17 +653,6 @@ MM_ScavengerDelegate::reverseForwardedObject(MM_EnvironmentBase *env, MM_Forward
if (NULL != finalizeLinkAddress) {
barrier->setFinalizeLink(objectPtr, barrier->getFinalizeLink(fwdObjectPtr));
}

/* fixup the references in the continuation native StackSlots */
switch (_extensions->objectModel.getScanType(forwardedClass)) {

case GC_ObjectModel::SCAN_CONTINUATION_OBJECT:
scanContinuationNativeSlots(MM_EnvironmentStandard::getEnvironment(env), objectPtr, SCAN_REASON_BACKOUT);
break;
default:
break;
}

}
}

Expand Down