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

(v0.37.0-release) Remove setImmutableField on currentThread for JDK19 and up #17021

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
9 changes: 8 additions & 1 deletion runtime/compiler/compile/J9SymbolReferenceTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,14 @@ J9::SymbolReferenceTable::findOrCreateCurrentThreadSymbolRef()
TR_J9VMBase *fej9 = (TR_J9VMBase *)(fe());
TR::Symbol * sym = TR::RegisterMappedSymbol::createMethodMetaDataSymbol(trHeapMemory(), "CurrentThread");
sym->setDataType(TR::Address);
sym->setImmutableField();
if (fej9->isJ9VMThreadCurrentThreadImmutable())
{
sym->setImmutableField();
}
else
{
sym->setVolatile();
}
element(currentThreadSymbol) = new (trHeapMemory()) TR::SymbolReference(self(), currentThreadSymbol, sym);
element(currentThreadSymbol)->setOffset(fej9->thisThreadGetCurrentThreadOffset());
}
Expand Down
10 changes: 10 additions & 0 deletions runtime/compiler/env/VMJ9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9376,6 +9376,16 @@ TR_J9VMBase::isSnapshotModeEnabled()
#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */
}

bool
TR_J9VMBase::isJ9VMThreadCurrentThreadImmutable()
{
#if JAVA_SPEC_VERSION >= 19
return false;
#else
return true;
#endif /* JAVA_SPEC_VERSION >= 19 */
}

// Native method bodies
//
#if defined(TR_HOST_X86)
Expand Down
7 changes: 7 additions & 0 deletions runtime/compiler/env/VMJ9.h
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,13 @@ class TR_J9VMBase : public TR_FrontEnd
*/
bool isSnapshotModeEnabled();

/**
* \brief Answers whether or not Thread.currentThread() is immutable.
*
* \return True if Thread.currentThread() is immutable.
*/
virtual bool isJ9VMThreadCurrentThreadImmutable();

protected:

enum // _flags
Expand Down