Skip to content

Commit

Permalink
Merge pull request #20845 from cjjdespres/fix-lambdaform-server-treat…
Browse files Browse the repository at this point in the history
…ment

Avoid shared lambda form statics name comparison
  • Loading branch information
mpirvu authored Dec 17, 2024
2 parents 9f1f2aa + 2669f1f commit 658168a
Showing 1 changed file with 12 additions and 2 deletions.
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

0 comments on commit 658168a

Please sign in to comment.