Skip to content

[GR-65172] Insert load and store conversions for unsafe accesses during PEA. #11366

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

Merged
merged 2 commits into from
Jun 10, 2025

Conversation

graalvmbot
Copy link
Collaborator

The example below should return 0xFFFFFFF0, because byte accesses are sign extended, which is also done in
DefaultLoweringProvider.java.
PEA though just extracts the constant and returns it, so we get 0xF0F0F0F0, which is incorrect.

static class Data {
    int value = 0xF0F0F0F0;
}
public static int getByte() {
      Data data = new Data();
      return Unsafe.getUnsafe().getByte(data, 12);
}

The PR fixes this issue by inserting load and store conversions during PEA and also adds test cases.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jun 10, 2025
@graalvmbot graalvmbot merged commit 7b92aa5 into master Jun 10, 2025
13 checks passed
@graalvmbot graalvmbot deleted the mh/GR-65172/PEA-Unsafe branch June 10, 2025 12:42
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