]> Cypherpunks repositories - gostls13.git/commit
wasm: restrict supported types in go:wasmimport function signatures
authorAchille Roussel <achille.roussel@gmail.com>
Sun, 9 Apr 2023 16:11:52 +0000 (10:11 -0600)
committerJohan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Thu, 13 Apr 2023 18:43:20 +0000 (18:43 +0000)
commit53c015890554991b9a2f662c657ba9adeeca6b99
tree04b6c2cea7c07aaef09b24733a346128abf9da94
parent92a3cb9ed14bce659540de8fef5e11fdb4973946
wasm: restrict supported types in go:wasmimport function signatures

Changes the set of types supported in functions declared with the
go:wasmimport directive to only allow 32 bits and 64 bits integers
and floats, as well as unsafe.Pointer in parameters only. Both the
compiler code and the standard library are updated because the new
restrictions require modifying the use of go:wasmimport in the
syscall and runtime packages.

In preparation of enabling packages outside of the standard library
to use the go:wasmimport directive, the error messages are modified
to carry more context and use ErrorfAt instead of Fatalf to avoid
printing the compiler stack trace when a function with an invalid
signature is encountered.

Fixes #59156

Change-Id: Ied8317f8ead9c28f0297060ac35a5b5255ab49db
Reviewed-on: https://go-review.googlesource.com/c/go/+/483415
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
src/cmd/compile/internal/ssagen/abi.go
src/runtime/os_wasip1.go
src/syscall/fs_wasip1.go
src/syscall/syscall_wasip1.go