feat(MachO): Cranelift: align stack prologue/epilogue with compact unwind format#13586
Merged
Conversation
bjorn3
reviewed
Jun 8, 2026
cfallin
reviewed
Jun 8, 2026
Member
cfallin
left a comment
There was a problem hiding this comment.
This seems reasonable to me -- thanks a bunch for the contribution!
In addition to the nit below, could you add a compile filetest showing the assembly (including cases where the logic adds a new clobber) as well?
cfallin
approved these changes
Jun 8, 2026
Contributor
Author
Included a test-case, where switching |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change is motivated by a compatibility difference between LLVM and the Cranelift compiler. The PR enables Cranelift to emit proper compact unwind information for the Mach-O AArch64 platform, based on
UnwindInstandFinalizedMachCallSite.The change has two parts:
stp; it cannot encode individual registers. This results in slightly larger stack frames, but the increase should hopefully be manageable.Collected statistics for a larger WASM module (total function count: ~37K):
Pair-register encoding constant defined in LLVM:
https://github.com/llvm/llvm-project/blob/main/libunwind/include/mach-o/compact_unwind_encoding.h?utm_source=chatgpt.com#L292-L300