Skip to content

Conversation

@calvinccheung
Copy link
Member

@calvinccheung calvinccheung commented Feb 11, 2025

This changeset fixes a crash during AOT cache creation when AOTInvokeDynamicLinking is disabled.
Changes in cdsHeapVerifier.cpp is required to avoid error such as the following during AOT cache creation:

[4.156s][warning][cds,heap] Archive heap points to a static field that may hold a different value at runtime:
[4.156s][warning][cds,heap] Field: java/util/Collections::EMPTY_LIST

Per Ioi's suggestions, added the CDSConfig::is_dumping_method_handles() so that most of the calls to CDSConfig::is_dumping_aot_linked_classes() and CDSConfig::is_dumping_invokedynamic() could be replaced with the new function.

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

Issue

  • JDK-8348322: AOT cache creation crashes with "All cached hidden classes must be aot-linkable" when AOTInvokeDynamicLinking is disabled (Bug - P3)

Reviewers

Contributors

  • Ioi Lam <iklam@openjdk.org>

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23546

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

Using diff file

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

Using Webrev

Link to Webrev Comment

…ust be aot-linkable" when AOTInvokeDynamicLinking is disabled
@bridgekeeper
Copy link

bridgekeeper bot commented Feb 11, 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 Feb 11, 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:

8348322: AOT cache creation crashes with "All cached hidden classes must be aot-linkable" when AOTInvokeDynamicLinking is disabled

Co-authored-by: Ioi Lam <iklam@openjdk.org>
Reviewed-by: iklam, matsaave

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

  • 3602c8c: 8350955: Fix repetitions of the word "the" in runtime component comments
  • c988d7d: 8350767: Fix -Wzero-as-null-pointer-constant warnings in nsk jni stress tests
  • 67dfdfa: 8350623: Fix -Wzero-as-null-pointer-constant warnings in nsk native test utilities
  • 4a51c61: 8350567: NMT: update VMATree::register_mapping to copy the existing tag of the region
  • db69ec9: 8344009: Improve compiler memory statistics
  • f47232a: 8350954: Fix repetitions of the word "the" in gc component comments
  • 30b0c60: 8350956: Fix repetitions of the word "the" in compiler component comments
  • 8b0468f: 8315488: Remove outdated and unused ciReplay support from SA
  • 4109c73: 8349523: Unused runtime calls to drem/frem should be removed
  • b054d24: 8350584: Check the usage of LOG_PLEASE
  • ... and 61 more: https://git.openjdk.org/jdk/compare/d4fdc796aac8ece930c28579d285b21acf8e6ddb...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
Copy link

openjdk bot commented Feb 11, 2025

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

  • hotspot-runtime

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 hotspot-runtime hotspot-runtime-dev@openjdk.org label Feb 11, 2025
@calvinccheung
Copy link
Member Author

/contributor add iklam

@openjdk
Copy link

openjdk bot commented Feb 15, 2025

@calvinccheung
Contributor Ioi Lam <iklam@openjdk.org> successfully added.

@calvinccheung calvinccheung marked this pull request as ready for review February 18, 2025 23:26
@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 18, 2025
@mlbridge
Copy link

mlbridge bot commented Feb 18, 2025

Webrevs

Copy link
Member

@iklam iklam left a comment

Choose a reason for hiding this comment

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

LGTM.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 21, 2025
Copy link
Contributor

@matias9927 matias9927 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 overall but I had some comments. Are there any remaining uses of is_dumping_invokedynamic()? I see several cases were replaced and I'm wondering if it's even being used anymore.

// classes that are used in the implementation of MethodHandles.
// Archived MethodHandles are required for higher-level optimizations such as AOT resolution of invokedynamic
// and dynamic proxies.
bool CDSConfig::is_dumping_method_handles() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like it does the same check as is_initing_classes_at_dump_time() and is very similar to is_dumping_invokedynamic(). Maybe you can combine these methods to avoid duplicate code?

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed the CDSConfig::is_initing_classes_at_dump_time() since the conditions are the same as CDSConfig::is_dumping_method_handles(). All the calls to CDSConfig::is_initing_classes_at_dump_time() have been updated accordingly.

Copy link
Member

Choose a reason for hiding this comment

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

I think we should keep is_initing_classes_at_dump_time(), because it's used as a precondition for archiving initialized Java mirrors. Putting such code inside is_dumping_method_handles() would not make sense.

In fact, archived method handles require the ability to store initialized mirrors (for the hidden classes). So I think we should change is_dumping_method_handles() to this:

// When we can dump initialized classes mirrors, we automatically enable the archiving of MethodHandles.
// This will in turn enable the archiving of MethodTypes and hidden classes that are used in the
// implementation of MethodHandles. Note: these hidden classes need to be stored in the initialized state,
// as we don't have a mechanism to trigger their initialization on-demand.
// Archived MethodHandles are required for higher-level optimizations such as AOT resolution of invokedynamic
// and dynamic proxies.
bool CDSConfig::is_dumping_method_handles() {
  return is_initing_classes_at_dump_time();
}

Copy link
Member Author

Choose a reason for hiding this comment

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

I added back the CDSConfig::is_initing_classes_at_dump_time() function and reverted most of previous changes.

Copy link
Member

Choose a reason for hiding this comment

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

The three changes in aotArtifactFinder.cpp should also be reverted.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@calvinccheung
Copy link
Member Author

Looks good overall but I had some comments. Are there any remaining uses of is_dumping_invokedynamic()? I see several cases were replaced and I'm wondering if it's even being used anymore.

Yes, it is still being used in several places.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Feb 28, 2025
Copy link
Contributor

@matias9927 matias9927 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 3, 2025
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Mar 3, 2025
Copy link
Member

@iklam iklam left a comment

Choose a reason for hiding this comment

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

LGTM!

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 3, 2025
@calvinccheung
Copy link
Member Author

@iklam @matias9927 Thanks for the review!

/integrate

@openjdk
Copy link

openjdk bot commented Mar 3, 2025

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

  • e470f47: 8350095: RISC-V: Refactor string_compare
  • f53de92: 8350931: RISC-V: remove unnecessary src register for fp_sqrt_d/f
  • e1fc14f: 8350940: RISC-V: remove unnecessary assert_different_registers in minmax_fp
  • 79880e5: 8351033: RISC-V: TestFloat16ScalarOperations asserts with offset (4210) is too large to be patched in one beq/bge/bgeu/blt/bltu/bne instruction!
  • bb70896: 8350903: Remove explicit libjvm.so dependency for libVThreadEventTest
  • 7c187b5: 8338737: Shenandoah: Reset marking bitmaps after the cycle
  • 3602c8c: 8350955: Fix repetitions of the word "the" in runtime component comments
  • c988d7d: 8350767: Fix -Wzero-as-null-pointer-constant warnings in nsk jni stress tests
  • 67dfdfa: 8350623: Fix -Wzero-as-null-pointer-constant warnings in nsk native test utilities
  • 4a51c61: 8350567: NMT: update VMATree::register_mapping to copy the existing tag of the region
  • ... and 67 more: https://git.openjdk.org/jdk/compare/d4fdc796aac8ece930c28579d285b21acf8e6ddb...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Mar 3, 2025

@calvinccheung Pushed as commit c4b516d.

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

@calvinccheung calvinccheung deleted the 8348322-AOT-cache-InvokeDynamicLinking branch March 3, 2025 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants