Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intialize dataAddr field only for non-zero length array #20869

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

VermaSh
Copy link
Contributor

@VermaSh VermaSh commented Dec 23, 2024

Update array inline allocation sequence to initialize dataAddr field only for non-zero length arrays. Field should be left blank for zero length arrays. Additionally this also clears padding field after the size field.

@VermaSh VermaSh force-pushed the inline_array_allocation_z branch from ff0ba22 to 5938046 Compare December 23, 2024 19:13
@VermaSh
Copy link
Contributor Author

VermaSh commented Dec 23, 2024

Off-heap personal build, upstream personal build. My off-heap personal build is looking good so far, only 1 unrelated failure. I'll remove the WIP tag once both builds have passed without off-heap related failures.

cc: @r30shah / @zl-wang / @dmitripivkine

@VermaSh VermaSh marked this pull request as draft December 23, 2024 19:17
@VermaSh VermaSh changed the title Intialize dataAddr field only for non-zero length array WIP: Intialize dataAddr field only for non-zero length array Dec 23, 2024
@VermaSh VermaSh force-pushed the inline_array_allocation_z branch from 5938046 to 54bf0a5 Compare December 24, 2024 18:11
@VermaSh
Copy link
Contributor Author

VermaSh commented Dec 24, 2024

Launched new non-off-heap personal build to verify PR changes

@VermaSh VermaSh force-pushed the inline_array_allocation_z branch 2 times, most recently from da4a877 to 9b31e29 Compare December 27, 2024 16:50
@VermaSh VermaSh force-pushed the inline_array_allocation_z branch 8 times, most recently from 1317bac to c3c566c Compare January 3, 2025 19:10
@VermaSh
Copy link
Contributor Author

VermaSh commented Jan 3, 2025

Relaunched non off-heap build

@VermaSh VermaSh force-pushed the inline_array_allocation_z branch 2 times, most recently from f3b4840 to 7994eb1 Compare January 6, 2025 18:21
Update array inline allocation sequence to initialize dataAddr field
only for non-zero size arrays. Field should be left blank for zero
size arrays.

Signed-off-by: Shubham Verma <[email protected]>
@VermaSh VermaSh force-pushed the inline_array_allocation_z branch 3 times, most recently from 648f364 to 068425c Compare January 7, 2025 05:42
@VermaSh
Copy link
Contributor Author

VermaSh commented Jan 7, 2025

I have verified the sequence for x and z through a unit test. Need to do the same for power and aarch64 before removing WIP tag.

@VermaSh VermaSh force-pushed the inline_array_allocation_z branch from 068425c to 6d13fde Compare January 7, 2025 22:15
@VermaSh
Copy link
Contributor Author

VermaSh commented Jan 7, 2025

Launched personal non off-heap build for power.

@VermaSh VermaSh force-pushed the inline_array_allocation_z branch 3 times, most recently from 71bbabb to 8f03946 Compare January 8, 2025 18:20
@VermaSh VermaSh changed the title WIP: Intialize dataAddr field only for non-zero length array Intialize dataAddr field only for non-zero length array Jan 8, 2025
@VermaSh VermaSh marked this pull request as ready for review January 8, 2025 18:21
@VermaSh
Copy link
Contributor Author

VermaSh commented Jan 8, 2025

Kept only z here as it is ready for review, other platforms require more testing. @r30shah Can I please get a review?

Copy link
Contributor

@r30shah r30shah left a comment

Choose a reason for hiding this comment

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

Checking out the changes, by skimming through the change, I had some intiail questions, I have posted.

if (isOffHeapAllocationEnabled)
{
TR_ASSERT_FATAL_WITH_NODE(node,
TR::InstOpCode::LGF == loadDimLenOpCode,
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 explain why we have this assert (Checking loadDimLenOpCode to LGF). That variable is initialized to LGF at line 4891 and I do not see it ever updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

dataAddr field should be 0 for 0 size arrays. Since size will already be 0, I figured we can use that to 0-out dataAddr field. The issue is that size is 4 bytes wide whereas dataAddr is 8 bytes wide, in order to use the same register I need to clear top 4 bytes of firstDimLenReg. I added the assert to ensure that size is sign extended to 64 bits when being loaded to firstDimLenReg. Same logic for second LGF assert.

Copy link
Contributor

Choose a reason for hiding this comment

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

I do get the reason behind using the LGF instruction. Do you mean to say the logic for the assert is safeguarding someone accidentally changing the code to use other instruction to load firstDimLenReg ? If so instead of putting this assert which I feel is not needed, we should put the comment where you are loading firstDimLenReg on why using LGF instead of LG and warn about the potential functional issue.

}
if (isOffHeapAllocationEnabled)
{
TR_ASSERT_FATAL_WITH_NODE(node,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question as before.

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.

2 participants