-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
cranelift: Add inline stack probing for x64 #4747
cranelift: Add inline stack probing for x64 #4747
Conversation
Subscribe to Label Actioncc @peterhuene
This issue or pull request has been labeled: "cranelift", "cranelift:area:aarch64", "cranelift:area:machinst", "cranelift:area:x64", "cranelift:meta", "wasmtime:api"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
8b2a396
to
e94273e
Compare
This needs what I hope will be an easy rebase; Otherwise, I think this looks like it does what you say it should do. @cfallin, now that it's implemented as a pseudo-instruction, what do you think? |
e94273e
to
bcfb253
Compare
Thanks for the reminder! I didn't realize this had a conflict. There is an additional question that I'd like to ask for opinions. After this PR (as it is) we have two flags, |
Looks great to me! I think this is the right approach. I didn't look closely at the emission code but the sequence in the comments seems reasonable, as does the unrolled-vs-looping optimization. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no opinion on whether to merge enable_probestack
and probestack_strategy
; I could imagine arguments both ways.
I have a couple questions/suggestions from doing another review pass but I think this would be fine to merge regardless.
@@ -1,5 +1,7 @@ | |||
test run | |||
set enable_llvm_abi_extensions=true | |||
; Disable stack probes since these tests don't require them | |||
set enable_probestack=false | |||
target x86_64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do just a few runtests need stack-probing disabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests have stack slots above the threshold where we emit a stack probe (4k by default I think). The default strategy is to outline the stack probing to a external function call, but since we never provide an implementation for that anywhere the JIT can't link these tests, so they fail.
I manually disabled stack probing for these which reflects the old behaviour of force disabling it everywhere.
👋 Hey,
This PR adds inline stack probing for the x64 backend. Opening as a draft since there are still some pending questions.
This is feature gated behind a
enable_inline_probestack
and also requires the user to enableenable_probestack
.Currently we have two implementations, If we only need to probe a few stack pages, we unroll the probes. If we need more we fall back to using a loop.
Closes: #2299
cc: @bjorn3 @cfallin