Skip to content

Commit

Permalink
Add object model API to get minimum object size
Browse files Browse the repository at this point in the history
Signed-off-by: Shubham Verma <[email protected]>
  • Loading branch information
VermaSh committed Feb 7, 2025
1 parent 6410fb4 commit e3a0472
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions runtime/compiler/control/JITClientCompilationThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
14 changes: 14 additions & 0 deletions runtime/compiler/env/J9ObjectModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ J9::ObjectModel::initialize()
}

_objectAlignmentInBytes = objectAlignmentInBytes();
_minimumObjectSizeInBytes = mmf->j9gc_modron_getConfigurationValueForKey(vm, j9gc_modron_configuration_minimumObjectSize, &result) ? result : 0;
}


Expand Down Expand Up @@ -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;
}
5 changes: 4 additions & 1 deletion runtime/compiler/env/J9ObjectModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -157,6 +158,7 @@ class ObjectModel : public OMR::ObjectModelConnector
bool compressObjectReferences();

int32_t getObjectAlignmentInBytes();
int32_t getMinimumObjectSizeInBytes();

private:

Expand All @@ -167,6 +169,7 @@ class ObjectModel : public OMR::ObjectModelConnector
MM_GCReadBarrierType _readBarrierType;
MM_GCWriteBarrierType _writeBarrierType;
int32_t _objectAlignmentInBytes;
int32_t _minimumObjectSizeInBytes;
};

}
Expand Down
1 change: 1 addition & 0 deletions runtime/compiler/runtime/JITClientSession.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ class ClientSessionData
UDATA _osrGlobalBufferSize;
bool _needsMethodTrampolines;
int32_t _objectAlignmentInBytes;
int32_t _minimumObjectSizeInBytes;
bool _isGetImplAndRefersToInliningSupported;
bool _isAllocateZeroedTLHPagesEnabled;
uint32_t _staticObjectAllocateFlags;
Expand Down

0 comments on commit e3a0472

Please sign in to comment.