Skip to content

8376813: [lworld] Add print for dummy field reused as null-marker#2001

Closed
jsikstro wants to merge 2 commits intoopenjdk:lworldfrom
jsikstro:JDK-8376813_print_dummy_field_reused_as_null_marker
Closed

8376813: [lworld] Add print for dummy field reused as null-marker#2001
jsikstro wants to merge 2 commits intoopenjdk:lworldfrom
jsikstro:JDK-8376813_print_dummy_field_reused_as_null_marker

Conversation

@jsikstro
Copy link
Member

@jsikstro jsikstro commented Jan 30, 2026

Hello,

Right now it's not clear that the dummy field that is injected into empty inline klasses can be/is reused for the null-marker when looking at the printed layout from -XX:+PrintInlineLayout. I suggest we enhance this print to indicate if the dummy field has been reused for the null-marker.

I've tested that the added comment in the print is there when nullability is turned on (default), and not there when turned off (-XX:-UseNullableValueFlattening -XX:-UseNullableNonAtomicValueFlattening).

Before:
Instance fields:
 @0 RESERVED 12/-
 @12 REGULAR 1/1 ".empty" B

After:
Instance fields:
 @0 RESERVED 12/-
 @12 REGULAR 1/1 ".empty" B (reused as null-marker)

Testing:

  • GHA
  • Oracle's tier1

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-8376813: [lworld] Add print for dummy field reused as null-marker (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2001

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 30, 2026

👋 Welcome back jsikstro! 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 30, 2026

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

8376813: [lworld] Add print for dummy field reused as null-marker

Reviewed-by: fparain, phubner

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

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@fparain, @Arraying) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 30, 2026
@mlbridge
Copy link

mlbridge bot commented Jan 30, 2026

Webrevs

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.

Looks good to me.
It's unfortunate that the null marker offset is stored in the FieldLayoutBuilder and not in FieldLayout, this would have prevented adding an argument to the print method.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 30, 2026
Copy link
Member

@Arraying Arraying left a comment

Choose a reason for hiding this comment

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

Thanks for the changes, this makes debugging and developing a lot easier. One thing that came to mind is that we have a bunch of flat array specific printing logic in e.g. FlatArrayKlass::oop_print_value_on. As a possible extension, would we ever want to convey such information in the array itself, rather than the field? For example when debug-printing the human-version of the array header to indicate the null marker is reused as the dummy field (when applicable)?

@jsikstro
Copy link
Member Author

jsikstro commented Feb 4, 2026

Thanks for the changes, this makes debugging and developing a lot easier. One thing that came to mind is that we have a bunch of flat array specific printing logic in e.g. FlatArrayKlass::oop_print_value_on. As a possible extension, would we ever want to convey such information in the array itself, rather than the field? For example when debug-printing the human-version of the array header to indicate the null marker is reused as the dummy field (when applicable)?

I'm not entirely sure of how arrays work so I'd need to spend some time on figuring that out before giving a better answer. When trying to understand emtpy InlineKlasses, it wasn't immediately clear to me that the empty dummy-field was reused as the null-marker, so I'd say anything we can do to convey that more clearly is something we'd want to do.

@jsikstro
Copy link
Member Author

jsikstro commented Feb 4, 2026

Thank you for the reviews everyone! I reran tier1-2 on the tip of lworld, which is green.

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Feb 4, 2026
@openjdk
Copy link

openjdk bot commented Feb 4, 2026

@jsikstro
Your change (at version 87849f2) is now ready to be sponsored by a Committer.

@Arraying
Copy link
Member

Arraying commented Feb 4, 2026

/sponsor

@openjdk
Copy link

openjdk bot commented Feb 4, 2026

Going to push as commit ff2e209.
Since your change was applied there have been 116 commits pushed to the lworld branch:

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Feb 4, 2026

@Arraying @jsikstro Pushed as commit ff2e209.

💡 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