mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
all: implement wasmimport directive
Go programs can now use the //go:wasmimport module_name function_name directive to import functions from the WebAssembly runtime. For now, the directive is restricted to the runtime and syscall/js packages. * Derived from CL 350737 * Original work modified to work with changes to the IR conversion code. * Modification of CL 350737 changes to fully exist in Unified IR path (emp) * Original work modified to work with changes to the ABI configuration code. * Fixes #38248 Co-authored-by: Vedant Roy <vroy101@gmail.com> Co-authored-by: Richard Musiol <mail@richard-musiol.de> Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Change-Id: I740719735d91c306ac718a435a78e1ee9686bc16 Reviewed-on: https://go-review.googlesource.com/c/go/+/463018 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
This commit is contained in:
parent
af9f21289f
commit
02411bcd7c
29 changed files with 585 additions and 145 deletions
|
|
@ -133,6 +133,16 @@ type Func struct {
|
|||
// For wrapper functions, WrappedFunc point to the original Func.
|
||||
// Currently only used for go/defer wrappers.
|
||||
WrappedFunc *Func
|
||||
|
||||
// WasmImport is used by the //go:wasmimport directive to store info about
|
||||
// a WebAssembly function import.
|
||||
WasmImport *WasmImport
|
||||
}
|
||||
|
||||
// WasmImport stores metadata associated with the //go:wasmimport pragma.
|
||||
type WasmImport struct {
|
||||
Module string
|
||||
Name string
|
||||
}
|
||||
|
||||
func NewFunc(pos src.XPos) *Func {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue