Skip to content

Conversation

@archiecobbs
Copy link
Contributor

@archiecobbs archiecobbs commented Apr 5, 2023

The fix for JDK-8043179 is to clear the DU flags for all variables when entering a lamba. This reflects the fact that the lamba's actual execution could be arbitrarily far in the future, so we can't assume anything that is DU when the lambda is created is still DU when the lambda actually executes.

However, this fix created a new bug. The problem is that visitLambda() does not save & restore the uninitsTry bits, which are used by visitTry() to track DU variables within try { } blocks. So if there is a try { } block outside the lambda and a try { } block inside the lambda, the latter can "leak" DU state up to the former via this field. As a result, a final variable that should still be DU at the completion of the outer try { } block can be incorrectly recorded as not DU, leading to the bogus "might already have been assigned" error.

This patch fixes that by adding the necessary save & restore logic.


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-8305672: Surprising definite assignment error after JDK-8043179

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 13366

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/13366.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 5, 2023

👋 Welcome back archiecobbs! 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 rfr Pull request is ready for review label Apr 5, 2023
@openjdk
Copy link

openjdk bot commented Apr 5, 2023

@archiecobbs The following label will be automatically applied to this pull request:

  • compiler

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

@openjdk openjdk bot added the compiler compiler-dev@openjdk.org label Apr 5, 2023
@mlbridge
Copy link

mlbridge bot commented Apr 5, 2023

Webrevs

@cushon
Copy link
Contributor

cushon commented Apr 13, 2023

I'm not a Reviewer, but this looks good to me. I confirmed this fixes the original issue that I minimized for JDK-8305672.

@caoman
Copy link
Contributor

caoman commented Apr 17, 2023

Could any Reviewer from compiler-dev@ review this change?

We run large-scale tests against recent OpenJDK commits with our internal workload. This bug has caused several failures and blocked us from updating to the latest OpenJDK tip.

@archiecobbs
Copy link
Contributor Author

Could any Reviewer from compiler-dev@ review this change?

I'd like to second this request. This bug was exposed very recently (by another bug fix), so it's never been part of any JDK release. It would be nice to keep it that way.

Thanks.

@kevinrushforth
Copy link
Member

We just ran into this bug trying to compile JavaFX 21 with JDK 21. I raised the priority of the bug to P2, since this is a serious regression with no obvious workaround.

@vicente-romero-oracle since you reviewed and sponsored the fix for JDK-8043179 in PR #10381 would you be able to review this?

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

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

I don't know this code area at all (and am not a jdk Reviewer), but I can confirm that this PR fixes the bug for me. After applying this patch and building a local JDK, I am able to compile JavaFX again.

@vicente-romero-oracle
Copy link
Contributor

the fix looks good to me, running regression tests now to make sure nothing breaks, will approve if all green

Copy link

@gafter gafter 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 to me.

Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle 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

@openjdk
Copy link

openjdk bot commented Apr 29, 2023

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

8305672: Surprising definite assignment error after JDK-8043179

Reviewed-by: kcr, vromero

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

  • bb7608b: 8307088: Allow the jdbc.drivers system property to be searchable
  • a2d3fc8: 8304837: Classfile API throws IOOBE for MethodParameters attribute without parameter names
  • d43a5a2: 8307135: java/awt/dnd/NotReallySerializableTest/NotReallySerializableTest.java failed
  • 1f68924: 8306955: Open source several JComboBox jtreg tests
  • b8de394: 8307080: Open source some more JComboBox jtreg tests
  • 4818c79: 8307110: zero build broken after JDK-8304265
  • da9efee: 8296935: Arrays.asList() can return a List that throws undocumented ArrayStoreException
  • 05af487: 8306681: Open source more AWT DnD related tests
  • ec5c792: 8306133: Open source few AWT Drag & Drop related tests
  • 6d6f726: 8307078: Opensource and clean up five more AWT Focus related tests
  • ... and 79 more: https://git.openjdk.org/jdk/compare/bad6aa68e4d491e819ab22e91dd5d65bb094120e...master

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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@vicente-romero-oracle) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 29, 2023
@archiecobbs
Copy link
Contributor Author

Thanks for the review @vicente-romero-oracle !

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Apr 29, 2023
@openjdk
Copy link

openjdk bot commented Apr 29, 2023

@archiecobbs
Your change (at version 3fce25b) is now ready to be sponsored by a Committer.

@vicente-romero-oracle
Copy link
Contributor

/sponsor

@openjdk
Copy link

openjdk bot commented May 1, 2023

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

  • b39a9bf: 8301703: java.base jdk.internal.foreign.abi.BindingSpecializer uses ASM to generate classes
  • 1de1a38: 8303002: Reject packed structs from linker
  • 316d303: 8306851: Move Method access flags
  • a6b4f25: 8306825: Monitor deflation might be accidentally disabled by zero intervals
  • 2d7c507: 8305778: javax/swing/JTableHeader/6884066/bug6884066.java: Unexpected header's value; index = 4 value = E
  • e1b06ea: 8305780: javax/swing/JTable/7068740/bug7068740.java fails on Ubunutu 20.04
  • b54c4a3: 8299713: Test javax/swing/JTableHeader/6889007/bug6889007.java failed: Wrong type of cursor
  • b3dbf28: 8292275: javac does not emit SYNTHETIC and MANDATED flags for parameters by default
  • 6d6d00b: 8306954: Open source five Focus related tests
  • bb7608b: 8307088: Allow the jdbc.drivers system property to be searchable
  • ... and 88 more: https://git.openjdk.org/jdk/compare/bad6aa68e4d491e819ab22e91dd5d65bb094120e...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 1, 2023
@openjdk openjdk bot closed this May 1, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels May 1, 2023
@openjdk
Copy link

openjdk bot commented May 1, 2023

@vicente-romero-oracle @archiecobbs Pushed as commit d437c61.

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

@vicente-romero-oracle
Copy link
Contributor

Thanks for the review @vicente-romero-oracle !

/integrate

sure thanks @kevinrushforth and @neil too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler compiler-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

6 participants