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

AArch64 macOS: Add a call to pthread_jit_write_protect_np() #6551

Merged
merged 1 commit into from
Jun 6, 2022

Conversation

knn-k
Copy link
Contributor

@knn-k knn-k commented Jun 6, 2022

This commit adds a call to pthread_jit_write_protect_np(0) in
ARM64ImmSymInstruction::generateBinaryEncoding() for AArch64 macOS.

It is needed because methodTrampolineLookup() calls createTrampoline()
when necessary, and that makes the compiler thread lose the permission
for writing to the code buffer.

Signed-off-by: KONNO Kazuhiro konno@jp.ibm.com

@knn-k
Copy link
Contributor Author

knn-k commented Jun 6, 2022

Jenkins build aarch64

@knn-k
Copy link
Contributor Author

knn-k commented Jun 6, 2022

There is no other place that call methodTrampolineLookup() in AArch64 codegen.


#if defined(OSX)
// Regain permission for writing to the code buffer
// after calling methodTrampolineLookup()
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you amend this comment to include why this is the case? i.e., that methodTrampolineLookup() may call createTrampoline() which will acquire/release write protection leaving the write permission disabled in this path.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the comment.

This commit adds a call to pthread_jit_write_protect_np(0) in
ARM64ImmSymInstruction::generateBinaryEncoding() for AArch64 macOS.

It is needed because methodTrampolineLookup() calls createTrampoline()
when necessary, and that makes the compiler thread lose the permission
for writing to the code buffer.

Signed-off-by: KONNO Kazuhiro <konno@jp.ibm.com>
@knn-k
Copy link
Contributor Author

knn-k commented Jun 6, 2022

Jenkins build aarch64

@0xdaryl 0xdaryl self-assigned this Jun 6, 2022
Copy link
Contributor

@0xdaryl 0xdaryl left a comment

Choose a reason for hiding this comment

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

Only a comment was changed. No need to wait for CI. Merging.

@0xdaryl 0xdaryl merged commit c859f0d into eclipse:master Jun 6, 2022
@knn-k knn-k deleted the aarch64macos6 branch June 6, 2022 23:16
knn-k added a commit to knn-k/openj9-omr that referenced this pull request Jun 7, 2022
This commit adds a call to pthread_jit_write_protect_np(0) in
ARM64ImmSymInstruction::generateBinaryEncoding() for AArch64 macOS.

Original PR in OMR: eclipse/omr#6551

Signed-off-by: KONNO Kazuhiro <konno@jp.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants