Skip to content

Commit

Permalink
Override SegmentViewVarHandle-related helper for JITServer
Browse files Browse the repository at this point in the history
This commit adds JITServer support for the FE helper
VM_getLayoutVarHandle.

Signed-off-by: Nazim Bhuiyan <[email protected]>
  • Loading branch information
nbhuiyan committed Sep 20, 2024
1 parent 7ad5170 commit 63941ca
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 1 deletion.
10 changes: 10 additions & 0 deletions runtime/compiler/control/JITClientCompilationThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,16 @@ handleServerMessage(JITServer::ClientStream *client, TR_J9VM *fe, JITServer::Mes
client->write(response, mhIndex, mhObj);
}
break;
case MessageType::VM_getLayoutVarHandle:
{
auto recv = client->getRecvData<TR::KnownObjectTable::Index>();
TR::KnownObjectTable::Index vhIndex = fe->getLayoutVarHandle(comp, std::get<0>(recv));
uintptr_t* vhObj = NULL;
if (vhIndex != TR::KnownObjectTable::UNKNOWN)
vhObj = knot->getPointerLocation(vhIndex);
client->write(response, vhIndex, vhObj);
}
break;
#endif // J9VM_OPT_OPENJDK_METHODHANDLE
case MessageType::VM_isStable:
{
Expand Down
16 changes: 16 additions & 0 deletions runtime/compiler/env/VMJ9Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2416,6 +2416,22 @@ TR_J9ServerVM::getMethodHandleTableEntryIndex(TR::Compilation *comp, TR::KnownOb
return mhIndex;
}

TR::KnownObjectTable::Index
TR_J9ServerVM::getLayoutVarHandle(TR::Compilation *comp, TR::KnownObjectTable::Index layoutIndex)
{
TR::KnownObjectTable *knot = comp->getKnownObjectTable();
if (!knot) return TR::KnownObjectTable::UNKNOWN;

JITServer::ServerStream *stream = _compInfoPT->getMethodBeingCompiled()->_stream;
stream->write(JITServer::MessageType::VM_getLayoutVarHandle, layoutIndex);
auto recv = stream->read<TR::KnownObjectTable::Index, uintptr_t *>();

TR::KnownObjectTable::Index vhIndex = std::get<0>(recv);
knot->updateKnownObjectTableAtServer(vhIndex, std::get<1>(recv));
return vhIndex;

}

#endif /* defined(J9VM_OPT_OPENJDK_METHODHANDLE) */

TR::KnownObjectTable::Index
Expand Down
1 change: 1 addition & 0 deletions runtime/compiler/env/VMJ9Server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ class TR_J9ServerVM: public TR_J9VM
virtual UDATA getVMTargetOffset() override;
virtual UDATA getVMIndexOffset() override;
virtual TR::KnownObjectTable::Index getMethodHandleTableEntryIndex(TR::Compilation *comp, TR::KnownObjectTable::Index vhIndex, TR::KnownObjectTable::Index adIndex) override;
virtual TR::KnownObjectTable::Index getLayoutVarHandle(TR::Compilation *comp, TR::KnownObjectTable::Index layoutIndex) override;
#endif
virtual TR::KnownObjectTable::Index getMemberNameFieldKnotIndexFromMethodHandleKnotIndex(TR::Compilation *comp, TR::KnownObjectTable::Index mhIndex, const char *fieldName) override;
virtual bool isMethodHandleExpectedType(TR::Compilation *comp, TR::KnownObjectTable::Index mhIndex, TR::KnownObjectTable::Index expectedTypeIndex) 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 @@ -128,7 +128,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 = 66; // ID: x8xfrdqf9UCc8E2OiuMO
static const uint16_t MINOR_NUMBER = 67; // ID: eJ9ynEzY1XevZygVpTws
static const uint8_t PATCH_NUMBER = 0;
static uint32_t CONFIGURATION_FLAGS;

Expand Down
1 change: 1 addition & 0 deletions runtime/compiler/net/MessageTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ const char *messageNames[] =
"VM_inSnapshotMode",
"VM_isInvokeCacheEntryAnArray",
"VM_getMethodHandleTableEntryIndex",
"VM_getLayoutVarHandle",
"CompInfo_isCompiled",
"CompInfo_getPCIfCompiled",
"CompInfo_getInvocationCount",
Expand Down
1 change: 1 addition & 0 deletions runtime/compiler/net/MessageTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ enum MessageType : uint16_t
VM_inSnapshotMode,
VM_isInvokeCacheEntryAnArray,
VM_getMethodHandleTableEntryIndex,
VM_getLayoutVarHandle,

// For static TR::CompilationInfo methods
CompInfo_isCompiled,
Expand Down

0 comments on commit 63941ca

Please sign in to comment.