From 966663b3b52fb9043d30b06a2515e33831de4cde Mon Sep 17 00:00:00 2001 From: Dmitri Pivkine Date: Wed, 13 Nov 2024 12:12:44 -0500 Subject: [PATCH] Do not add Own.Sync. object to the list if scan wasn't successfull If Ownable Synchronizer object scan has not been successful (caused Copy Forward abort) it should not be aadded to the list right away. This object is remembered in the work packet and is going to be rescanned for the second time. Relates https://github.com/eclipse-openj9/openj9/issues/20395 Signed-off-by: Dmitri Pivkine --- runtime/gc_vlhgc/CopyForwardScheme.cpp | 14 ++++++++------ runtime/gc_vlhgc/CopyForwardScheme.hpp | 3 ++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/runtime/gc_vlhgc/CopyForwardScheme.cpp b/runtime/gc_vlhgc/CopyForwardScheme.cpp index 4fe9d1a8a24..fa5da4fd18b 100644 --- a/runtime/gc_vlhgc/CopyForwardScheme.cpp +++ b/runtime/gc_vlhgc/CopyForwardScheme.cpp @@ -2285,14 +2285,15 @@ MM_CopyForwardScheme::updateMarkMapAndCardTableOnCopy(MM_EnvironmentVLHGC *env, MMINLINE void MM_CopyForwardScheme::scanOwnableSynchronizerObjectSlots(MM_EnvironmentVLHGC *env, MM_AllocationContextTarok *reservingContext, J9Object *objectPtr, ScanReason reason) { - if (SCAN_REASON_COPYSCANCACHE == reason) { - addOwnableSynchronizerObjectInList(env, objectPtr); - } else if (SCAN_REASON_PACKET == reason) { - if (isObjectInEvacuateMemoryNoCheck(objectPtr)) { + if (scanMixedObjectSlots(env, reservingContext, objectPtr, reason)) { + if (SCAN_REASON_COPYSCANCACHE == reason) { addOwnableSynchronizerObjectInList(env, objectPtr); + } else if (SCAN_REASON_PACKET == reason) { + if (isObjectInEvacuateMemoryNoCheck(objectPtr)) { + addOwnableSynchronizerObjectInList(env, objectPtr); + } } } - scanMixedObjectSlots(env, reservingContext, objectPtr, reason); } void @@ -2416,7 +2417,7 @@ MM_CopyForwardScheme::iterateAndCopyforwardSlotReference(MM_EnvironmentVLHGC *en return success; } -void +bool MM_CopyForwardScheme::scanMixedObjectSlots(MM_EnvironmentVLHGC *env, MM_AllocationContextTarok *reservingContext, J9Object *objectPtr, ScanReason reason) { if (_tracingEnabled) { @@ -2432,6 +2433,7 @@ MM_CopyForwardScheme::scanMixedObjectSlots(MM_EnvironmentVLHGC *env, MM_Allocati } updateScanStats(env, objectPtr, reason); + return success; } void diff --git a/runtime/gc_vlhgc/CopyForwardScheme.hpp b/runtime/gc_vlhgc/CopyForwardScheme.hpp index 870aaca0a94..afd2a0d3200 100644 --- a/runtime/gc_vlhgc/CopyForwardScheme.hpp +++ b/runtime/gc_vlhgc/CopyForwardScheme.hpp @@ -318,8 +318,9 @@ class MM_CopyForwardScheme : public MM_BaseNonVirtual * @param reservingContext[in] The context to which we would prefer to copy any objects discovered in this method * @param objectPtr current object being scanned. * @param reason to scan (dirty card, packet, scan cache, overflow) + * @return true if all slots have been copied successfully */ - void scanMixedObjectSlots(MM_EnvironmentVLHGC *env, MM_AllocationContextTarok *reservingContext, J9Object *objectPtr, ScanReason reason); + bool scanMixedObjectSlots(MM_EnvironmentVLHGC *env, MM_AllocationContextTarok *reservingContext, J9Object *objectPtr, ScanReason reason); /** * Scan the slots of a reference mixed object. * Copy and forward all relevant slots values found in the object.