Skip to content
This repository has been archived by the owner. It is now read-only.

8275830: C2: Receiver downcast is missing when inlining through method handle linkers #77

Closed
wants to merge 2 commits into from

Conversation

iwanowww
Copy link

@iwanowww iwanowww commented Jan 3, 2022

JDK-8268405 introduced receiver downcasts when inlining through virtual calls
when CHA reveals a unique target method under an abstract or default method.
But it handled only cases when invocation is performed using
invokevirtual/invokeinterface bytecodes and completely omitted invokedynamic and
MethodHandles cases.

The fix covers missing cases by checking whether invocation happens through
corresponding method handle linkers (MethodHandle.linkToVirtual/MethodHandle.linkToInterface).

Testing: hs-tier1 - hs-tier4


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8275830: C2: Receiver downcast is missing when inlining through method handle linkers

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk18 pull/77/head:pull/77
$ git checkout pull/77

Update a local copy of the PR:
$ git checkout pull/77
$ git pull https://git.openjdk.java.net/jdk18 pull/77/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 77

View PR using the GUI difftool:
$ git pr show -t 77

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk18/pull/77.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Jan 3, 2022

👋 Welcome back vlivanov! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the hotspot-compiler label Jan 3, 2022
@openjdk
Copy link

@openjdk openjdk bot commented Jan 3, 2022

@iwanowww
The hotspot-compiler label was successfully added.

@iwanowww iwanowww marked this pull request as ready for review Jan 3, 2022
@openjdk openjdk bot added the rfr label Jan 3, 2022
@mlbridge
Copy link

@mlbridge mlbridge bot commented Jan 3, 2022

Webrevs

Copy link

@vnkozlov vnkozlov left a comment

It is time to update Copyright year to 2022 in changed files.

import static compiler.cha.Utils.*;

public class AbstractRootMethod {
public static void main(String[] args) {
run(AbstractClass.class);
run(AbstractInterface.class);

// Implementation limitation: CHA is not performed by C1 during inlining through MH linkers.
if (!sun.hotspot.code.Compiler.isC1Enabled()) {
Copy link

@vnkozlov vnkozlov Jan 3, 2022

Choose a reason for hiding this comment

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

I think you also need to check that C2 is enabled (could be JVMCI).

Copy link
Author

@iwanowww iwanowww Jan 3, 2022

Choose a reason for hiding this comment

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

Until JVMCI/Graal is migrated to vtable-based CHA, the tests are run only with C1/C2:

@requires !vm.graal.enabled & vm.opt.final.UseVtableBasedCHA == true

@iwanowww
Copy link
Author

@iwanowww iwanowww commented Jan 3, 2022

It is time to update Copyright year to 2022 in changed files.

Fixed.

@openjdk
Copy link

@openjdk openjdk bot commented Jan 3, 2022

@iwanowww This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8275830: C2: Receiver downcast is missing when inlining through method handle linkers

Reviewed-by: kvn, dlong

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Jan 3, 2022
Copy link

@vnkozlov vnkozlov left a comment

I missed that tests already have this @require.

Good.

@iwanowww
Copy link
Author

@iwanowww iwanowww commented Jan 4, 2022

Thanks for the reviews, Vladimir and Dean.

/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Jan 4, 2022

Going to push as commit 95a3010.
Since your change was applied there have been 3 commits pushed to the master branch:

  • 58b5fb3: 8265317: [vector] assert(payload->is_object()) failed: expected 'object' value for scalar-replaced boxed vector but got: NULL
  • 06f3713: 8279379: GHA: Print tests that are in error
  • e7244c1: 8278966: two microbenchmarks tests fail "assert(!jvms->method()->has_exception_handlers()) failed: no exception handler expected" after JDK-8275638

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated label Jan 4, 2022
@openjdk openjdk bot closed this Jan 4, 2022
@openjdk openjdk bot removed ready rfr labels Jan 4, 2022
@openjdk
Copy link

@openjdk openjdk bot commented Jan 4, 2022

@iwanowww Pushed as commit 95a3010.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
hotspot-compiler integrated
3 participants