mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 13:33:39 +00:00
compiler: pass i64 return value in an extra pointer param
To support the WebAssembly<->JS barrier, return values also have to be passed in memory. i64 return values are used by syscall/js, so must be supported across this ABI barrier.
This commit is contained in:
@@ -147,6 +147,14 @@ somewhat compatible with the C calling convention but with a few quirks:
|
||||
calling convention workaround may be removed. Also see `this wasm-bindgen
|
||||
issue <https://github.com/rustwasm/wasm-bindgen/issues/35>`_.
|
||||
|
||||
* The WebAssembly target does not return variables directly that cannot be
|
||||
handled by JavaScript (``struct``, ``i64``, multiple return values, etc).
|
||||
Instead, they are stored into a pointer passed as the first parameter by the
|
||||
caller.
|
||||
|
||||
This is the calling convention as implemented by LLVM, with the extension
|
||||
that ``i64`` return values are returned in the same way as aggregate types.
|
||||
|
||||
* Some functions have an extra context parameter appended at the end of the
|
||||
argument list. This only happens when both of these conditions hold:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user