Closed tlively closed 3 years ago
@RReverser I made it a table, ptal.
Would it make sense to mention the upcoming multivalue ABI here, so that people building tools that know about C ABIs are aware that this change is coming?
the upcoming multivalue ABI here, so that people building tools that know about C ABIs are aware that this change is coming?
I suspect multivalue ABI will be an additional ABI, rather than a replacement for the current one? (we'll still need this one for compatibility with older browsers / engines)
Multivalue is standardized and widely supported now, so I'm hoping multivalue will become the default, even if we also retain the pre-multivalue ABI for compatibility.
Multivalue is standardized and widely supported now, so I'm hoping multivalue will become the default, even if we also retain the pre-multivalue ABI for compatibility.
Right, that's my point - we'll still retain this ABI for compatibility.
Given that it already has "As mentioned in README, it's not the only possible C ABI. It is the ABI that the clang/LLVM WebAssembly backend is currently using, [...]" in the disclaimer, that seems sufficient and we can reword once we create a doc for multivalue C ABI.
This section should probably also mention varargs. They work similarly (https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp#L950) to byval: the caller assigns each argument an offset according to its alignment and size, creates a buffer in its stack frame (at compile time), and then at runtime copies each argument into its place and passes a pointer to the buffer (as the last argument).
@dschuff Good idea, yeah. So, if I understand correctly, varargs are laid out as if they were fields in an extra struct passed to the function?
How does that extra detail look, @RReverser?
How does that extra detail look, @RReverser?
LGTM. I, obviously, can't speak for its correctness / completeness, especially in light of me being confused by the 3 * sizeof(varargs)
allocation that Clang seems to be doing, but if you think this description is sufficiently correct, I'm happy to go with it.
@tlively Thanks for documenting this!
Fixes #160.