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

Avoid shared lambda form statics name comparison #20845

Merged
Merged
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
14 changes: 12 additions & 2 deletions runtime/compiler/env/j9methodServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,8 @@ TR_ResolvedJ9JITServerMethod::fieldsAreSame(int32_t cpIndex1, TR_ResolvedMethod
bool
TR_ResolvedJ9JITServerMethod::staticsAreSame(int32_t cpIndex1, TR_ResolvedMethod *m2, int32_t cpIndex2, bool &sigSame)
{
if (TR::comp()->compileRelocatableCode())
auto comp = TR::comp();
if (comp->compileRelocatableCode())
// in AOT, this should always return false, because mainline compares class loaders
// with fe->sameClassLoaders, which always returns false for AOT compiles
return false;
Expand Down Expand Up @@ -509,7 +510,16 @@ TR_ResolvedJ9JITServerMethod::staticsAreSame(int32_t cpIndex1, TR_ResolvedMethod
char *declaringClassName2 = serverMethod2->classNameOfFieldOrStatic(cpIndex2, class2Len);

if (class1Len == class2Len && !memcmp(declaringClassName1, declaringClassName2, class1Len))
return true;
{
#if defined(J9VM_OPT_OPENJDK_METHODHANDLE)
// Lambda form name comparison is unreliable when they are shared, so
// pretend that the name and signature comparison was inconclusive and
// rely on the fallback in TR_J9VM::jitStaticsAreSame().
if (isLambdaFormClassName(declaringClassName1, class1Len, NULL))
return false;
#endif /* defined(J9VM_OPT_OPENJDK_METHODHANDLE) */
return true;
}
}
else
{
Expand Down