s390x: Support tail calls#9052
Conversation
Subscribe to Label ActionDetailsThis issue or pull request has been labeled: "cranelift", "cranelift:area:machinst", "isle", "wasmtime:api", "wasmtime:config"Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
Label Messager: wasmtime:configIt looks like you are changing Wasmtime's configuration options. Make sure to
DetailsTo modify this label's message, edit the To add new label messages or remove existing label messages, edit the |
fitzgen
left a comment
There was a problem hiding this comment.
Nice!
I didn't evaluate the details of the calling convention, as s390x isn't my area of expertise, but everything looks great in general, and I was very pleased to see the updates to the runtests and fuzzgen. Couple nitpick-y suggestions below, but I think this is basically good to go.
Thanks, Ulrich!!
| &MemArg::InitialSPOffset { off } => MemArg::InitialSPOffset { off: off + offset }, | ||
| &MemArg::NominalSPOffset { off } => MemArg::NominalSPOffset { off: off + offset }, | ||
| &MemArg::SlotOffset { off } => MemArg::SlotOffset { off: off + offset }, | ||
| _ => unreachable!(), |
There was a problem hiding this comment.
What cases is this matching? I think it might be better to explicitly list them, rather than using _, so that if more MemArg variants are added in the future we don't forget to consider/update this case.
| pub struct EmitState { | ||
| pub(crate) initial_sp_offset: i64, | ||
| pub(crate) nominal_sp_offset: u32, |
There was a problem hiding this comment.
Can we add some documentation for what the nominal SP is and what its relation to the actual SP is? This was something that I always forgot the nitty-gritty details of in the old system, so if we are bringing part of it back, I think it would be helpful to have comments spelling those things out.
| /// Get the return area pointer register. | ||
| pub fn ret_area_ptr(&self) -> Reg { | ||
| self.ret_area_ptr.unwrap() | ||
| } |
There was a problem hiding this comment.
We don't always have a return area pointer, so I think this should return an Option<Reg> and let callers do the unwrap if they have knowledge of why it definitely exists in their specific case.
| /// Get the return area pointer register. | |
| pub fn ret_area_ptr(&self) -> Reg { | |
| self.ret_area_ptr.unwrap() | |
| } | |
| /// Get the return area pointer register, if any. | |
| pub fn ret_area_ptr(&self) -> Option<Reg> { | |
| self.ret_area_ptr | |
| } |
| ;; Incoming return area pointer. | ||
| (decl abi_ret_area_ptr () Reg) | ||
| (extern constructor abi_ret_area_ptr abi_ret_area_ptr) |
There was a problem hiding this comment.
And then this external constructor could be called unwrap_abi_ret_area_ptr or some such.
| ( | ||
| false, | ||
| true, |
5141997 to
7de7f55
Compare
This adds support for a newly defined tail-call ABI for s390x as well as supporting tail calls themselves. We now use the tail-call ABI by default for Wasmtime, and enable tail calls by default. This also allows getting rid of a number of special case and test exclusions for s390x. Fixes: bytecodealliance#6530
7de7f55 to
5286fca
Compare
|
Thanks for the review, @fitzgen ! The latest version should address all review comments. |
This adds support for a newly defined tail-call ABI for s390x as well as supporting tail calls themselves.
We now use the tail-call ABI by default for Wasmtime, and enable tail calls by default.
This also allows getting rid of a number of special case and test exclusions for s390x.
Fixes: #6530