From e3a047249791a77ab088c01bcf0a1cda7cd8259d Mon Sep 17 00:00:00 2001 From: Shubham Verma Date: Wed, 29 Jan 2025 13:37:21 -0500 Subject: [PATCH] Add object model API to get minimum object size Signed-off-by: Shubham Verma --- .../control/JITClientCompilationThread.cpp | 1 + runtime/compiler/env/J9ObjectModel.cpp | 14 ++++++++++++++ runtime/compiler/env/J9ObjectModel.hpp | 5 ++++- runtime/compiler/runtime/JITClientSession.hpp | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/runtime/compiler/control/JITClientCompilationThread.cpp b/runtime/compiler/control/JITClientCompilationThread.cpp index 5f0ae628a19..299d7165d1e 100644 --- a/runtime/compiler/control/JITClientCompilationThread.cpp +++ b/runtime/compiler/control/JITClientCompilationThread.cpp @@ -523,6 +523,7 @@ handleServerMessage(JITServer::ClientStream *client, TR_J9VM *fe, JITServer::Mes vmInfo._osrGlobalBufferSize = javaVM->osrGlobalBufferSize; vmInfo._needsMethodTrampolines = TR::CodeCacheManager::instance()->codeCacheConfig().needsMethodTrampolines(); vmInfo._objectAlignmentInBytes = TR::Compiler->om.objectAlignmentInBytes(); + vmInfo._minimumObjectSizeInBytes = TR::Compiler->om.getMinimumObjectSizeInBytes(); vmInfo._isGetImplAndRefersToInliningSupported = fe->isGetImplAndRefersToInliningSupported(); vmInfo._isAllocateZeroedTLHPagesEnabled = fe->tlhHasBeenCleared(); vmInfo._staticObjectAllocateFlags = fe->getStaticObjectFlags(); diff --git a/runtime/compiler/env/J9ObjectModel.cpp b/runtime/compiler/env/J9ObjectModel.cpp index f8cf8a3cc75..f9b9e921b48 100644 --- a/runtime/compiler/env/J9ObjectModel.cpp +++ b/runtime/compiler/env/J9ObjectModel.cpp @@ -102,6 +102,7 @@ J9::ObjectModel::initialize() } _objectAlignmentInBytes = objectAlignmentInBytes(); + _minimumObjectSizeInBytes = mmf->j9gc_modron_getConfigurationValueForKey(vm, j9gc_modron_configuration_minimumObjectSize, &result) ? result : 0; } @@ -842,3 +843,16 @@ J9::ObjectModel::getObjectAlignmentInBytes() #endif /* defined(J9VM_OPT_JITSERVER) */ return _objectAlignmentInBytes; } + +int32_t +J9::ObjectModel::getMinimumObjectSizeInBytes() +{ +#if defined(J9VM_OPT_JITSERVER) + if (auto stream = TR::CompilationInfo::getStream()) + { + auto *vmInfo = TR::compInfoPT->getClientData()->getOrCacheVMInfo(stream); + return vmInfo->_minimumObjectSizeInBytes; + } +#endif /* defined(J9VM_OPT_JITSERVER) */ + return _minimumObjectSizeInBytes; +} diff --git a/runtime/compiler/env/J9ObjectModel.hpp b/runtime/compiler/env/J9ObjectModel.hpp index e235b04db21..c7607df0280 100644 --- a/runtime/compiler/env/J9ObjectModel.hpp +++ b/runtime/compiler/env/J9ObjectModel.hpp @@ -55,7 +55,8 @@ class ObjectModel : public OMR::ObjectModelConnector _arrayLetLeafLogSize(0), _readBarrierType(gc_modron_readbar_none), _writeBarrierType(gc_modron_wrtbar_none), - _objectAlignmentInBytes(0) + _objectAlignmentInBytes(0), + _minimumObjectSizeInBytes(0) {} void initialize(); @@ -157,6 +158,7 @@ class ObjectModel : public OMR::ObjectModelConnector bool compressObjectReferences(); int32_t getObjectAlignmentInBytes(); + int32_t getMinimumObjectSizeInBytes(); private: @@ -167,6 +169,7 @@ class ObjectModel : public OMR::ObjectModelConnector MM_GCReadBarrierType _readBarrierType; MM_GCWriteBarrierType _writeBarrierType; int32_t _objectAlignmentInBytes; + int32_t _minimumObjectSizeInBytes; }; } diff --git a/runtime/compiler/runtime/JITClientSession.hpp b/runtime/compiler/runtime/JITClientSession.hpp index d3ffca20207..ecd3c29e5e0 100644 --- a/runtime/compiler/runtime/JITClientSession.hpp +++ b/runtime/compiler/runtime/JITClientSession.hpp @@ -312,6 +312,7 @@ class ClientSessionData UDATA _osrGlobalBufferSize; bool _needsMethodTrampolines; int32_t _objectAlignmentInBytes; + int32_t _minimumObjectSizeInBytes; bool _isGetImplAndRefersToInliningSupported; bool _isAllocateZeroedTLHPagesEnabled; uint32_t _staticObjectAllocateFlags;