-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BasicCABI] Pass compiler-rt 128-bit return values in memory #223
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,23 +173,35 @@ making a copy of any indirectly passed data that the callee should not modify. | |
Similarly, types can either be returned directly from WebAssembly functions or | ||
returned indirectly via a pointer parameter prepended to the parameter list. | ||
|
||
Type | Parameter | Result | | ||
-----------------------------|---------------|----------| | ||
scalar[1] | direct | direct | | ||
empty struct or union | ignored | ignored | | ||
singleton struct or union[2] | direct | direct | | ||
other struct or union[3] | indirect | indirect | | ||
array | indirect | N/A | | ||
|
||
[1] `long long double` and `__int128` are passed directly as two `i64` values. | ||
Signed 8 and 16-bit scalars are sign-extended, and unsigned 8 and 16-bit | ||
scalars are zero-extended before passing or returning. | ||
|
||
[2] Any struct or union that recursively (including through nested structs, | ||
Type | Parameter | Result | | ||
-----------------------------|---------------|--------------------| | ||
scalar | direct[1] | direct/indirect[2] | | ||
empty struct or union | ignored | ignored | | ||
singleton struct or union[3] | direct | direct | | ||
other struct or union[4] | indirect | indirect | | ||
array | indirect | N/A | | ||
|
||
[1] In case of parameters, `long long double`, `__int128`, and `__float128` are | ||
passed directly as two `i64` values. In case of return values, for | ||
non-compiler-rt functions, they are passed directly as two `i64` values if | ||
[multivalue](https://github.com/WebAssembly/multi-value) is enabled and | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is true is it? Enable multi-value doesn't change the ABI, right? We do have an experimental multi-value ABI but its not official, and we probably don't want to be mentioning it at all here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will fix this once we decide what to do with the feature flag / experimental flag / ABI. |
||
indirectly passed via a pointer parameter otherwise. | ||
Signed 8 and 16-bit scalars are sign-extended, and unsigned 8 and 16-bit scalars | ||
are zero-extended before passing or returning. | ||
|
||
[2] In case of return values for compiler-rt functions, `long long double`, | ||
`__int128`, and `__float128` are indirectly passed via a pointer parameter that | ||
points to the value in memory, regardless of whether | ||
[multivalue](https://github.com/WebAssembly/multi-value) is enabled or not, to | ||
make the compiler-rt ABI uniform across the features. | ||
Signed 8 and 16-bit scalars are sign-extended, and unsigned 8 and 16-bit scalars | ||
are zero-extended before passing or returning. | ||
|
||
[3] Any struct or union that recursively (including through nested structs, | ||
unions, and arrays) contains just a single scalar value and is not specified to | ||
have greater than natural alignment. | ||
|
||
[3] This calling convention was defined before | ||
[4] This calling convention was defined before | ||
[multivalue](https://github.com/WebAssembly/multi-value) was standardized. A new | ||
default calling convention that changes this behavior and takes advantage of | ||
multivalue may be introduced in the future. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[1]
appears once in the "Parameter" column, so I'm confused about seeing "in case of return values" here. Should that part be in[2]
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, it should go to
[2]
. Given that whether we are gonna do this or not is unclear, will fix it later (if we go this route)