Commit Graph

46 Commits

Author SHA1 Message Date
Edoardo Vacchi
9841c5fc04 wazevo: fuzz, fix Fcopysign (#1826)
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
2023-11-01 07:36:28 +09:00
Edoardo Vacchi
928fce854f wazevo: fuzz, fix ssa.OpcodeInsertlane (#1825)
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
2023-10-31 23:18:46 +01:00
Edoardo Vacchi
ec1844c6fc wazevo: fuzz, fix f64x2.pmin (#1824)
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
2023-10-31 14:27:44 +01:00
Edoardo Vacchi
695b49e94d wazevo: fuzz, fix i16x8.narrow_i32x4_u (#1820)
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
2023-10-29 08:02:08 +08:00
Edoardo Vacchi
a5d1b12385 wazevo: fuzz, fix load_splat with offset values > 12 bits (#1817)
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
2023-10-25 17:33:57 +02:00
Edoardo Vacchi
e3e5b9942d wazevo: fuzz, select does not return the correct value for vectors (#1814)
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
2023-10-25 17:32:25 +02:00
Edoardo Vacchi
1748dbcfe8 wazevo: fuzz, fix load_splat (#1810)
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
Co-authored-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
2023-10-23 09:17:37 +02:00
Takeshi Yoneda
95a240370c wazevo(regalloc): fixes the PHI value liverange (#1812)
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
2023-10-23 13:20:22 +09:00
Edoardo Vacchi
9264104c0b wazevo: fuzz, fix simd shl, shr, shuffle, vbitselect (#1797) 2023-10-19 07:10:45 +09:00
Edoardo Vacchi
583e8772ec wazevo: fuzz OpcodeVIcmp, OpcodeVFcmp, allTrue (#1793) 2023-10-18 07:09:36 +09:00
Edoardo Vacchi
a653c8a8f7 wazevo: add fuzz test cases (#1792)
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
2023-10-17 15:54:37 +09:00
Takeshi Yoneda
088424c7e5 wazevo(frontend): fixes br_table lowering not to share arg slice (#1777)
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
2023-10-13 09:11:05 +09:00
Edoardo Vacchi
e3d83bbc7a wazevo: passes simd load/store spec tests (#1766)
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
2023-10-11 08:18:07 +09:00
Takeshi Yoneda
f2921d06f6 wazevo: adds support for Select on v128 values (#1762)
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
2023-10-06 10:09:09 +09:00
Takeshi Yoneda
86444c67a3 ci: run -race on PRs as well (#1408)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-04-27 09:54:59 +09:00
Takeshi Yoneda
8ab1615b53 Forbids empty name module imports (#1244)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
Co-authored-by: Crypt Keeper <64215+codefromthecrypt@users.noreply.github.com>
2023-03-16 12:22:37 +09:00
Takeshi Yoneda
7466f0e7bd Holds most fields as slice of values, not ptrs in wasm.Module (#1221)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-03-13 12:50:36 +09:00
Edoardo Vacchi
117474c477 refactor binary encoding to its own package (#1187)
move binary encoder to its own package

Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
2023-03-03 07:21:22 +08:00
Crypt Keeper
b758344212 API BREAK: renames InstantiateModuleFromBinary to Instantiate (#1129)
This renames `InstantiateModuleFromBinary` to `Instantiate` to both make
first time use simpler to write and also de-complicate adding a
`WithConfig` variant as requested in #1105

End users in simple case need to change their signature like so.
```diff
-       mod, err := r.InstantiateModuleFromBinary(ctx, addWasm)
+       mod, err := r.Instantiate(ctx, addWasm)
```

In practice, many will not need to change their signature because they
had to use the `InstantiateModule` function in order to assign
configuration such as the module name, filesystem or use a real clock.
Instead, they had to use the more complicated chain of `CompileModule`
and `InstantiateModule` even when only assigning config. Users in this
situation can opt into the more simplified syntax below:

```go
mod, err := r.InstantiateWithConfig(ctx, addWasm,
	wazero.NewModuleConfig().WithName("adder"))
```



```diff
-       mod, err := r.InstantiateModuleFromBinary(ctx, addWasm)
+       mod, err := r.Instantiate(ctx, addWasm)
```

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-02-15 14:52:17 -10:00
Takeshi Yoneda
c9155b8f2b amd64: fixes memory.fill bug (#1055)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
2023-01-24 08:07:11 +09:00
Takeshi Yoneda
2df84c679c ci: adds -skip flag to the race tests (#1023)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-01-11 12:23:09 +09:00
Crypt Keeper
126bd9050d Removes context parameter from instruction-scoped operations (#923)
We originally had a `context.Context` for anything that might be
traced, but it turned out to be only useful for lifecycle and host functions.

For instruction-scoped aspects like memory updates, a context parameter is too
fine-grained and also invisible in practice. For example, most users will use
the compiler engine, and its memory, global or table access will never use go's
context.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2022-12-14 16:08:07 +09:00
Takeshi Yoneda
b8adb361e8 Fixes FuncRef global initialization with imported globals (#888)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-12-06 14:32:12 +09:00
Takeshi Yoneda
610af79719 Fixes applyTableInits for many extern null inits (#874)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-11-30 15:32:06 +09:00
Takeshi Yoneda
721327decc Consolidates table init logics (#873)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-11-30 14:28:37 +09:00
Crypt Keeper
b01effc8a9 Top-levels CoreFeatures and defaults to 2.0 (#800)
While compilers should be conservative when targeting WebAssembly Core
features, runtimes should be lenient as otherwise people need to
constantly turn on all features. Currently, most examples have to turn
on 2.0 features because compilers such as AssemblyScript and TinyGo use
them by default. This matches the policy with the reality, and should
make first time use easier.

This top-levels an internal type as `api.CoreFeatures` and defaults to
2.0 as opposed to 1.0, our previous default. This is less cluttered than
the excess of `WithXXX` methods we had prior to implementing all
planned WebAssembly Core Specification 1.0 features.

Finally, this backfills rationale as flat config types were a distinct
decision even if feature set selection muddied the topic.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2022-09-06 15:14:36 +08:00
Crypt Keeper
57a705e594 Disallows nil context and fixes linters (#754)
staticcheck linters broke until recent golangci-lint. Now, normal
behaviour of enforcing no nil context works again. Ex.
```
assemblyscript/assemblyscript_example_test.go:16:25: SA1012: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (staticcheck)
	r := wazero.NewRuntime(nil)
```

Since default lint already checks for nil context, this removes our
permission of nil context args. The original reason we permitted nil is
no longer valid: we once allowed context to be stashed in config, and
removed that as it caused bugs. We forgot to undo allowing nil
explicitly.

Note: this doesn't particularly check in our code for nil context,
similar as we don't particularly check in our code for nil anything
else. End users should use linters as none of our parameters should be
nil anyway.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2022-08-19 14:52:50 +08:00
Takeshi Yoneda
076d3245e3 Pass context into NewRuntime (#748)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-08-18 14:47:49 +09:00
Takeshi Yoneda
9be4f2979f amd64: fixes huge memory offset consts handling (#733)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-08-04 13:17:42 +09:00
Takeshi Yoneda
9dfdab2548 amd64: correctly select sign of zeros on f32x4/f64x2 min/max (#730) 2022-08-02 19:47:49 +09:00
Takeshi Yoneda
c5daf5a218 interpreter,compiler(arm64): clears higher bits in i32.load_8/16_s (#725)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-07-28 15:45:07 +09:00
Takeshi Yoneda
d1336806d6 compiler: save conditional values at data.drop (#724)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-07-27 17:18:42 +09:00
Takeshi Yoneda
a064f68532 compiler: allow memory access after table.grow (#721)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-07-27 09:56:48 +09:00
Takeshi Yoneda
d15cc069c6 compiler: save conditional value on elem.drop (#722)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-07-27 09:53:19 +09:00
Takeshi Yoneda
41df6d9556 arm64: fix bounds check on v128.load{32,64}_zero. (#720)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-07-26 16:23:54 +09:00
Takeshi Yoneda
97e3216eb2 asm(arm64): fixes the source register of CMEQ(vector,zero) (#719)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-07-26 15:59:45 +09:00
Takeshi Yoneda
37d2c6d803 asm(arm64): fixes unaligned vector stores (#718)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-07-26 12:10:26 +09:00
Takeshi Yoneda
143b2be398 compiler: save conditional values at ref.func (#717)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-07-25 13:58:15 +09:00
Takeshi Yoneda
8d75403c49 compiler: save conditional values at table.size (#715)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-07-25 13:32:32 +09:00
Takeshi Yoneda
4c71c1f33b interpreter: fixes V128FloatPromote to use lower 64-bits. (#709)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-07-21 17:25:06 +09:00
Takeshi Yoneda
e44fa5f44a interpreter: clear higher bits for 32-bit signed shr (#708)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-07-21 17:13:09 +09:00
Takeshi Yoneda
ff4a7ff4f9 interpreter: fixes i32x4/i16x8 bit mask (#704)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-07-15 16:07:49 +09:00
Takeshi Yoneda
2d0ed54931 interpreter: signed-extend to 32-bit in SignExtend32 (#701)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-07-15 10:56:38 +09:00
Takeshi Yoneda
9e3dda2429 ir: rename NeedsAccess* -> Has*, and make them module-scoped (#699)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-07-15 08:54:00 +09:00
Takeshi Yoneda
0ae4254f21 Support for select instructions on vector values (#696)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-07-14 14:45:17 +09:00
Takeshi Yoneda
48d6e6f2e1 compiler(amd64),interpreter: signed-extend to 32-bit in V128ExtractLane. (#695)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-07-14 12:47:44 +09:00