Commit Graph

13 Commits

Author SHA1 Message Date
Crypt Keeper
891761ac1e Adds support for FreeBSD (#671)
FreeBSD was disabled due to lack of testing. This works around the
compilation problems. Note: We can't currently test arm64 automatically!

Notes:

* GitHub Actions doesn’t support FreeBSD, and may never.
* We could use Travis to run FreeBSD, but it would split our CI config.
* Using Vagrant directly is easier to debug than vmactions/freebsd-vm.
* GitHub Actions only supports virtualization on MacOS.
* GitHub Actions removed vagrant from the image starting with macos-11.
* Since VirtualBox doesn't work on arm64, freebsd/arm64 is untestabl

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
Co-authored-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-07-01 18:59:19 +08:00
Takeshi Yoneda
63f6b22311 compiler: cleanup arch specific files (#670)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-06-30 14:24:17 +09:00
Crypt Keeper
50d504cfdd Narrows compiler support to operating systems currently known to work (#612)
This narrows to what the `internal/platform` package supports, which is
currently bound by Go SDK source that include `Mprotect` or windows.

Ex. `zsyscall_linux_amd64.go` includes `Mprotect`, but
`zsyscall_freebsd_amd64.go` does not.

This should prevent errors like below, by allowing `wazero.NewRuntime()`
to properly fallback to the interpreter.

```
.../mmap.go:74:16: undefined: syscall.Mprotect
```

A later change will implement FreeBSD. This is just here to ensure users
don't crash on unexpected OS.

See #607

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2022-06-01 13:49:55 +08:00
Anuraag Agrawal
062bee4845 Tweaks doc for NewRuntimeConfig to describe API behavior (#603)
Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
2022-05-30 10:07:03 +08:00
Crypt Keeper
d992373ea7 Moves test-only symbols out of wazero package (#597)
This moves the compiler support flag out of the public package as it was
only put there for tests. This also files modgen under the testing
subdir so that it isn't mistaken for main code.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2022-05-27 17:32:26 -07:00
Anuraag Agrawal
f9a59d269a Small cleanups to docs. (#593)
Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
2022-05-27 17:24:03 +09:00
Crypt Keeper
c815060196 Renames JIT to Compiler and notes it is AOT (#564)
This notably changes NewRuntimeJIT to NewRuntimeCompiler as well renames
packages from jit to compiler.

This clarifies the implementation is AOT, not JIT, at least when
clarified to where it occurs (Runtime.CompileModule). In doing so, we
reduce any concern that compilation will happen during function
execution. We also free ourselves to create a JIT option without
confusion in the future via CompileConfig or otherwise.

Fixes #560

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2022-05-17 08:50:56 +09:00
Crypt Keeper
a91140f7f7 Changes RuntimeConfig to an interface and exposes WithWasmCore2 (#518)
WebAssembly Core Working Draft 1 recently came out. Before that, we had
a toe-hold feature bucked called FinishedFeatures. This replaces
`RuntimeConfig.WithFinishedFeatures` with `RuntimeConfig.WithWasmCore2`.
This also adds `WithWasmCore1` for those who want to lock into 1.0
features as opposed to relying on defaults.

This also fixes some design debt where we hadn't finished migrating
public types that require constructor functions (NewXxx) to interfaces.
By using interfaces, we prevent people from accidentally initializing
key configuration directly (via &Xxx), causing nil field refs. This also
helps prevent confusion about how to use the type (ex pointer or not) as
there's only one way (as an interface).

See https://github.com/tetratelabs/wazero/issues/516

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2022-05-02 10:29:38 +08:00
Takeshi Yoneda
82aec51eb9 Adds tests for multiple goroutines (#331)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-03-04 18:19:26 +09:00
Crypt Keeper
56135d4125 Sets floor go version to 1.17 (#317)
We temporarily supported go 1.16 to allow migration. By setting the
floor to 1.17, we can improve performance and focus on only two versions
(1.17 and soon 1.18).

See https://go.googlesource.com/proposal/+/refs/changes/78/248178/1/design/40724-register-calling.md
See #37

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2022-03-03 10:48:21 +08: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
979b86d502 Fixes build after 76c0bfc33f
Signed-off-by: Adrian Cole <adrian@tetrate.io>
2022-03-02 13:44:26 +08:00
Adrian Cole
76c0bfc33f Combines Store+Engine into Runtime
This simplifies state management and the amount of terminology end-users
need to learn by using one concept `Runtime` instead of two: `Engine`
and `Store`. This bridges the concepts to the specification by still
having `wazero.Runtime` implement `wasm.Store`.

The net result is that we can know for sure which "engine" is used when
decoding. This allows us a lot of flexibility especially pre-compilation
when JIT is possible.

This also changes the default to JIT based on compiler flags so that
downstream projects like wapc-go don't have to do this individually
(including tracking of which OS+Arch have JIT).

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2022-03-02 12:29:13 +08:00