cranelift: Add inline stack probing for x64#4747
Conversation
Subscribe to Label Actioncc @peterhuene DetailsThis 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. |
jameysharp
left a comment
There was a problem hiding this comment.
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.
| 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.
Why do just a few runtests need stack-probing disabled?
There was a problem hiding this comment.
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_probestackand 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