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

8316421: libjava should load shell32.dll eagerly #15789

Closed
wants to merge 4 commits into from

Conversation

djelinski
Copy link
Member

@djelinski djelinski commented Sep 18, 2023

Please review this patch that makes java.dll load shell32.dll earlier. Delay-loading requires some additional code (delayimp.lib), and offers no benefits since we always load shell32 during JVM startup.

Other than removing the delayload clause, the patch also cleans up the getHomeFromShell32 method:

This change shouldn't have any observable effect on behavior on any of the supported operating systems. It reduced the size of java.dll by 2KB on my machine.
No new tests. Existing tier1-2 tests continue to pass.


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-8316421: libjava should load shell32.dll eagerly (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15789

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 18, 2023

👋 Welcome back djelinski! 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 changed the title 8316421 8316421: libjava should load shell32.dll eagerly Sep 18, 2023
@openjdk
Copy link

openjdk bot commented Sep 18, 2023

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

  • build
  • core-libs

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 build build-dev@openjdk.org core-libs core-libs-dev@openjdk.org labels Sep 18, 2023
@djelinski djelinski marked this pull request as ready for review September 18, 2023 15:01
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 18, 2023
@mlbridge
Copy link

mlbridge bot commented Sep 18, 2023

Webrevs

@JornVernee
Copy link
Member

JornVernee commented Sep 18, 2023

Okay, if my reading of this is correct: the delay loading was done because SHGetKnownFolderPath is not available before Vista, so when accessing the function we can catch the exception and try SHGetFolderPath instead. So, this mechanism is safe to remove if we no longer support Windows XP/2000. I'm not sure what the policy on that is though.

@djelinski
Copy link
Member Author

Well yes, if SHGetKnownFolderPath were available in Win2k, delayload would probably have been removed in 3b0f760.

Oracle docs state that JDK17 only supports Win8 and newer:
https://www.oracle.com/java/technologies/javase/products-doc-jdk17certconfig.html

We recently integrated a change that requires Vista or newer:
JDK-8302659

During compilation we enable APIs from Win8:

# Access APIs for Windows 8 and above

based on the above, I believe we can ignore WinXP compatibility here.

@JornVernee
Copy link
Member

based on the above, I believe we can ignore WinXP compatibility here.

I tend to agree.

During compilation we enable APIs from Win8:

This is interesting. I think that means the define at the start of src/java.base/windows/native/libjava/java_props_md.c can also be removed

@djelinski
Copy link
Member Author

Hmm, indeed VER_PLATFORM_WIN32_WINDOWS was not used... Removed now. Was that the define you were referring to?

@JornVernee
Copy link
Member

Hmm, indeed VER_PLATFORM_WIN32_WINDOWS was not used... Removed now. Was that the define you were referring to?

Err, sorry, I was talking about the _WIN32_NT define, but that was actually already removed in 4fd79a6#diff-e17e04444071ba72ceac86556f300573321b4317b88bbd694e55f51031b7e3db

Copy link
Member

@erikj79 erikj79 left a comment

Choose a reason for hiding this comment

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

Build change looks good.

@openjdk
Copy link

openjdk bot commented Sep 18, 2023

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

8316421: libjava should load shell32.dll eagerly

Reviewed-by: erikj, jwaters, jvernee

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

  • b3d75fe: 8310874: Runthese30m crashes with klass should be in the placeholders during verification
  • 6a4b665: 8316659: assert(LockingMode != LM_LIGHTWEIGHT || flag == CCR0) failed: bad condition register
  • 913e43f: 8316582: Minor startup regression in 22-b15 due JDK-8310929
  • 23ed890: 6415065: Submenu is shown on wrong screen in multiple monitor environment
  • ca47f5f: 8316105: C2: Back to back Parse Predicates from different loops but with same deopt reason are wrongly grouped together
  • 1749ba2: 8311084: Add typeSymbol() API for applicable constant pool entries
  • 9f5d2b9: 8316285: Opensource JButton manual tests
  • a35e96a: 8313612: Use JUnit in lib-test/jdk tests
  • bee7524: 8315786: [AIX] Build Disk Local Detection Issue with GNU-utils df on AIX
  • ceff47b: 8315082: [REDO] Generational ZGC: Tests crash with assert(index == 0 || is_power_of_2(index))
  • ... and 53 more: https://git.openjdk.org/jdk/compare/21c2dac15957e6d71e8f32a55f3825671da097a9...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.

➡️ 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 Sep 18, 2023
@TheShermanTanker
Copy link
Contributor

Seems like JDK-8288293 no longer has to rely on delay load failure hooks to bypass gcc's lack of Structured Exception Handling :)

Is the ole32.lib dependency related to CoTaskMemFree?

@djelinski
Copy link
Member Author

Yes, ole32.lib was needed for CoTaskMemFree. Without it the library wouldn't link.

Copy link
Contributor

@TheShermanTanker TheShermanTanker left a comment

Choose a reason for hiding this comment

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

Looks Great!

Copy link
Member

@JornVernee JornVernee left a comment

Choose a reason for hiding this comment

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

LGTM

src/java.base/windows/native/libjava/java_props_md.c Outdated Show resolved Hide resolved
@djelinski
Copy link
Member Author

Thanks for the reviews!

/integrate

@openjdk
Copy link

openjdk bot commented Sep 21, 2023

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

  • 378bcd5: 8316595: Alpine build fails after JDK-8314021
  • b3d75fe: 8310874: Runthese30m crashes with klass should be in the placeholders during verification
  • 6a4b665: 8316659: assert(LockingMode != LM_LIGHTWEIGHT || flag == CCR0) failed: bad condition register
  • 913e43f: 8316582: Minor startup regression in 22-b15 due JDK-8310929
  • 23ed890: 6415065: Submenu is shown on wrong screen in multiple monitor environment
  • ca47f5f: 8316105: C2: Back to back Parse Predicates from different loops but with same deopt reason are wrongly grouped together
  • 1749ba2: 8311084: Add typeSymbol() API for applicable constant pool entries
  • 9f5d2b9: 8316285: Opensource JButton manual tests
  • a35e96a: 8313612: Use JUnit in lib-test/jdk tests
  • bee7524: 8315786: [AIX] Build Disk Local Detection Issue with GNU-utils df on AIX
  • ... and 54 more: https://git.openjdk.org/jdk/compare/21c2dac15957e6d71e8f32a55f3825671da097a9...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Sep 21, 2023
@openjdk openjdk bot closed this Sep 21, 2023
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Sep 21, 2023
@openjdk openjdk bot removed the rfr Pull request is ready for review label Sep 21, 2023
@openjdk
Copy link

openjdk bot commented Sep 21, 2023

@djelinski Pushed as commit 8cbe42b.

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

@djelinski djelinski deleted the delayload-shell32 branch September 27, 2023 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build-dev@openjdk.org core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
4 participants