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

TransformIndirectLoadChain at JITServer #20767

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
46 changes: 46 additions & 0 deletions runtime/compiler/control/JITClientCompilationThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2958,6 +2958,52 @@ handleServerMessage(JITServer::ClientStream *client, TR_J9VM *fe, JITServer::Mes
client->write(response, vectorBitSize);
}
break;
case MessageType::KnownObjectTable_addFieldAddressFromBaseIndex:
{
auto recv = client->getRecvData<TR::KnownObjectTable::Index, intptr_t, bool>();
TR::KnownObjectTable::Index baseObjectIndex = std::get<0>(recv);
intptr_t fieldOffset = std::get<1>(recv);
bool isArrayWithConstantElements = std::get<2>(recv);

TR::KnownObjectTable::Index resultIndex = TR::KnownObjectTable::UNKNOWN;

{
TR::VMAccessCriticalSection addFieldAddressFromBaseIndex(fe);
uintptr_t baseObjectAddress = knot->getPointer(baseObjectIndex);
uintptr_t fieldAddress = baseObjectAddress + fieldOffset;

uintptr_t objectPointer = fe->getReferenceFieldAtAddress(fieldAddress);

if (objectPointer)
resultIndex = knot->getOrCreateIndexAt(&objectPointer, isArrayWithConstantElements);
}

uintptr_t *resultPointer = (resultIndex == TR::KnownObjectTable::UNKNOWN) ?
NULL : knot->getPointerLocation(resultIndex);

client->write(response, resultIndex, resultPointer);
}
break;
case MessageType::KnownObjectTable_getFieldAddressData:
{
auto recv = client->getRecvData<TR::KnownObjectTable::Index, intptr_t>();
TR::KnownObjectTable::Index baseObjectIndex = std::get<0>(recv);
intptr_t fieldOffset = std::get<1>(recv);

J9::TransformUtil::value data;

{
TR::VMAccessCriticalSection addFieldAddressFromBaseIndex(fe);
uintptr_t baseObjectAddress = knot->getPointer(baseObjectIndex);

uintptr_t fieldAddress = baseObjectAddress + fieldOffset;

data = *(J9::TransformUtil::value *) fieldAddress;
}

client->write(response, data);
}
break;
case MessageType::AOTCache_getROMClassBatch:
{
auto recv = client->getRecvData<std::vector<J9Class *>>();
Expand Down
5 changes: 4 additions & 1 deletion runtime/compiler/env/J9KnownObjectTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ J9::KnownObjectTable::getPointerLocation(Index index)

#if defined(J9VM_OPT_JITSERVER)
void
J9::KnownObjectTable::updateKnownObjectTableAtServer(Index index, uintptr_t *objectReferenceLocationClient)
J9::KnownObjectTable::updateKnownObjectTableAtServer(Index index, uintptr_t *objectReferenceLocationClient, bool isArrayWithConstantElements)
{
TR_ASSERT_FATAL(self()->comp()->isOutOfProcessCompilation(), "updateKnownObjectTableAtServer should only be called at the server");
if (index == TR::KnownObjectTable::UNKNOWN)
Expand All @@ -256,6 +256,9 @@ J9::KnownObjectTable::updateKnownObjectTableAtServer(Index index, uintptr_t *obj
{
TR_ASSERT_FATAL(false, "index %d from the client is greater than the KOT nextIndex %d at the server", index, nextIndex);
}

if (isArrayWithConstantElements)
addArrayWithConstantElements(index);
}
#endif /* defined(J9VM_OPT_JITSERVER) */

Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/env/J9KnownObjectTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class OMR_EXTENSIBLE KnownObjectTable : public OMR::KnownObjectTableConnector
uintptr_t getPointer(Index index);

#if defined(J9VM_OPT_JITSERVER)
void updateKnownObjectTableAtServer(Index index, uintptr_t *objectReferenceLocationClient);
void updateKnownObjectTableAtServer(Index index, uintptr_t *objectReferenceLocationClient, bool isArrayWithConstantElements = false);
void getKnownObjectTableDumpInfo(std::vector<TR_KnownObjectTableDumpInfo> &knotDumpInfoList);
#endif /* defined(J9VM_OPT_JITSERVER) */

Expand Down
3 changes: 2 additions & 1 deletion runtime/compiler/env/VMJ9Server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ class TR_J9ServerVM: public TR_J9VM
virtual intptr_t getVFTEntry(TR_OpaqueClassBlock *clazz, int32_t offset) override;
virtual bool isClassArray(TR_OpaqueClassBlock *klass) override;
virtual uintptr_t getFieldOffset(TR::Compilation * comp, TR::SymbolReference* classRef, TR::SymbolReference* fieldRef) override { return 0; } // safe answer
virtual bool canDereferenceAtCompileTime(TR::SymbolReference *fieldRef, TR::Compilation *comp) override { return false; } // safe answer, might change in the future
// The base version should be safe, no need to override.
// virtual bool canDereferenceAtCompileTime(TR::SymbolReference *fieldRef, TR::Compilation *comp) override; // safe answer, might change in the future
virtual bool instanceOfOrCheckCast(J9Class *instanceClass, J9Class* castClass) override;
virtual bool instanceOfOrCheckCastNoCacheUpdate(J9Class *instanceClass, J9Class* castClass) override;
virtual bool transformJlrMethodInvoke(J9Method *callerMethod, J9Class *callerClass) override;
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/net/CommunicationStream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class CommunicationStream
// likely to lose an increment when merging/rebasing/etc.
//
static const uint8_t MAJOR_NUMBER = 1;
static const uint16_t MINOR_NUMBER = 75; // ID: kzkyjklaOnYjEzzJyIl7
static const uint16_t MINOR_NUMBER = 76; // ID: BpR0Syhau116Bh0vAoVr
static const uint8_t PATCH_NUMBER = 0;
static uint32_t CONFIGURATION_FLAGS;

Expand Down
2 changes: 2 additions & 0 deletions runtime/compiler/net/MessageTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ const char *messageNames[] =
"KnownObjectTable_getKnownObjectTableDumpInfo",
"KnownObjectTable_getOpaqueClass",
"KnownObjectTable_getVectorBitSize",
"KnownObjectTable_addFieldAddressFromBaseIndex",
"KnownObjectTable_getFieldAddressData",
"AOTCache_getROMClassBatch",
"AOTCacheMap_request",
"AOTCacheMap_reply"
Expand Down
3 changes: 3 additions & 0 deletions runtime/compiler/net/MessageTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ enum MessageType : uint16_t
KnownObjectTable_getOpaqueClass,
// for getting a vectorBitSize from KnownObjectTable
KnownObjectTable_getVectorBitSize,
// used with J9TransformUtil
KnownObjectTable_addFieldAddressFromBaseIndex,
KnownObjectTable_getFieldAddressData,

AOTCache_getROMClassBatch,

Expand Down
Loading