8384756: [lworld] Exclude class from archive if class of inline field is excluded#2464
8384756: [lworld] Exclude class from archive if class of inline field is excluded#2464matias9927 wants to merge 14 commits into
Conversation
|
👋 Welcome back matsaave! A progress list of the required criteria for merging this PR into |
|
@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: 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
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
| Thread* current = Thread::current(); | ||
| Handle loader(current, k->class_loader()); | ||
| Symbol* field_klass_name = Signature::strip_envelope(fs.signature()); | ||
| Klass* field_klass = SystemDictionary::find_instance_or_array_klass(current, field_klass_name, loader); |
There was a problem hiding this comment.
Why doing a system dictionary search for flat fields when a pointer is already directly available in the _inline_layout_info_array?
There was a problem hiding this comment.
if the field is a null_free_inline_type is it also available in the _inline_layout_info_array?
This search is pretty quick so would be good to have them done the same way.
There was a problem hiding this comment.
I was hoping the klasses were cached somewhere but I forgot about that array. Thanks for pointing it out!
There was a problem hiding this comment.
null-restricted fields are not in the _inline_layout_info_array, but they should be rarer (@NullRestricted is not an officially supported annotation). We don't know yet what the future of null-restricted field will look like, so I would not add them to the _inline_layout_info-array for now.
There was a problem hiding this comment.
Update: fields marked as null-restricted at CDS dump time are in fact in the _inline_layout_info_array because the class file parser fills the array with all known inline classes, and the @NullRestricted annotation is kept only for known value classes.
|
Here's a patch that addresses the issue with null-restricted static fields: it ensures that by the time the class is loaded, all static fields with a @NullRestricted annotation have been validated, and a pointer to the InlineKlass of their type has been set in the inline_layout_info_array. |
|
/contributor add @fparain |
|
@matias9927 |
iklam
left a comment
There was a problem hiding this comment.
CDS changes look good to me. Some nits.
| // Inline fields need to have their layouts preserved between dumptime and runtime. | ||
| // To ensure this, the types of the fields must be stored in the archive along with | ||
| // the field holder. | ||
| if (k->has_inlined_fields()) { |
There was a problem hiding this comment.
@fparain were you expecting to see an updated if statement with two conditions here?
if (k->has_inlined_fields() || k->has_null_restricted_static_fields()) {...}
There was a problem hiding this comment.
Yes, null restricted static fields must be in the candidate list along with the inlined fields.
coleenp
left a comment
There was a problem hiding this comment.
I haven't been following all of this bug fix but it looks good to me although I have minor comment suggestions.
|
@matias9927 this pull request can not be integrated into git checkout signed_jar_8384756
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 |
|
Thanks for the reviews, comments, and discussions @coleenp @fparain @DanHeidinga and @iklam! |
|
@matias9927 Pushed as commit 022f70b. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Classes can be excluded from the CDS archive for a variety of different reasons, such as having old classfile versions or being stored in a signed jar. These exclusions can extend to other classes that depend on an excluded class such as supers or interfaces.
Flat and null-restricted fields have layouts that are calculated when a classfile is parsed and they rely on the klass of the field being consistent between dumptime and runtime, thus adding a new dependency. This patch adds inline flat and null-restricted fields as new dependencies that may lead to the holding class being excluded from the CDS archive. Verified with a new test and tier 1-5 tests.
Progress
Issue
Reviewers
Contributors
<fparain@openjdk.org>Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/valhalla.git pull/2464/head:pull/2464$ git checkout pull/2464Update a local copy of the PR:
$ git checkout pull/2464$ git pull https://git.openjdk.org/valhalla.git pull/2464/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 2464View PR using the GUI difftool:
$ git pr show -t 2464Using diff file
Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/2464.diff
Using Webrev
Link to Webrev Comment