From 928a7c860dda6936787432ca16ac36dae04391c6 Mon Sep 17 00:00:00 2001 From: Aleksandar Micic Date: Tue, 18 Feb 2025 12:14:41 -0500 Subject: [PATCH] Don't use adjacancy check for arraylets in WOC fixup When fixing up contiguous reference arrays in Write Once Compactor the rules should be: - pick any, if arraylet mode (offheap disabled) - pick any fully initialized array (dataAddr is set), if offheap mode No need to check if data is adjacent - it's given by these conditions. More so, it's not even correct to use is-adjacent API for arraylet mode. Signed-off-by: Aleksandar Micic --- runtime/gc_vlhgc/WriteOnceCompactor.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/runtime/gc_vlhgc/WriteOnceCompactor.cpp b/runtime/gc_vlhgc/WriteOnceCompactor.cpp index 29416892bf9..1552e6c5f41 100644 --- a/runtime/gc_vlhgc/WriteOnceCompactor.cpp +++ b/runtime/gc_vlhgc/WriteOnceCompactor.cpp @@ -1380,16 +1380,15 @@ MM_WriteOnceCompactor::fixupPointerArrayObject(MM_EnvironmentVLHGC* env, J9Objec GC_ArrayletObjectModel::ArrayLayout layout = indexableObjectModel->getArrayLayout((J9IndexableObject *)objectPtr); if (GC_ArrayletObjectModel::InlineContiguous == layout) { - /* For offheap we need a special check for the case of a partially offheap allocated array that caused the current GC - * (its dataAddr field will still be NULL), with offheap heap we will fixup camouflaged discontiguous arrays) - DM, like default - * balanced, wants to fixup only truly contiguous arrays + /* For offheap enabled, a special check is needed for the case of a partially offheap allocated array that caused the current GC + * (its dataAddr field will still be NULL). + * For offheap disabled, any contiguous is scanned. */ - if (indexableObjectModel->isDataAdjacentToHeader((J9IndexableObject *)objectPtr) #if defined(J9VM_ENV_DATA64) - || (indexableObjectModel->isVirtualLargeObjectHeapEnabled() - && (NULL != indexableObjectModel->getDataAddrForContiguous((J9IndexableObject *)objectPtr))) + if (!indexableObjectModel->isVirtualLargeObjectHeapEnabled() + || (NULL != indexableObjectModel->getDataAddrForContiguous((J9IndexableObject *)objectPtr))) #endif /* defined(J9VM_ENV_DATA64) */ - ) { + { uintptr_t elementsToWalk = indexableObjectModel->getSizeInElements((J9IndexableObject *)objectPtr); GC_PointerArrayIterator it(_javaVM, objectPtr); uintptr_t previous = 0;