Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.
/ jdk19 Public archive

8290417: CDS cannot archive lamda proxy with useImplMethodHandle #146

Conversation

iklam
Copy link
Member

@iklam iklam commented Jul 18, 2022

Since the impact of this bug can be big, and the fix is simple and low risk (just avoids doing optimizations), I'd like to put this into JDK 19 before RDP2 (Jul 21).

CDS cannot handle Lambda proxy classes that are generated in the useImplMethodHandle mode. This could happen with classfiles generated by JDK 8 or JDK 11 that access protected methods in a base class from a different package. E.g.,

class pkg1.Base {
    protected void doit(String s) {
        System.out.println(s);
    }
}
class pkg2.Child  extends pkg1.Base {
    void test() {
        Optional<String> opt = Optional.of("foo");
        opt.ifPresent(this::doit);
    }
}

More details of useImplMethodHandle can be found here: https://github.com/openjdk/jdk/blob/522b65743ca10fcba0a27d25b8fa11319999e228/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java#L183-L191

More details about the condition that triggers the error can be found in the test file Child.jcod.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8290417: CDS cannot archive lamda proxy with useImplMethodHandle

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk19 pull/146/head:pull/146
$ git checkout pull/146

Update a local copy of the PR:
$ git checkout pull/146
$ git pull https://git.openjdk.org/jdk19 pull/146/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 146

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk19/pull/146.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 18, 2022

👋 Welcome back iklam! 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
Copy link

openjdk bot commented Jul 18, 2022

@iklam The following labels will be automatically applied to this pull request:

  • core-libs
  • hotspot-runtime

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added hotspot-runtime hotspot-runtime-dev@openjdk.org core-libs core-libs-dev@openjdk.org labels Jul 18, 2022
@iklam iklam marked this pull request as ready for review July 18, 2022 03:21
@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 18, 2022
@mlbridge
Copy link

mlbridge bot commented Jul 18, 2022

Webrevs

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

Looks good!

Thanks.

@openjdk
Copy link

openjdk bot commented Jul 18, 2022

@iklam 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:

8290417: CDS cannot archive lamda proxy with useImplMethodHandle

Reviewed-by: dholmes, ccheung, mchung

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 2 new commits pushed to the master branch:

  • 2677dd6: 8289954: C2: Assert failed in PhaseCFG::verify() after JDK-8183390
  • 4f3f74c: 8289127: Apache Lucene triggers: DEBUG MESSAGE: duplicated predicate failed which is impossible

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this 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 Pull request is ready to be integrated label Jul 18, 2022
Copy link
Member

@calvinccheung calvinccheung left a comment

Choose a reason for hiding this comment

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

Looks good. Just couple of nits.

Copy link
Member

@mlchung mlchung left a comment

Choose a reason for hiding this comment

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

Looks fine. I agree that this fix is low risk to disable archiving the lambda proxy in the case when passing a live method handle for invocation.

@iklam
Copy link
Member Author

iklam commented Jul 19, 2022

Thanks @dholmes-ora, @calvinccheung, @mlchung for the review.
Passed tiers 1 - 5.
/integrate

@openjdk
Copy link

openjdk bot commented Jul 19, 2022

Going to push as commit 4dc421c.
Since your change was applied there have been 2 commits pushed to the master branch:

  • 2677dd6: 8289954: C2: Assert failed in PhaseCFG::verify() after JDK-8183390
  • 4f3f74c: 8289127: Apache Lucene triggers: DEBUG MESSAGE: duplicated predicate failed which is impossible

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 19, 2022
@openjdk openjdk bot closed this Jul 19, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 19, 2022
@openjdk
Copy link

openjdk bot commented Jul 19, 2022

@iklam Pushed as commit 4dc421c.

💡 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
core-libs core-libs-dev@openjdk.org hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants