Skip to content

8171508: Remove -Dsun.java.launcher.is_altjvm option #24310

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

Closed

Conversation

calvinccheung
Copy link
Member

@calvinccheung calvinccheung commented Mar 29, 2025

The -Dsun.java.launcher.is_altjvm option is only used in the gtest launcher and has no relationship with the similarly named -XXaltjvm option. The gtest launcher also sets the -XX:+ExecutingUnitTests option. This RFE involves removing the -Dsun.java.launcher.is_altjvm option, capturing the -XX:+ExecutingUnitTests option in Arguments::process_sun_java_launcher_properties() so that the os::jvm_path() can check if the option is set before using JAVA_HOME setting.

Passed tiers 1 - 3 testing.


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
  • Change requires CSR request JDK-8353678 to be approved

Issues

  • JDK-8171508: Remove -Dsun.java.launcher.is_altjvm option (Bug - P4)
  • JDK-8353678: Remove the -Dsun.java.launcher.is_altjvm option (CSR)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 24310

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@calvinccheung calvinccheung marked this pull request as ready for review March 29, 2025 04:29
@bridgekeeper
Copy link

bridgekeeper bot commented Mar 29, 2025

👋 Welcome back ccheung! 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 Mar 29, 2025

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

8171508: Remove -Dsun.java.launcher.is_altjvm option

Reviewed-by: dholmes, stuefe

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 178 new commits pushed to 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.

@calvinccheung
Copy link
Member Author

/label add hotspot-runtime

@openjdk openjdk bot added rfr Pull request is ready for review hotspot-runtime [email protected] labels Mar 29, 2025
@openjdk
Copy link

openjdk bot commented Mar 29, 2025

@calvinccheung
The hotspot-runtime label was successfully added.

@mlbridge
Copy link

mlbridge bot commented Mar 29, 2025

@tstuefe
Copy link
Member

tstuefe commented Mar 29, 2025

Hi @calvinccheung, I thought we planned on removing altjvm handling altogether? See mail thread https://mail.openjdk.org/pipermail/hotspot-runtime-dev/2017-April/023205.html

@tstuefe
Copy link
Member

tstuefe commented Mar 29, 2025

@dholmes-ora
Copy link
Member

go back 4 instead of 5 slashes and then checking for "/jre/lib";

But we got rid of the jre directory years ago. ??

@calvinccheung
Copy link
Member Author

Hi @calvinccheung, I thought we planned on removing altjvm handling altogether? See mail thread https://mail.openjdk.org/pipermail/hotspot-runtime-dev/2017-April/023205.html

I've pushed a commit which removes altjvm handling in JVM. There's small piece of code in the java launcher (java.c) which I didn't remove because:

  • there's an internal test which uses altjvm;
  • JVM won't start if -XXaltjvm is specified

@calvinccheung
Copy link
Member Author

go back 4 instead of 5 slashes and then checking for "/jre/lib";

But we got rid of the jre directory years ago. ??

I've removed the processing regarding the slashes and the jre directory.

@dholmes-ora
Copy link
Member

This issue should be renamed "Remove -Dsun.java.launcher.is_altjvm option". That requires a CSR request to be filed.

Once again for the record -XXaltjvm has nothing to do with the -Dsun.java.launcher.is_altjvm option.

https://mail.openjdk.org/pipermail/hotspot-runtime-dev/2017-April/023241.html

Removal of -XXaltjvm would also need a CSR request.

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Apr 3, 2025
@calvinccheung calvinccheung changed the title 8171508: os::jvm_path: error in handling -Dsun.java.launcher.is_altjvm option after 8066474 8171508: Remove -Dsun.java.launcher.is_altjvm option Apr 3, 2025
@calvinccheung
Copy link
Member Author

This issue should be renamed "Remove -Dsun.java.launcher.is_altjvm option". That requires a CSR request to be filed.

I filed a draft CSR JDK-8353678.

@dholmes-ora
Copy link
Member

How does the gtest launcher work with these changes? There the libjvm.so is in a completely different place to the JDK. ??

@dholmes-ora
Copy link
Member

Also as discussed offline picking up JAVA_HOME from the environment is not the right thing to do in general. It only worked with -Dsun.java.launcher.is_altjvm because we ensured we set JAVA_HOME when using the property.

@calvinccheung
Copy link
Member Author

How does the gtest launcher work with these changes? There the libjvm.so is in a completely different place to the JDK. ??

gtest launcher sets the -XX:+ExecutingUnitTests option. My updated fix is to capture the option in Arguments::process_sun_java_launcher_properties() so that the os::jvm_path() can check if the option is set before using JAVA_HOME setting.

@dholmes-ora
Copy link
Member

Can you update the PR description to clarify what is now being done please Calvin.

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.

So basically now we have removed the -Dsun.java.launcher.is_altjvm option and replaced its use with gtest by the use of the executing_unit_tests functionality. Okay.

A few minor requests. Thanks.

@calvinccheung
Copy link
Member Author

Can you update the PR description to clarify what is now being done please Calvin.

Updated PR description.

Copy link
Member

@tstuefe tstuefe left a comment

Choose a reason for hiding this comment

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

Are the Posix variants all identical? If yes, can we move this to os::posix.cpp? If not, what are the differences?

@dholmes-ora
Copy link
Member

Are the Posix variants all identical? If yes, can we move this to os::posix.cpp? If not, what are the differences?

AIX has a different dll lookup mechanism, but otherwise these should be pretty much identical. Windows also only really differs in the lookup mechanism. Maybe new RFE to refactor these and share some code?

@tstuefe
Copy link
Member

tstuefe commented Apr 8, 2025

Are the Posix variants all identical? If yes, can we move this to os::posix.cpp? If not, what are the differences?

AIX has a different dll lookup mechanism, but otherwise these should be pretty much identical. Windows also only really differs in the lookup mechanism. Maybe new RFE to refactor these and share some code?

Okay. The code could also be simpler if it were to use stringStream, spanned over the caller-provided buffer. No character counting and truncation handling needed then (but we would need to add truncation detection to stringStream, but that is really easy).

@calvinccheung
Copy link
Member Author

Are the Posix variants all identical? If yes, can we move this to os::posix.cpp? If not, what are the differences?

AIX has a different dll lookup mechanism, but otherwise these should be pretty much identical. Windows also only really differs in the lookup mechanism. Maybe new RFE to refactor these and share some code?

Okay. The code could also be simpler if it were to use stringStream, spanned over the caller-provided buffer. No character counting and truncation handling needed then (but we would need to add truncation detection to stringStream, but that is really easy).

I agree with David about doing the refactoring in a new RFE. I've simplified the code by using stringStream as you suggested. I didn't add truncation detection to stringStream (which I think could be done in another RFE). However, I added an assert in os::jvm_path() to ensure there's no truncation.

Copy link
Member

@tstuefe tstuefe left a comment

Choose a reason for hiding this comment

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

Nice, this looks good to me. Thank you.

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 okay. Some additional possible cleanup now you are using the stringStream.

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 openjdk bot added ready Pull request is ready to be integrated and removed csr Pull request needs approved CSR before integration labels Apr 10, 2025
@calvinccheung
Copy link
Member Author

Thanks @tstuefe, @dholmes-ora for the review.

/integrate

@openjdk
Copy link

openjdk bot commented Apr 10, 2025

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

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Apr 10, 2025

@calvinccheung Pushed as commit 7680f70.

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

@calvinccheung calvinccheung deleted the 8171508-os-jvm_path branch April 17, 2025 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime [email protected] integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants