Skip to content

8379863: [lworld] C2: assert(!value->obj_is_scalar_replaced() || realloc_failures) failed: object should be reallocated already#2240

Closed
benoitmaillard wants to merge 3 commits intoopenjdk:lworldfrom
benoitmaillard:JDK-8379863
Closed

8379863: [lworld] C2: assert(!value->obj_is_scalar_replaced() || realloc_failures) failed: object should be reallocated already#2240
benoitmaillard wants to merge 3 commits intoopenjdk:lworldfrom
benoitmaillard:JDK-8379863

Conversation

@benoitmaillard
Copy link
Copy Markdown
Contributor

@benoitmaillard benoitmaillard commented Mar 18, 2026

This PR prevents hitting an assert in vframeArrayElement::fill_in when escape analysis and autobox elimination are disabled.

With value classes, scalarization can take place independently of escape analysis. When deoptimizing, this implies that we must always rematerialize objects when EliminateAllocations is true, even if escape analysis is disabled.
Prior to this change, we hit an assert in vframeArrayElement::fill_in because it is expected that scalarized objects are already reallocated there. We have to make sure that rematerialize_objects is run before that.

Testing

  • tier1-3, plus some internal testing

Thank you for reviewing!


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-8379863: [lworld] C2: assert(!value->obj_is_scalar_replaced() || realloc_failures) failed: object should be reallocated already (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2240

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper Bot commented Mar 18, 2026

👋 Welcome back bmaillard! 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
Copy Markdown

openjdk Bot commented Mar 18, 2026

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

8379863: [lworld] C2: assert(!value->obj_is_scalar_replaced() || realloc_failures) failed: object should be reallocated already

Reviewed-by: mchevalier, thartmann

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 12 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 (@marc-chevalier, @TobiHartmann) 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 changed the title 8379863 8379863: [lworld] C2: assert(!value->obj_is_scalar_replaced() || realloc_failures) failed: object should be reallocated already Mar 18, 2026
@benoitmaillard benoitmaillard marked this pull request as ready for review March 18, 2026 15:25
@openjdk openjdk Bot added the rfr Pull request is ready for review label Mar 18, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge Bot commented Mar 18, 2026

Webrevs

Copy link
Copy Markdown
Member

@marc-chevalier marc-chevalier left a comment

Choose a reason for hiding this comment

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

Why was DoEscapeAnalysis necessary before, when EliminateAllocations is true?

@benoitmaillard
Copy link
Copy Markdown
Contributor Author

On mainline scalarization is dependent on escape analysis, with valhalla inline types can be scalarized in InlineTypeNode::make_scalar_in_safepoints, independently of escape analysis @marc-chevalier.

@TobiHartmann
Copy link
Copy Markdown
Member

Could you please add a regression test (or add a configuration to an existing test)?

@benoitmaillard
Copy link
Copy Markdown
Contributor Author

I have added a regression test @TobiHartmann, sorry for not doing this earlier.

Copy link
Copy Markdown
Member

@marc-chevalier marc-chevalier left a comment

Choose a reason for hiding this comment

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

I like this version better.

@openjdk openjdk Bot added the ready Pull request is ready to be integrated label Mar 19, 2026
Copy link
Copy Markdown
Member

@TobiHartmann TobiHartmann left a comment

Choose a reason for hiding this comment

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

Thanks, that looks good to me!

@benoitmaillard
Copy link
Copy Markdown
Contributor Author

Thank you for your reviews @marc-chevalier @TobiHartmann!
/integrate

@openjdk openjdk Bot added the sponsor Pull request is ready to be sponsored label Mar 20, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented Mar 20, 2026

@benoitmaillard
Your change (at version 74ddbfd) is now ready to be sponsored by a Committer.

@TobiHartmann
Copy link
Copy Markdown
Member

/sponsor

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Mar 20, 2026

Going to push as commit 19fe8ba.
Since your change was applied there have been 13 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 Mar 20, 2026
@openjdk openjdk Bot closed this Mar 20, 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 Mar 20, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented Mar 20, 2026

@TobiHartmann @benoitmaillard Pushed as commit 19fe8ba.

💡 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.

3 participants