From 2a68c8d446a0c45971b5d3f72d54fdc4f5daf9d9 Mon Sep 17 00:00:00 2001 From: Abdulrahman Alattas Date: Wed, 18 Sep 2024 10:56:24 -0400 Subject: [PATCH 1/2] Add OffHeap Query in J9VM Signed-off-by: Abdulrahman Alattas --- runtime/compiler/env/VMJ9.cpp | 21 +++++++++++++++++++++ runtime/compiler/env/VMJ9.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/runtime/compiler/env/VMJ9.cpp b/runtime/compiler/env/VMJ9.cpp index a4315becf1f..3cf82ffdbe0 100644 --- a/runtime/compiler/env/VMJ9.cpp +++ b/runtime/compiler/env/VMJ9.cpp @@ -2439,6 +2439,27 @@ TR_J9VMBase::isHotReferenceFieldRequired() return TR::Compiler->om.isHotReferenceFieldRequired(); } +bool +TR_J9VMBase::isIndexableDataAddrPresent() + { +#if defined(J9VM_ENV_DATA64) + return FALSE != _jitConfig->javaVM->isIndexableDataAddrPresent; +#else + return false; +#endif /* defined(J9VM_ENV_DATA64) */ + } + +/** + * Query if off-heap large array allocation is enabled + * + * @return true if off-heap large array allocation is enabled, false otherwise + */ +bool +TR_J9VMBase::isOffHeapAllocationEnabled() + { + return TR::Compiler->om.isOffHeapAllocationEnabled(); + } + bool TR_J9VMBase::scanReferenceSlotsInClassForOffset(TR::Compilation * comp, TR_OpaqueClassBlock * classPointer, int32_t offset) { diff --git a/runtime/compiler/env/VMJ9.h b/runtime/compiler/env/VMJ9.h index e57f23ff7eb..1cfa1682576 100644 --- a/runtime/compiler/env/VMJ9.h +++ b/runtime/compiler/env/VMJ9.h @@ -1452,6 +1452,8 @@ class TR_J9VMBase : public TR_FrontEnd virtual void markHotField( TR::Compilation *, TR::SymbolReference *, TR_OpaqueClassBlock *, bool); virtual void reportHotField(int32_t reducedCpuUtil, J9Class* clazz, uint8_t fieldOffset, uint32_t reducedFrequency); virtual bool isHotReferenceFieldRequired(); + virtual bool isIndexableDataAddrPresent(); + virtual bool isOffHeapAllocationEnabled(); virtual void markClassForTenuredAlignment( TR::Compilation *comp, TR_OpaqueClassBlock *opclazz, uint32_t alignFromStart); virtual bool shouldDelayAotLoad() { return false; } From 721d44444765991bc65f5d7d2cef67bf3673496a Mon Sep 17 00:00:00 2001 From: Abdulrahman Alattas Date: Wed, 18 Sep 2024 16:03:12 -0400 Subject: [PATCH 2/2] Add OffHeap Query in J9ServerVM Signed-off-by: Abdulrahman Alattas --- runtime/compiler/env/VMJ9Server.cpp | 25 +++++++++++++++++++++++++ runtime/compiler/env/VMJ9Server.hpp | 2 ++ 2 files changed, 27 insertions(+) diff --git a/runtime/compiler/env/VMJ9Server.cpp b/runtime/compiler/env/VMJ9Server.cpp index 1dc4d168c58..b8116dc8894 100644 --- a/runtime/compiler/env/VMJ9Server.cpp +++ b/runtime/compiler/env/VMJ9Server.cpp @@ -2551,6 +2551,31 @@ TR_J9ServerVM::isPortableRestoreModeEnabled() return vmInfo->_isPortableRestoreMode; } +bool +TR_J9ServerVM::isIndexableDataAddrPresent() + { +#if defined(J9VM_ENV_DATA64) + JITServer::ServerStream *stream = _compInfoPT->getMethodBeingCompiled()->_stream; + auto *vmInfo = _compInfoPT->getClientData()->getOrCacheVMInfo(stream); + return vmInfo->_isIndexableDataAddrPresent; +#else + return false; +#endif /* defined(J9VM_ENV_DATA64) */ + } + +/** + * Query if off-heap large array allocation is enabled + * + * @return true if off-heap large array allocation is enabled, false otherwise + */ +bool +TR_J9ServerVM::isOffHeapAllocationEnabled() + { + JITServer::ServerStream *stream = _compInfoPT->getMethodBeingCompiled()->_stream; + auto *vmInfo = _compInfoPT->getClientData()->getOrCacheVMInfo(stream); + return vmInfo->_isOffHeapAllocationEnabled; + } + bool TR_J9SharedCacheServerVM::isClassLibraryMethod(TR_OpaqueMethodBlock *method, bool vettedForAOT) { diff --git a/runtime/compiler/env/VMJ9Server.hpp b/runtime/compiler/env/VMJ9Server.hpp index 4362ed722e7..8508d1a1205 100644 --- a/runtime/compiler/env/VMJ9Server.hpp +++ b/runtime/compiler/env/VMJ9Server.hpp @@ -251,6 +251,8 @@ class TR_J9ServerVM: public TR_J9VM virtual bool inSnapshotMode() override; virtual bool isSnapshotModeEnabled() override; virtual bool isPortableRestoreModeEnabled() override; + virtual bool isIndexableDataAddrPresent(); + virtual bool isOffHeapAllocationEnabled(); private: bool instanceOfOrCheckCastHelper(J9Class *instanceClass, J9Class* castClass, bool cacheUpdate);