Skip to content

[GR-63729] SVM: Constant fold the object header when initializing an object #11165

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

Closed
wants to merge 1 commit into from

Conversation

graalvmbot
Copy link
Collaborator

Hi,

Object header is computed by the native image compiled code at runtime, on x86:

lea rax, [r14_heapbase + hub_offset]
sub rax, r14_heapbase
shl rax, 2
mov [rcx], eax

The reason we cannot constant fold this sequence is because the hub_offset is not really a constant at compile time, it is patched in at the last stage of image building. We can have a dedicated constant type for object header, and patch the value into the code stream, reducing the sequence into

mov DWORD PTR [rcx], hub_offset << 2

Please take a look and leave your reviews, thanks a lot.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label May 9, 2025
@graalvmbot graalvmbot closed this May 10, 2025
@graalvmbot graalvmbot deleted the qam/constantheader branch May 10, 2025 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants