Commit Graph

5 Commits

Author SHA1 Message Date
Takeshi Yoneda
e8406de84a Simplify host_call example (#314)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-03-03 15:32:48 +09:00
Takeshi Yoneda
490f830096 jit(arm64): restore callee-saved registers on exits from native code (#311)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-03-02 20:51:05 +09:00
Crypt Keeper
5180d2d9c3 Refactors out public API from internals (#238)
This moves to a new end-user API under the root package `wazero`. This
simplifies call sites while hardening function calls to their known
return value. Most importantly, this moves most logic internal, as
noted in the RATIONALE.md.

Ex.

```go
	// Read WebAssembly binary containing an exported "fac" function.
	source, _ := os.ReadFile("./tests/engine/testdata/fac.wasm")

	// Decode the binary as WebAssembly module.
	mod, _ := wazero.DecodeModuleBinary(source)

	// Initialize the execution environment called "store" with Interpreter-based engine.
	store := wazero.NewStore()

	// Instantiate the module, which returns its exported functions
	functions, _ := store.Instantiate(mod)

	// Get the factorial function
	fac, _ := functions.GetFunctionI64Return("fac")

	// Discover 7! is 5040
	fmt.Println(fac(context.Background(), 7))

```

PS I changed the README to factorial because the wat version of
fibonacci is not consistent with the TinyGo one!

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Co-authored-by: Takaya Saeki <takaya@tetrate.io>
Co-authored-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-02-17 17:39:28 +08:00
Phil Kedy
4819d72876 propagate Go context into HostFunctionCallContext (#203)
Signed-off-by: Phil Kedy <phil.kedy@gmail.com>
2022-02-07 12:53:20 +08:00
Takeshi Yoneda
26ee5eb735 Rename Go source dirs for Wasms to testdata. (#106)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2021-12-31 17:33:03 +09:00