Cranelift: Refactor return_call[_indirect] lowering#6666
Cranelift: Refactor return_call[_indirect] lowering#6666fitzgen merged 1 commit intobytecodealliance:mainfrom
return_call[_indirect] lowering#6666Conversation
Commons up some code paths and sets the stage for other architectures. This should have fewer calls back and forth between architecture specific and independent bits of code, which I have found hard to keep track of. Now, lowering tail calls is done in architecture specific code that can call out to architecture independent helpers as needed. Before it was architecture independent code that would call architecture specific hooks that would call architecture independent helpers. Too much stuff split across too many layers. This new approach removes at least one layer of indirection and unnecessarily confusing abstraction.
Subscribe to Label ActionDetailsThis issue or pull request has been labeled: "cranelift", "cranelift:area:aarch64", "cranelift:area:machinst", "cranelift:area:x64", "isle"Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
cfallin
left a comment
There was a problem hiding this comment.
Looks reasonable to me, thanks!
@fitzgen and I talked a bit about shared vs arch-specific ABI code and finding the right balance here. Originally we had copied-and-pasted abi.rs for both backends at the time (x64 and aarch64) and keeping them in-sync was tedious and error-prone; #2128 and #2142 merged the two into a shared common "vanilla ABI" with hooks. While that made sense at the time, we've had a significant combinatorial complexity jump since then with (4 ISAs) x (more calling conventions) x (more features), and empirically the overlap is shrinking as we add more special cases and additional hook points. So instead perhaps it makes sense to have arch-specific code at the top level (called directly from arch-specific lowering rules) and then factor out common helpers where it makes sense. This PR is a first step toward that and we'll hopefully move further that way in the future.
Commons up some code paths and sets the stage for other architectures. This should have fewer calls back and forth between architecture specific and independent bits of code, which I have found hard to keep track of. Now, lowering tail calls is done in architecture specific code that can call out to architecture independent helpers as needed. Before it was architecture independent code that would call architecture specific hooks that would call architecture independent helpers. Too much stuff split across too many layers. This new approach removes at least one layer of indirection and unnecessarily confusing abstraction.