Skip to content

Commit 1b61bae

Browse files
authored
Merge pull request #20589 from dmitripivkine/master
Do not add Own.Sync. object to the list if scan wasn't successfull
2 parents 73e2aa2 + ffa90d0 commit 1b61bae

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

runtime/gc_vlhgc/CopyForwardScheme.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,14 +2285,21 @@ MM_CopyForwardScheme::updateMarkMapAndCardTableOnCopy(MM_EnvironmentVLHGC *env,
22852285
MMINLINE void
22862286
MM_CopyForwardScheme::scanOwnableSynchronizerObjectSlots(MM_EnvironmentVLHGC *env, MM_AllocationContextTarok *reservingContext, J9Object *objectPtr, ScanReason reason)
22872287
{
2288-
if (SCAN_REASON_COPYSCANCACHE == reason) {
2289-
addOwnableSynchronizerObjectInList(env, objectPtr);
2290-
} else if (SCAN_REASON_PACKET == reason) {
2291-
if (isObjectInEvacuateMemoryNoCheck(objectPtr)) {
2288+
if (scanMixedObjectSlots(env, reservingContext, objectPtr, reason)) {
2289+
/*
2290+
* If object has been scanned without triggering abort add it to the list here.
2291+
* If object scan triggered abort, it has been added to work packet
2292+
* and is going to be rescanned again. It should not be added to the list here
2293+
* to prevent duplication during second scan.
2294+
*/
2295+
if (SCAN_REASON_COPYSCANCACHE == reason) {
22922296
addOwnableSynchronizerObjectInList(env, objectPtr);
2297+
} else if (SCAN_REASON_PACKET == reason) {
2298+
if (isObjectInEvacuateMemoryNoCheck(objectPtr)) {
2299+
addOwnableSynchronizerObjectInList(env, objectPtr);
2300+
}
22932301
}
22942302
}
2295-
scanMixedObjectSlots(env, reservingContext, objectPtr, reason);
22962303
}
22972304

22982305
void
@@ -2416,7 +2423,7 @@ MM_CopyForwardScheme::iterateAndCopyforwardSlotReference(MM_EnvironmentVLHGC *en
24162423
return success;
24172424
}
24182425

2419-
void
2426+
bool
24202427
MM_CopyForwardScheme::scanMixedObjectSlots(MM_EnvironmentVLHGC *env, MM_AllocationContextTarok *reservingContext, J9Object *objectPtr, ScanReason reason)
24212428
{
24222429
if (_tracingEnabled) {
@@ -2432,6 +2439,7 @@ MM_CopyForwardScheme::scanMixedObjectSlots(MM_EnvironmentVLHGC *env, MM_Allocati
24322439
}
24332440

24342441
updateScanStats(env, objectPtr, reason);
2442+
return success;
24352443
}
24362444

24372445
void

runtime/gc_vlhgc/CopyForwardScheme.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,9 @@ class MM_CopyForwardScheme : public MM_BaseNonVirtual
318318
* @param reservingContext[in] The context to which we would prefer to copy any objects discovered in this method
319319
* @param objectPtr current object being scanned.
320320
* @param reason to scan (dirty card, packet, scan cache, overflow)
321+
* @return true if all slots have been copied successfully
321322
*/
322-
void scanMixedObjectSlots(MM_EnvironmentVLHGC *env, MM_AllocationContextTarok *reservingContext, J9Object *objectPtr, ScanReason reason);
323+
bool scanMixedObjectSlots(MM_EnvironmentVLHGC *env, MM_AllocationContextTarok *reservingContext, J9Object *objectPtr, ScanReason reason);
323324
/**
324325
* Scan the slots of a reference mixed object.
325326
* Copy and forward all relevant slots values found in the object.

0 commit comments

Comments
 (0)