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

Invalidate CPU I-cache on Apple Silicon #259

Merged
merged 1 commit into from
Dec 17, 2022

Conversation

SChernykh
Copy link
Collaborator

Call sys_icache_invalidate() after pthread_jit_write_protect_np() according to https://developer.apple.com/documentation/apple-silicon/porting-just-in-time-compilers-to-apple-silicon

@hyc
Copy link
Collaborator

hyc commented Nov 30, 2022

This issue keeps coming up a lot. Just a reminder (for future reference): we're already using the gcc/clang __builtin___clear_cache() and on MacOS that is simply a call to sys_icache_invalidate(). So the real question to answer is, do we have enough of those __builtin___clear_cache() invocations, in the right places?

Example clang implementation: https://codebrowser.dev/llvm/compiler-rt/lib/builtins/clear_cache.c.html

src/virtual_memory.c Outdated Show resolved Hide resolved
Copy link
Collaborator

@hyc hyc left a comment

Choose a reason for hiding this comment

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

Approving, even though it seems this isn't fixing any crashes. It is at least following the letter of the Apple docs.

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