Skip to content

Revert "Reduce unnecessary TLS usage in JITServer code" #19823

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

Merged
merged 1 commit into from
Jul 8, 2024
Merged
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
2 changes: 1 addition & 1 deletion runtime/compiler/codegen/J9CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ J9::CodeGenerator::lowerTreeIfNeeded(
#if defined(J9VM_OPT_JITSERVER)
// This is currently the only place where this flag gets cleared. For JITServer, we should propagate it to the client,
// to avoid having to call scanForNativeMethodsUntilMonitorNode again.
if (auto stream = self()->comp()->getStream())
if (auto stream = TR::CompilationInfo::getStream())
{
stream->write(JITServer::MessageType::CHTable_clearReservable, classPointer);
stream->read<JITServer::Void>();
Expand Down
6 changes: 3 additions & 3 deletions runtime/compiler/compile/J9Compilation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,14 @@ J9::Compilation::Compilation(int32_t id,
_osrProhibitedOverRangeOfTrees(false),
_wasFearPointAnalysisDone(false)
{
_symbolValidationManager = new (self()->region()) TR::SymbolValidationManager(self()->region(), compilee, self());
_symbolValidationManager = new (self()->region()) TR::SymbolValidationManager(self()->region(), compilee);

_aotClassClassPointer = NULL;
_aotClassClassPointerInitialized = false;

_aotGuardPatchSites = new (m->trHeapMemory()) TR::list<TR_AOTGuardSite *>(getTypedAllocator<TR_AOTGuardSite *>(self()->allocator()));
_aotGuardPatchSites = new (m->trHeapMemory()) TR::list<TR_AOTGuardSite*>(getTypedAllocator<TR_AOTGuardSite*>(self()->allocator()));

_aotClassInfo = new (m->trHeapMemory()) TR::list<TR::AOTClassInfo *>(getTypedAllocator<TR::AOTClassInfo *>(self()->allocator()));
_aotClassInfo = new (m->trHeapMemory()) TR::list<TR::AOTClassInfo*>(getTypedAllocator<TR::AOTClassInfo*>(self()->allocator()));

if (_updateCompYieldStats)
_hiresTimeForPreviousCallingContext = TR::Compiler->vm.getHighResClock(self());
Expand Down
7 changes: 3 additions & 4 deletions runtime/compiler/control/JITClientCompilationThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3714,14 +3714,13 @@ remoteCompile(J9VMThread *vmThread, TR::Compilation *compiler, TR_ResolvedMethod
// Intersect classesThatShouldNotBeNewlyExtended with newlyExtendedClasses
// and abort on overlap
auto newlyExtendedClasses = compInfo->getNewlyExtendedClasses();
for (TR_OpaqueClassBlock *clazz : classesThatShouldNotBeNewlyExtended)
for (TR_OpaqueClassBlock* clazz : classesThatShouldNotBeNewlyExtended)
{
auto it = newlyExtendedClasses->find(clazz);
if (it != newlyExtendedClasses->end() && (it->second & (1 << compInfoPT->getCompThreadId())))
if (it != newlyExtendedClasses->end() && (it->second & (1 << TR::compInfoPT->getCompThreadId())))
{
if (TR::Options::isAnyVerboseOptionSet(TR_VerboseJITServer, TR_VerboseCompileEnd, TR_VerbosePerformance, TR_VerboseCompFailure))
TR_VerboseLog::writeLineLocked(TR_Vlog_FAILURE, "Class that should not be newly extended was extended when compiling %s",
compiler->signature());
TR_VerboseLog::writeLineLocked(TR_Vlog_FAILURE, "Class that should not be newly extended was extended when compiling %s", compiler->signature());
compiler->failCompilation<J9::CHTableCommitFailure>("Class that should not be newly extended was extended");
}
}
Expand Down
9 changes: 4 additions & 5 deletions runtime/compiler/env/J9ClassEnv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ J9::ClassEnv::isZeroInitializable(TR_OpaqueClassBlock *clazz)
}

bool
J9::ClassEnv::containsZeroOrOneConcreteClass(TR::Compilation *comp, List<TR_PersistentClassInfo> *subClasses)
J9::ClassEnv::containsZeroOrOneConcreteClass(TR::Compilation *comp, List<TR_PersistentClassInfo>* subClasses)
{
int count = 0;
#if defined(J9VM_OPT_JITSERVER)
Expand All @@ -990,7 +990,7 @@ J9::ClassEnv::containsZeroOrOneConcreteClass(TR::Compilation *comp, List<TR_Pers
TR_ScratchList<TR_PersistentClassInfo> subClassesNotCached(comp->trMemory());

// Process classes cached at the server first
ClientSessionData *clientData = comp->getClientData();
ClientSessionData * clientData = TR::compInfoPT->getClientData();
for (TR_PersistentClassInfo *ptClassInfo = j.getFirst(); ptClassInfo; ptClassInfo = j.getNext())
{
TR_OpaqueClassBlock *clazz = ptClassInfo->getClassId();
Expand Down Expand Up @@ -1068,15 +1068,14 @@ J9::ClassEnv::flattenedArrayElementSize(TR::Compilation *comp, TR_OpaqueClassBlo
if (auto stream = comp->getStream())
{
int32_t arrayElementSize = 0;
JITServerHelpers::getAndCacheRAMClassInfo((J9Class *)arrayClass, comp->getClientData(), stream,
JITServerHelpers::CLASSINFO_ARRAY_ELEMENT_SIZE, &arrayElementSize);
JITServerHelpers::getAndCacheRAMClassInfo((J9Class *)arrayClass, TR::compInfoPT->getClientData(), stream, JITServerHelpers::CLASSINFO_ARRAY_ELEMENT_SIZE, (void *)&arrayElementSize);
return arrayElementSize;
}
else
#endif /* defined(J9VM_OPT_JITSERVER) */
{
J9JavaVM *vm = comp->fej9()->getJ9JITConfig()->javaVM;
return vm->internalVMFunctions->arrayElementSize((J9ArrayClass *)self()->convertClassOffsetToClassPtr(arrayClass));
return vm->internalVMFunctions->arrayElementSize((J9ArrayClass*)self()->convertClassOffsetToClassPtr(arrayClass));
}
}

Expand Down
10 changes: 5 additions & 5 deletions runtime/compiler/env/J9KnownObjectTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ J9::KnownObjectTable::getOrCreateIndex(uintptr_t objectPointer)
if (self()->comp()->isOutOfProcessCompilation())
{
TR_ASSERT_FATAL(false, "It is not safe to call getOrCreateIndex() at the server. The object pointer could have become stale at the client.");
auto stream = self()->comp()->getStream();
auto stream = TR::CompilationInfo::getStream();
stream->write(JITServer::MessageType::KnownObjectTable_getOrCreateIndex, objectPointer);
auto recv = stream->read<TR::KnownObjectTable::Index, uintptr_t *>();

Expand Down Expand Up @@ -133,7 +133,7 @@ J9::KnownObjectTable::getOrCreateIndexAt(uintptr_t *objectReferenceLocation)
#if defined(J9VM_OPT_JITSERVER)
if (self()->comp()->isOutOfProcessCompilation())
{
auto stream = self()->comp()->getStream() ? self()->comp()->getStream() : TR::CompilationInfo::getStream();
auto stream = TR::CompilationInfo::getStream();
stream->write(JITServer::MessageType::KnownObjectTable_getOrCreateIndexAt, objectReferenceLocation);
auto recv = stream->read<TR::KnownObjectTable::Index, uintptr_t *>();

Expand Down Expand Up @@ -169,7 +169,7 @@ J9::KnownObjectTable::getExistingIndexAt(uintptr_t *objectReferenceLocation)
#if defined(J9VM_OPT_JITSERVER)
if (self()->comp()->isOutOfProcessCompilation())
{
auto stream = self()->comp()->getStream() ? self()->comp()->getStream() : TR::CompilationInfo::getStream();
auto stream = TR::CompilationInfo::getStream();
stream->write(JITServer::MessageType::KnownObjectTable_getExistingIndexAt, objectReferenceLocation);
result = std::get<0>(stream->read<TR::KnownObjectTable::Index>());
}
Expand Down Expand Up @@ -205,7 +205,7 @@ J9::KnownObjectTable::getPointer(Index index)
if (self()->comp()->isOutOfProcessCompilation())
{
TR_ASSERT_FATAL(false, "It is not safe to call getPointer() at the server. The object pointer could have become stale at the client.");
auto stream = self()->comp()->getStream();
auto stream = TR::CompilationInfo::getStream();
stream->write(JITServer::MessageType::KnownObjectTable_getPointer, index);
return std::get<0>(stream->read<uintptr_t>());
}
Expand Down Expand Up @@ -391,7 +391,7 @@ J9::KnownObjectTable::dumpTo(TR::FILE *file, TR::Compilation *comp)
#if defined(J9VM_OPT_JITSERVER)
if (comp->isOutOfProcessCompilation())
{
auto stream = comp->getStream();
auto stream = TR::CompilationInfo::getStream();
stream->write(JITServer::MessageType::KnownObjectTable_getKnownObjectTableDumpInfo, JITServer::Void());

auto recv = stream->read<std::vector<TR_KnownObjectTableDumpInfo>>();
Expand Down
Loading