Surfing on wave.. WASM
kinke
noone at nowhere.com
Tue May 28 18:54:24 UTC 2019
On Tuesday, 28 May 2019 at 18:19:14 UTC, Sebastiaan Koppe wrote:
> Somehow LLVM expands array arguments into two u32's. Dunno why.
It's analogous to the other target ABIs - pointer-sized length
and pointer are passed as 2 separate arguments, usually in 2
registers.
> And for return types it adds an u32 as first argument (on the
> js side) that points to the return value on the stack. Pretty
> rad.
If the return type is a struct or static array, yes. This is the
behaviour of LDC's UnknownTargetABI [1], which is currently
selected for wasm targets.
This could of course all be tweaked, e.g., packing a slice
arg/return value into a i64 (=> single JS number, although
probably limited to 53 bits).
[1]:
https://github.com/ldc-developers/ldc/blob/9de916b8f63653d6836273d7336615f2e5e9a85e/gen/abi.cpp#L304-L325
More information about the Digitalmars-d
mailing list