all: add flag to enable i64 parameters in WebAssembly

This commit is contained in:
Konstantin Yegupov
2018-12-25 17:17:32 +00:00
committed by Ayke van Laethem
parent dccfae485c
commit a8dd82538e
3 changed files with 20 additions and 8 deletions
+5 -2
View File
@@ -3114,9 +3114,11 @@ func (c *Compiler) NonConstGlobals() {
}
}
// Replace i64 in an external function with a stack-allocated i64*, to work
// When -wasm-abi flag set to "js" (default),
// replace i64 in an external function with a stack-allocated i64*, to work
// around the lack of 64-bit integers in JavaScript (commonly used together with
// WebAssembly). Once that's resolved, this pass may be avoided.
// See also the -wasm-abi= flag
// https://github.com/WebAssembly/design/issues/1172
func (c *Compiler) ExternalInt64AsPtr() error {
int64Type := c.ctx.Int64Type()
@@ -3220,7 +3222,8 @@ func (c *Compiler) ExternalInt64AsPtr() error {
c.builder.SetInsertPointAtEnd(entryBlock)
var callParams []llvm.Value
if fnType.ReturnType() == int64Type {
return errors.New("todo: i64 return value in exported function")
return errors.New("not yet implemented: exported function returns i64 with -wasm-abi=js; " +
"see https://tinygo.org/compiler-internals/calling-convention/")
}
for i, origParam := range fn.Params() {
paramValue := externalFn.Param(i)