Skip to content

Commit

Permalink
Code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-li-2003 committed Dec 16, 2024
1 parent d369958 commit 176c759
Show file tree
Hide file tree
Showing 3 changed files with 286 additions and 280 deletions.
13 changes: 7 additions & 6 deletions runtime/compiler/control/JITClientCompilationThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2960,9 +2960,10 @@ handleServerMessage(JITServer::ClientStream *client, TR_J9VM *fe, JITServer::Mes
break;
case MessageType::KnownObjectTable_addFieldAddressFromBaseIndex:
{
auto recv = client->getRecvData<TR::KnownObjectTable::Index, intptr_t>();
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;

Expand All @@ -2974,11 +2975,11 @@ handleServerMessage(JITServer::ClientStream *client, TR_J9VM *fe, JITServer::Mes
uintptr_t objectPointer = fe->getReferenceFieldAtAddress(fieldAddress);

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

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

client->write(response, resultIndex, resultPointer);
}
Expand All @@ -2989,15 +2990,15 @@ handleServerMessage(JITServer::ClientStream *client, TR_J9VM *fe, JITServer::Mes
TR::KnownObjectTable::Index baseObjectIndex = std::get<0>(recv);
intptr_t fieldOffset = std::get<1>(recv);

UDATA data = 0;
J9::TransformUtil::value data;

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

uintptr_t fieldAddress = baseObjectAddress + fieldOffset;

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

client->write(response, data);
Expand Down
Loading

0 comments on commit 176c759

Please sign in to comment.