Skip to content

Fix multiANewArray evaluator register dependency bug in IBM Z platform - #22763

Merged
r30shah merged 1 commit into
eclipse-openj9:masterfrom
ehsankianifar:Z_FixMultiANewArrayWrongChildRegisterBug
Oct 15, 2025
Merged

r30shah merged 1 commit into
eclipse-openj9:masterfrom
ehsankianifar:Z_FixMultiANewArrayWrongChildRegisterBug

Conversation

@ehsankianifar

Copy link
Copy Markdown
Contributor

multianewarray opcode instructions was updated in #22548 and the
evaluation of the second child was changed to evaluate only if
reference count is > 1. This caused the last multianewarray tree to
have wrong dims register child and some failures. Remove the condition
for evaluating children.

Fix: #22757

@ehsankianifar

Copy link
Copy Markdown
Contributor Author

In the old multiANewArray evaluator the dim child of the node was evaluated and added to the post dependency conditions. We changed that logic and evaluated the child only if the ref count was bigger than 1 and didn't add it to the dependency conditions. This change cause the the RA store and load the dims register inside the OOL code which is not often executed. As a result, if we have several multiANewArray trees, and one inline allocation fails, chances are we do not restore the proper value of the dims register and helper call fails.
This PR evaluate the dim register unconditionally and add it to the post conditions.

@ehsankianifar

Copy link
Copy Markdown
Contributor Author

@r30shah I opened this PR to fix the bug and create an issue to study the allocator behaviour to find why exactly this is happening.

@r30shah r30shah left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please update the commit message , body and PR title to reflect the changes properly.,

@ehsankianifar
ehsankianifar force-pushed the Z_FixMultiANewArrayWrongChildRegisterBug branch 2 times, most recently from 161ce47 to 005be43 Compare October 15, 2025 16:11
@ehsankianifar ehsankianifar changed the title Z: Fix multiANewArray child register bug Fix multiANewArray evaluator register dependency bug in IBM Z platform Oct 15, 2025
Although the number of dimensions in multianewarray node is constant
and not used via a register in the evaluator's mainline ICF path, it is
referenced in the out-of-line (OOL) section for setting up call
parameters. If the dimension node has multiple reference counts and is
not explicitly tied to the mainline dependency, it may be spilled in
the OOL path and reverse-spilled elsewhere, potentially leading to
unexpected behavior. This change ensures that the dimension node is
evaluated and attached to the mainline dependency to maintain
correctness and prevent such issues.

Fix: eclipse-openj9#22757
signed-off-by: Ehsan Kiani Far <ehsan.kianifar@gmail.com>
@ehsankianifar
ehsankianifar force-pushed the Z_FixMultiANewArrayWrongChildRegisterBug branch from 005be43 to 7e375d3 Compare October 15, 2025 16:25

@r30shah r30shah left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@r30shah

r30shah commented Oct 15, 2025

Copy link
Copy Markdown
Contributor

Jenkins test sanity zlinux jdk8,jdk21

@r30shah
r30shah merged commit 206fc9c into eclipse-openj9:master Oct 15, 2025
@ehsankianifar
ehsankianifar deleted the Z_FixMultiANewArrayWrongChildRegisterBug branch October 15, 2025 20:06
@ehsankianifar
ehsankianifar restored the Z_FixMultiANewArrayWrongChildRegisterBug branch October 17, 2025 13:52
@ehsankianifar
ehsankianifar deleted the Z_FixMultiANewArrayWrongChildRegisterBug branch October 17, 2025 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

abbs Segmentation error jitAMultiNewArray IOException: Bad file descriptor NegativeArraySizeException

2 participants