Skip to content

Commit e993860

Browse files
authored
Merge pull request #19574 from LinHu2016/v0.46.0-release
(0.46) Fix the references in continunation java stacks for scavenger backout
2 parents a856f92 + 2c14ebc commit e993860

File tree

3 files changed

+54
-16
lines changed

3 files changed

+54
-16
lines changed

runtime/gc_glue_java/ScavengerBackOutScanner.cpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,4 +328,51 @@ MM_ScavengerBackOutScanner::backoutUnfinalizedObjects(MM_EnvironmentStandard *en
328328
env->getGCEnvironment()->_unfinalizedObjectBuffer->flush(env);
329329
}
330330
#endif /* J9VM_GC_FINALIZATION */
331+
332+
/**
333+
* Backout the continuation objects.
334+
* Move continuation backout processing in scanAllSlots(), scavenger abort would never happen after continuationObjectList processing
335+
* (so only need to backout list._head from _priorHead).
336+
* Here walk the lists in the Evacuate region only for helping to back out the references in java stacks of the unmounted continuations.
337+
*/
338+
void
339+
MM_ScavengerBackOutScanner::backoutContinuationObjects(MM_EnvironmentStandard *env)
340+
{
341+
#if defined(OMR_GC_CONCURRENT_SCAVENGER)
342+
if (_extensions->isConcurrentScavengerEnabled()) {
343+
/**
344+
* For ConcurrentScavenge no need to backout stack references,
345+
* since they will be fixed up to point to the new version of the object
346+
* (if not already do so), later during marking when continuation objects are found live.
347+
*/
348+
return;
349+
} else
350+
#endif /* OMR_GC_CONCURRENT_SCAVENGER */
351+
{
352+
MM_Heap *heap = _extensions->heap;
353+
MM_HeapRegionManager *regionManager = heap->getHeapRegionManager();
354+
MM_HeapRegionDescriptorStandard *region = NULL;
355+
bool const compressed = _extensions->compressObjectReferences();
356+
GC_HeapRegionIteratorStandard regionIterator(regionManager);
357+
358+
while (NULL != (region = regionIterator.nextRegion())) {
359+
if (_scavenger->isObjectInEvacuateMemory((omrobjectptr_t )region->getLowAddress())) {
360+
MM_HeapRegionDescriptorStandardExtension *regionExtension = MM_ConfigurationDelegate::getHeapRegionDescriptorStandardExtension(env, region);
361+
for (uintptr_t i = 0; i < regionExtension->_maxListIndex; i++) {
362+
MM_ContinuationObjectList *list = &regionExtension->_continuationObjectLists[i];
363+
if (!list->wasEmpty()) {
364+
omrobjectptr_t object = list->getPriorList();
365+
while (NULL != object) {
366+
omrobjectptr_t next = _extensions->accessBarrier->getContinuationLink(object);
367+
MM_ForwardedHeader forwardHeader(object, compressed);
368+
Assert_MM_false(forwardHeader.isForwardedPointer());
369+
_scavenger->getDelegate()->scanContinuationNativeSlots(env, object, SCAN_REASON_BACKOUT);
370+
object = next;
371+
}
372+
}
373+
}
374+
}
375+
}
376+
}
377+
}
331378
#endif /* defined(OMR_GC_MODRON_SCAVENGER) */

runtime/gc_glue_java/ScavengerBackOutScanner.hpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class MM_ScavengerBackOutScanner : public MM_RootScanner
4646
void backoutUnfinalizedObjects(MM_EnvironmentStandard *env);
4747
void backoutFinalizableObjects(MM_EnvironmentStandard *env);
4848
#endif
49+
void backoutContinuationObjects(MM_EnvironmentStandard *env);
4950

5051
public:
5152
MM_ScavengerBackOutScanner(MM_EnvironmentBase *env, bool singleThread, MM_Scavenger *scavenger)
@@ -117,11 +118,12 @@ class MM_ScavengerBackOutScanner : public MM_RootScanner
117118

118119
/* empty, move ownable synchronizer backout processing in scanAllSlots() */
119120
virtual void scanOwnableSynchronizerObjects(MM_EnvironmentBase *env) {}
120-
/**
121-
* empty, move continuation backout processing in scanAllSlots(), scavenger abort would never happen after continuationObjectList processing
122-
* so only need to backout list._head from _priorHead
123-
*/
124-
virtual void scanContinuationObjects(MM_EnvironmentBase *env) {}
121+
virtual void scanContinuationObjects(MM_EnvironmentBase *env)
122+
{
123+
reportScanningStarted(RootScannerEntity_ContinuationObjects);
124+
backoutContinuationObjects(MM_EnvironmentStandard::getEnvironment(env));
125+
reportScanningEnded(RootScannerEntity_ContinuationObjects);
126+
}
125127
};
126128
#endif /* defined(OMR_GC_MODRON_SCAVENGER) */
127129

runtime/gc_glue_java/ScavengerDelegate.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -653,17 +653,6 @@ MM_ScavengerDelegate::reverseForwardedObject(MM_EnvironmentBase *env, MM_Forward
653653
if (NULL != finalizeLinkAddress) {
654654
barrier->setFinalizeLink(objectPtr, barrier->getFinalizeLink(fwdObjectPtr));
655655
}
656-
657-
/* fixup the references in the continuation native StackSlots */
658-
switch (_extensions->objectModel.getScanType(forwardedClass)) {
659-
660-
case GC_ObjectModel::SCAN_CONTINUATION_OBJECT:
661-
scanContinuationNativeSlots(MM_EnvironmentStandard::getEnvironment(env), objectPtr, SCAN_REASON_BACKOUT);
662-
break;
663-
default:
664-
break;
665-
}
666-
667656
}
668657
}
669658

0 commit comments

Comments
 (0)