Skip to content

Conversation

@matias9927
Copy link
Contributor

@matias9927 matias9927 commented Jan 14, 2026

The alternate substitutability method relies on an injected Java object "acmp_maps" which is currently not being archived and thus leads to crashes attempting to run with a CDS archive. The issue stems from inline klasses being archived and thus loaded at dumptime while the acmp_maps oops is generated in the class file parser, leading this oop to be absent at runtime.

Additionally, the other injected static field "null_reset" was not being archived either, so both of these fields are properly stored in the archived heap. In the case of CDS/AOT configurations where the heap is not dumped, acmp_maps is regenerated at class loading using a copy of the array stored in metadata.

Tests and APIs are updated to conform to the new output generated by the use of acmp_maps and remove some test cases which target the old substitutability method.


Progress

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

Issue

  • JDK-8374729: [lworld] Enabling CDS crash with UseAltSubstitutabilityMethod (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1903

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/1903.diff

Using Webrev

Link to Webrev Comment

@matias9927 matias9927 changed the title Substitutability cds 8374729: [lworld] Enabling CDS crash with UseAltSubstitutabilityMethod Jan 14, 2026
@bridgekeeper
Copy link

bridgekeeper bot commented Jan 14, 2026

👋 Welcome back matsaave! A progress list of the required criteria for merging this PR into lworld 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 Jan 14, 2026

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

8374729: [lworld] Enabling CDS crash with UseAltSubstitutabilityMethod

Reviewed-by: coleenp, fparain

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 1 new commit pushed to the lworld branch:

  • fa557ef: 8375740: [lworld] javap prints "value class" while class flags indicate ACC_IDENTITY

Please see this link for an up-to-date comparison between the source branch of this pull request and the lworld 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 lworld branch, type /integrate in a new comment.

@matias9927 matias9927 marked this pull request as ready for review January 16, 2026 19:16
@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 16, 2026
@mlbridge
Copy link

mlbridge bot commented Jan 16, 2026

Webrevs

Copy link
Contributor

@coleenp coleenp left a comment

Choose a reason for hiding this comment

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

This looks good but I have a couple of small comments.

// See comment of LIMITATION above
// Any concrete value class will have a field ".null_reset" which holds an
// all-zero instance of the value class so it will not change between
// dump time and runtime.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure how this comment about the .null_reset value applies in this if statement? It doesn't seem related to the LIMITATION comment above and there doesn't seem to be anything special done for null reset here either.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without the if statement, we'd see an error stating that a class has a static field whose value may differ between dumptime and runtime, specifically referring to .null_reset. This is currently the only case to cause any issues so I figured mentioning it in a comment would be useful.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

if (ik->is_inline_klass() && ik->is_initialized()) {
// Only concrete value classes need the null_reset field
InlineKlass* ilk = InlineKlass::cast(k);
if (ilk->has_nullable_atomic_layout()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If PR #1407 is pushed before this PR, this test will have to be changed to

  if (ilk->supports_nullable_layouts()) {

map_h->int_at_put(i, _acmp_maps_array->at(i));
}
java_mirror()->obj_field_put(_acmp_maps_offset, map_h());
}
Copy link
Member

Choose a reason for hiding this comment

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

Is it necessary to restore null_reset_value() as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The null reset value is generated in InstanceKlass:initialize() so we don't need to regenerate it here.

Copy link
Contributor

@coleenp coleenp left a comment

Choose a reason for hiding this comment

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

Mostly good, but one thing needs to be changed.

// See comment of LIMITATION above
// Any concrete value class will have a field ".null_reset" which holds an
// all-zero instance of the value class so it will not change between
// dump time and runtime.
Copy link
Contributor

Choose a reason for hiding this comment

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

ok

@openjdk
Copy link

openjdk bot commented Jan 20, 2026

@matias9927 this pull request can not be integrated into lworld due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout substitutability_cds
git fetch https://git.openjdk.org/valhalla.git lworld
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge lworld"
git push

@openjdk openjdk bot added merge-conflict Pull request has merge conflict with target branch and removed merge-conflict Pull request has merge conflict with target branch labels Jan 20, 2026
Copy link
Collaborator

@fparain fparain 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 Jan 21, 2026
@@ -0,0 +1,286 @@
/*
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you fix the copyright to just 2026 since it appears to be a new test?

Copy link
Contributor

@coleenp coleenp left a comment

Choose a reason for hiding this comment

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

Thank you! Nice work!!

@matias9927
Copy link
Contributor Author

Thank you for the reviews @coleenp, @fparain, and @iklam!
/integrate

@openjdk
Copy link

openjdk bot commented Jan 21, 2026

Going to push as commit 8f8398e.
Since your change was applied there has been 1 commit pushed to the lworld branch:

  • fa557ef: 8375740: [lworld] javap prints "value class" while class flags indicate ACC_IDENTITY

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jan 21, 2026

@matias9927 Pushed as commit 8f8398e.

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

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

Labels

integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

4 participants