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

(0.31.0) Replace forceUnresolvedDispatch() with isResolved*DispatchGuaranteed() #14463

Merged

Conversation

jdmpapin
Copy link
Contributor

@jdmpapin jdmpapin commented Feb 8, 2022

This is the v0.31.0-release PR corresponding to #14430. The commit to be merged here is the identical commit that was already merged into master as part of the original PR

This logic is identical between TR_ResolvedRelocatableJ9Method and
TR_ResolvedRelocatableJ9JITServerMethod. It is about to be updated in a
later commit, so this refactoring will ensure that the two remain
consistent.
Certain transformations in the compiler rely on a guarantee that a given
resolved call node will simply call the target method without attempting
to resolve a constant pool entry, since the constant pool entry may not
correspond to the call in the usually expected way.

We always have this guarantee in non-AOT compilations.

In AOT compilations, we currently have this guarantee for direct calls
when using the symbol validation manager (SVM) on x86, Power, and z.

In the SVM case, each code generator must now opt in to this class of
transformations by explicitly declaring that it provides the needed
guarantee for direct calls, virtual calls, or both.

Special-case virtual and interface resolution in AOT now respects
isResolved*DispatchGuaranteed(). In particular, private invokevirtual,
private invokeinterface, and final Object invokeinterface will all
become direct, so heed isResolvedDirectDispatchGuaranteed(), and
non-final Object invokeinterface will become virtual, so now heeds
isResolvedVirtualDispatchGuaranteed().

Additionally, refinement of invokeBasic() and linkTo*() now also
respects these queries, though it shouldn't (currently) be attempted in
AOT regardless. Refinement requires a known object index for either the
MethodHandle or the MemberName, and AOT does not support the known
object table.

It probably also makes sense to gate value propagation's type refinement
of indirect calls on isResolvedDirectDispatchGuaranteed() for fixed type
and isResolvedVirtualDispatchGuaranteed() for type bounds, but this is
not done in this commit. That change would require modifications to OMR,
and there is currently no problem with call refinement in VP because it
respects canDevirtualizeDispatch(), which is false in AOT compilations.

As a result of the above, this commit effectively stops AOT compilations
using the SVM from generating resolved virtual calls for invokeinterface
calling non-final methods of Object. Instead, such calls are left to be
treated as (unresolved) interface calls as in non-SVM AOT. This ilgen
transformation can be re-enabled for a particular code generator by
overriding guaranteesResolvedVirtualDispatchForSVM() to return true, but
first it will be necessary to ensure that the code generator really
provides that guarantee. If the sequence generated for a resolved
virtual call is simply a call through the vtable, then providing the
guarantee should only involve:
- sending execution to the resolved path when the SVM is enabled, and
- generating an appropriate J2I thunk validation.

However, the required J2I thunk validation does not yet exist. It will
be implemented separately.
Copy link
Contributor

@dsouzai dsouzai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SHAs of the commits are identical to the commits in #14430

@dsouzai dsouzai added this to the Release 0.31 (Java 18) milestone Feb 8, 2022
@dsouzai dsouzai self-assigned this Feb 8, 2022
@dsouzai
Copy link
Contributor

dsouzai commented Feb 9, 2022

@0xdaryl @pshipton can this now be merged?

@0xdaryl
Copy link
Contributor

0xdaryl commented Feb 9, 2022

Let's wait one more day for things to settle.

@pshipton
Copy link
Member

pshipton commented Feb 9, 2022

For jdk18 #14465 was opened. Not sure if it's related, probably not. The failures aren't new, they've occurred for some time as seen in #13946. We just didn't know if they would be fixed by this change or not.

In the head stream builds for jdk8, 11, 17, the following new issues were opened on the builds last night, both on AIX.
#14469 jit_tr_0 testNOPing expected:<?> but was:<B>
#14470 threadMXBeanTimedParkTest Blocked time is lower than expected

@pshipton
Copy link
Member

pshipton commented Feb 10, 2022

Nothing else in the 8, 11, 17 builds last night, just unrelated intermittent problems we've seen before.

@0xdaryl
Copy link
Contributor

0xdaryl commented Feb 10, 2022

Is the concern with merging this that #14469 and #14470 might be regressions caused by it? If so, @IBMJimmyk do you have any insight into those failures yet? Could we revert this PR in a private build and grind these failing tests to confirm?

Given the number of failures this PR fixes then I don't want to keep it out of the builds for too much longer.

@IBMJimmyk
Copy link
Contributor

I haven't really gotten started in the investigation into #14469 yet so I don't have anything to add at this time.

@pshipton
Copy link
Member

I don't have any concern with merging this, I think we should go ahead with the merge, and then do a Milestone 1 for 0.31 while further investigation continues.

@0xdaryl
Copy link
Contributor

0xdaryl commented Feb 10, 2022

Agreed. @dsouzai, please merge if you have no objections since this is assigned to you.

@dsouzai dsouzai merged commit 700cde7 into eclipse-openj9:v0.31.0-release Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants