Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename OffHeap macro in JIT code #20494

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions runtime/compiler/aarch64/codegen/J9CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ J9::ARM64::CodeGenerator::initialize()

static bool disableInlineVectorizedMismatch = feGetEnv("TR_disableInlineVectorizedMismatch") != NULL;
if (cg->getSupportsArrayCmpLen() &&
#if defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
#if defined(J9VM_GC_SPARSE_HEAP_ALLOCATION)
!TR::Compiler->om.isOffHeapAllocationEnabled() &&
#endif /* J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION */
#endif /* J9VM_GC_SPARSE_HEAP_ALLOCATION */
!disableInlineVectorizedMismatch)
{
cg->setSupportsInlineVectorizedMismatch();
Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/aarch64/codegen/J9TreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3449,7 +3449,7 @@ J9::ARM64::TreeEvaluator::VMnewEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
genInitArrayHeader(node, cg, clazz, resultReg, classReg, lengthReg, zeroReg, tempReg1, isBatchClearTLHEnabled, tlhHasNotBeenCleared);

#ifdef J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION
#ifdef J9VM_GC_SPARSE_HEAP_ALLOCATION
if (TR::Compiler->om.isOffHeapAllocationEnabled())
{
/* Here we'll update dataAddr slot for both fixed and variable length arrays. Fixed length arrays are
Expand Down Expand Up @@ -3519,7 +3519,7 @@ J9::ARM64::TreeEvaluator::VMnewEvaluator(TR::Node *node, TR::CodeGenerator *cg)

generateMemSrc1Instruction(cg, TR::InstOpCode::strimmx, node, dataAddrSlotMR, firstDataElementReg);
}
#endif /* J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION */
#endif /* J9VM_GC_SPARSE_HEAP_ALLOCATION */
if (generateArraylets)
{
// write arraylet pointer to object header
Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/codegen/J9CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -891,11 +891,11 @@ J9::CodeGenerator::lowerTreeIfNeeded(
performTransformation(self()->comp(), "O^O Call arraycopy instead of Unsafe.copyMemory: %s\n", self()->getDebug()->getName(node)))
{

#if defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
#if defined(J9VM_GC_SPARSE_HEAP_ALLOCATION)
if (TR::Compiler->om.isOffHeapAllocationEnabled())
TR::TransformUtil::transformUnsafeCopyMemorytoArrayCopyForOffHeap(self()->comp(), tt, node);
else
#endif /* J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION */
#endif /* J9VM_GC_SPARSE_HEAP_ALLOCATION */
{
TR::Node *src = node->getChild(1);
TR::Node *srcOffset = node->getChild(2);
Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/env/J9ObjectModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ J9::ObjectModel::getAddressOfElement(TR::Compilation* comp, uintptr_t objectPoin
offset < TR::Compiler->om.getArrayLengthInBytes(comp, objectPointer) + TR::Compiler->om.contiguousArrayHeaderSizeInBytes(), "Array is out of bound");

// If the array is contiguous, return the addition of objectPointer and offset
#if defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
#if defined(J9VM_GC_SPARSE_HEAP_ALLOCATION)
// When OffHeap is enabled, offset trees and passed value do not include headerSize.
// If Unsafe accesses reaches this helper offset would not have headerSize included
// as Unsafe.arrayBaseOffset returns 0 when OffHeap is enabled.
Expand All @@ -667,7 +667,7 @@ J9::ObjectModel::getAddressOfElement(TR::Compilation* comp, uintptr_t objectPoin
objectPointer = *(uintptr_t *)(objectPointer + TR::Compiler->om.offsetOfContiguousDataAddrField());
return objectPointer + offset;
}
#endif /* J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION */
#endif /* J9VM_GC_SPARSE_HEAP_ALLOCATION */
if (!TR::Compiler->om.isDiscontiguousArray(comp, objectPointer))
return objectPointer + offset;

Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/env/VMJ9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4104,7 +4104,7 @@ TR_J9VMBase::initializeLocalArrayHeader(TR::Compilation * comp, TR::Node * alloc
node = TR::Node::createWithSymRef(TR::istorei, 2, 2, allocationNode, node, arraySizeSymRef);
prevTree = TR::TreeTop::create(comp, prevTree, node);

#if defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
#if defined(J9VM_GC_SPARSE_HEAP_ALLOCATION)
if (TR::Compiler->om.isOffHeapAllocationEnabled())
{
// -----------------------------------------------------------------------------------
Expand All @@ -4117,7 +4117,7 @@ TR_J9VMBase::initializeLocalArrayHeader(TR::Compilation * comp, TR::Node * alloc
TR::Node *storeDataAddrPointerNode = TR::Node::createWithSymRef(TR::astorei, 2, allocationNode, startOfDataNode, 0, dataAddrFieldOffsetSymRef);
prevTree = TR::TreeTop::create(comp, prevTree, storeDataAddrPointerNode);
}
#endif /* J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION */
#endif /* J9VM_GC_SPARSE_HEAP_ALLOCATION */
}


Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/ilgen/J9ByteCodeIlGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ class TR_J9ByteCodeIlGenerator : public TR_IlGenerator, public TR_J9ByteCodeIter
void storeArrayElement(TR::DataType dt, TR::ILOpCodes opCode, bool checks = true);

void calculateElementAddressInContiguousArray(int32_t, int32_t);
#if defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
#if defined(J9VM_GC_SPARSE_HEAP_ALLOCATION)
void calculateElementAddressInContiguousArrayUsingDataAddrField(int32_t);
#endif /* J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION */
#endif /* J9VM_GC_SPARSE_HEAP_ALLOCATION */
void calculateIndexFromOffsetInContiguousArray(int32_t, int32_t);
void calculateArrayElementAddress(TR::DataType, bool checks);

Expand Down
8 changes: 4 additions & 4 deletions runtime/compiler/ilgen/Walker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2033,7 +2033,7 @@ TR_J9ByteCodeIlGenerator::calculateElementAddressInContiguousArray(int32_t width
}
}

#if defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
#if defined(J9VM_GC_SPARSE_HEAP_ALLOCATION)
void
TR_J9ByteCodeIlGenerator::calculateElementAddressInContiguousArrayUsingDataAddrField(int32_t width)
{
Expand Down Expand Up @@ -2063,7 +2063,7 @@ TR_J9ByteCodeIlGenerator::calculateElementAddressInContiguousArrayUsingDataAddrF
// stack is now ...,firstArrayElement,shift/index<===
genBinary(TR::aladd);
}
#endif /* J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION */
#endif /* J9VM_GC_SPARSE_HEAP_ALLOCATION */

// Helper to calculate the index of the array element in a contiguous array
// Stack: ..., offset for array element index
Expand Down Expand Up @@ -2148,7 +2148,7 @@ TR_J9ByteCodeIlGenerator::calculateArrayElementAddress(TR::DataType dataType, bo
}

// Stack is now ...,aryRef,index<===
#if defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
#if defined(J9VM_GC_SPARSE_HEAP_ALLOCATION)
if (fej9()->isOffHeapAllocationEnabled())
{
// stack is now ...,aryRef,index<===
Expand All @@ -2159,7 +2159,7 @@ TR_J9ByteCodeIlGenerator::calculateArrayElementAddress(TR::DataType dataType, bo
else if (comp()->generateArraylets())
#else
if (comp()->generateArraylets())
#endif /* J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION */
#endif /* J9VM_GC_SPARSE_HEAP_ALLOCATION */
{
// shift the index on the current stack to get index into array spine
loadConstant(TR::iconst, fej9()->getArraySpineShift(width));
Expand Down
16 changes: 8 additions & 8 deletions runtime/compiler/optimizer/InlinerTempForJ9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1587,7 +1587,7 @@ TR_J9InlinerPolicy::createUnsafePutWithOffset(TR::ResolvedMethodSymbol *calleeSy
}


#if defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
#if defined(J9VM_GC_SPARSE_HEAP_ALLOCATION)
//adjust arguments if object is array and offheap is being used by changing
//object base address (second child) to dataAddr

Expand Down Expand Up @@ -1619,7 +1619,7 @@ TR_J9InlinerPolicy::createUnsafePutWithOffset(TR::ResolvedMethodSymbol *calleeSy
objBaseAddrNode->decReferenceCount();
dataAddrNode->incReferenceCount();
}
#endif /* J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION */
#endif /* J9VM_GC_SPARSE_HEAP_ALLOCATION */

genCodeForUnsafeGetPut(unsafeAddress, offset, type, callNodeTreeTop,
prevTreeTop, newSymbolReferenceForAddress,
Expand Down Expand Up @@ -1804,7 +1804,7 @@ TR_J9InlinerPolicy::createUnsafeCASCallDiamond(TR::TreeTop *callNodeTreeTop, TR:
TR::TreeTop *arrayAccessTreeTop = NULL;
TR::TreeTop *nonArrayAccessTreeTop = NULL;

#if defined (J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
#if defined(J9VM_GC_SPARSE_HEAP_ALLOCATION)
if (arrayTestNeeded)
{
//create array test treetop
Expand Down Expand Up @@ -1862,7 +1862,7 @@ TR_J9InlinerPolicy::createUnsafeCASCallDiamond(TR::TreeTop *callNodeTreeTop, TR:
TR::Node *isNullNode = TR::Node::createif(TR::ifacmpeq, objAddr, TR::Node::create(objAddr, TR::aconst, 0, 0), NULL);
isNullTreeTop = TR::TreeTop::create(comp(), isNullNode);
}
#endif /* J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION */
#endif /* J9VM_GC_SPARSE_HEAP_ALLOCATION */

//default access tree (non-array, non-lowtagged)
TR::TreeTop *defaultAccessTreeTop = TR::TreeTop::create(comp(),callNodeTreeTop->getNode()->duplicateTree());
Expand Down Expand Up @@ -2142,7 +2142,7 @@ TR_J9InlinerPolicy::createUnsafeGetWithOffset(TR::ResolvedMethodSymbol *calleeSy
genIndirectAccessCodeForUnsafeGetPut(callNodeTreeTop->getNode(), unsafeAddress);


#if defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
#if defined(J9VM_GC_SPARSE_HEAP_ALLOCATION)
//adjust arguments if object is array and offheap is being used by changing
//object base address (second child) to dataAddr

Expand Down Expand Up @@ -2179,7 +2179,7 @@ TR_J9InlinerPolicy::createUnsafeGetWithOffset(TR::ResolvedMethodSymbol *calleeSy
objBaseAddrNode->decReferenceCount();
dataAddrNode->incReferenceCount();
}
#endif /* J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION */
#endif /* J9VM_GC_SPARSE_HEAP_ALLOCATION */

genCodeForUnsafeGetPut(unsafeAddress, offset, type, callNodeTreeTop,
prevTreeTop, newSymbolReferenceForAddress,
Expand Down Expand Up @@ -2673,10 +2673,10 @@ TR_J9InlinerPolicy::inlineUnsafeCall(TR::ResolvedMethodSymbol *calleeSymbol, TR:
case TR::sun_misc_Unsafe_compareAndSwapObject_jlObjectJjlObjectjlObject_Z:
if (callNode->isSafeForCGToFastPathUnsafeCall())
return false;
#if defined (J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
#if defined(J9VM_GC_SPARSE_HEAP_ALLOCATION)
if(TR::Compiler->om.isOffHeapAllocationEnabled())
return createUnsafeCASCallDiamond(callNodeTreeTop, callNode);
#endif /* J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION */
#endif /* J9VM_GC_SPARSE_HEAP_ALLOCATION */
switch (callerSymbol->castToMethodSymbol()->getRecognizedMethod())
{
case TR::java_util_concurrent_ConcurrentHashMap_addCount:
Expand Down
12 changes: 6 additions & 6 deletions runtime/compiler/optimizer/J9TransformUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2129,10 +2129,10 @@ TR::Node * J9::TransformUtil::calculateElementAddress(TR::Compilation *comp, TR:
// Calculate element address
TR::Node *addrCalc = NULL;

#if defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
#if defined(J9VM_GC_SPARSE_HEAP_ALLOCATION)
if (TR::Compiler->om.isOffHeapAllocationEnabled())
array = TR::TransformUtil::generateDataAddrLoadTrees(comp, array);
#endif /* J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION */
#endif /* J9VM_GC_SPARSE_HEAP_ALLOCATION */

if (comp->target().is64Bit())
addrCalc = TR::Node::create(TR::aladd, 2, array, offset);
Expand Down Expand Up @@ -2197,13 +2197,13 @@ TR::Node * J9::TransformUtil::calculateOffsetFromIndexInContiguousArrayWithEleme
}

int32_t headerSize;
#if defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
#if defined(J9VM_GC_SPARSE_HEAP_ALLOCATION)
if (TR::Compiler->om.isOffHeapAllocationEnabled())
{
headerSize = 0;
}
else
#endif /* J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION */
#endif /* J9VM_GC_SPARSE_HEAP_ALLOCATION */
{
headerSize = TR::Compiler->om.contiguousArrayHeaderSizeInBytes();
}
Expand Down Expand Up @@ -2879,7 +2879,7 @@ J9::TransformUtil::refineMethodHandleLinkTo(TR::Compilation* comp, TR::TreeTop*
#endif
}

#if defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
#if defined(J9VM_GC_SPARSE_HEAP_ALLOCATION)
TR::TreeTop* J9::TransformUtil::convertUnsafeCopyMemoryCallToArrayCopyWithSymRefLoad(TR::Compilation *comp, TR::TreeTop *arrayCopyTT, TR::SymbolReference * srcRef, TR::SymbolReference * destRef)
{
// Convert call to arraycopy node
Expand Down Expand Up @@ -3062,4 +3062,4 @@ void J9::TransformUtil::transformUnsafeCopyMemorytoArrayCopyForOffHeap(TR::Compi

return;
}
#endif /* J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION */
#endif /* J9VM_GC_SPARSE_HEAP_ALLOCATION */
4 changes: 2 additions & 2 deletions runtime/compiler/optimizer/J9TransformUtil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ class OMR_EXTENSIBLE TransformUtil : public OMR::TransformUtilConnector
TR::Symbol::RecognizedField recField,
TR::AnyConst *outValue);

#if defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
#if defined(J9VM_GC_SPARSE_HEAP_ALLOCATION)
/**
* \brief
* Converts Unsafe.copyMemory call into arraycopy node replacing
Expand Down Expand Up @@ -388,7 +388,7 @@ class OMR_EXTENSIBLE TransformUtil : public OMR::TransformUtilConnector
* Return true if call is converted
*/
static void transformUnsafeCopyMemorytoArrayCopyForOffHeap(TR::Compilation *comp, TR::TreeTop *arrayCopyTT, TR::Node *arraycopyNode);
#endif /* J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION */
#endif /* J9VM_GC_SPARSE_HEAP_ALLOCATION */

protected:
/**
Expand Down
8 changes: 4 additions & 4 deletions runtime/compiler/optimizer/J9ValuePropagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,14 +577,14 @@ bool J9::ValuePropagation::transformUnsafeCopyMemoryCall(TR::Node *arraycopyNode
TR::TreeTop *tt = _curTree;
TR::Node *ttNode = tt->getNode();

#if defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
#if defined(J9VM_GC_SPARSE_HEAP_ALLOCATION)
if (TR::Compiler->om.isOffHeapAllocationEnabled()
&& (ttNode->getOpCodeValue() == TR::treetop || ttNode->getOpCode().isResolveOrNullCheck()))
{
_offHeapCopyMemory.add(new (comp()->trStackMemory()) J9::ValuePropagation::TR_TreeTopNodePair(tt, arraycopyNode));
return true;
}
#endif /* J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION */
#endif /* J9VM_GC_SPARSE_HEAP_ALLOCATION */

if ((ttNode->getOpCodeValue() == TR::treetop || ttNode->getOpCode().isResolveOrNullCheck())
&& performTransformation(comp(), "%sChanging call Unsafe.copyMemory [%p] to arraycopy\n", OPT_DETAILS, arraycopyNode))
Expand Down Expand Up @@ -3270,7 +3270,7 @@ J9::ValuePropagation::doDelayedTransformations()
}
_callsToBeFoldedToNode.deleteAll();

#if defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
#if defined(J9VM_GC_SPARSE_HEAP_ALLOCATION)
// Transform Unsafe.copyMemory in OffHeap
if (TR::Compiler->om.isOffHeapAllocationEnabled())
{
Expand All @@ -3284,7 +3284,7 @@ J9::ValuePropagation::doDelayedTransformations()
}
_offHeapCopyMemory.deleteAll();
}
#endif /* J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION */
#endif /* J9VM_GC_SPARSE_HEAP_ALLOCATION */

// Process transformations for calls to value types helpers or non-helpers
ListIterator<ValueTypesHelperCallTransform> valueTypesHelperCallsToBeFolded(&_valueTypesHelperCallsToBeFolded);
Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/optimizer/UnsafeFastPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ int32_t TR_UnsafeFastPath::perform()
TR::Node *addrCalc = NULL;

// Calculate element address
#if defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
#if defined(J9VM_GC_SPARSE_HEAP_ALLOCATION)
if (isArrayOperation && TR::Compiler->om.isOffHeapAllocationEnabled())
{
TR::Node *baseNodeForAdd = TR::TransformUtil::generateDataAddrLoadTrees(comp(), base);
Expand All @@ -980,7 +980,7 @@ int32_t TR_UnsafeFastPath::perform()
else if (comp()->target().is64Bit())
#else
if (comp()->target().is64Bit())
#endif /* J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION */
#endif /* J9VM_GC_SPARSE_HEAP_ALLOCATION */
addrCalc = TR::Node::create(TR::aladd, 2, base, offset);
else
addrCalc = TR::Node::create(TR::aiadd, 2, base, TR::Node::create(TR::l2i, 1, offset));
Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/p/codegen/J9CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ J9::Power::CodeGenerator::initialize()

static bool disableInlineVectorizedMismatch = feGetEnv("TR_disableInlineVectorizedMismatch") != NULL;
if (cg->getSupportsArrayCmpLen() &&
#if defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
#if defined(J9VM_GC_SPARSE_HEAP_ALLOCATION)
!TR::Compiler->om.isOffHeapAllocationEnabled() &&
#endif /* J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION */
#endif /* J9VM_GC_SPARSE_HEAP_ALLOCATION */
!disableInlineVectorizedMismatch)
{
cg->setSupportsInlineVectorizedMismatch();
Expand Down
Loading