Skip to content

Commit

Permalink
Don't use adjacancy check for arraylets in WOC fixup
Browse files Browse the repository at this point in the history
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 enabled 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 <[email protected]>
  • Loading branch information
Aleksandar Micic authored and Aleksandar Micic committed Feb 19, 2025
1 parent cc83b6a commit e546e71
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions runtime/gc_vlhgc/WriteOnceCompactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e546e71

Please sign in to comment.