Commit Graph

7544 Commits

Author SHA1 Message Date
Peter Huene
f94db6556c Update WebAssembly C API submodule to latest commit. (#2579)
* Update WebAssembly C API submodule to latest commit.

This commit updates the WebAssembly C API submodule (for `wasm.h`) to the
latest commit out of master.

This fixes the behavior of `wasm_name_new_from_string` such that it no longer
copies the null character into the name, which caused unexpected failures when
using the Wasmtime linker as imports wouldn't resolve when the null was
present.

Along with this change were breaking changes to `wasm_func_call`, the host
callback signatures, and `wasm_instance_new` to take a vector type instead of a
pointer to an unsized array.

As a result, Wasmtime language bindings based on the C API will need to be
updated once this change is pulled in.

Fixes #2211.
Fixes #2131.

* Update Doxygen comments for wasm.h changes.
2021-01-14 09:36:12 -06:00
Johnnie Birch
cde07b9a79 Re-enable spec tests that were disabled for #2432 #2470. Enable new tests
Re-enables spec tests that were turned off for #2432 and #2470 while
also enabling tests that now work due to patch pushes in the interim.
Currently all SIMD spec tests past. Testing to assure this is ok to
enable hasn't been super intense so we should monitor but there
was an attempt of doing 1000 runs 3 different times to try and reproduce
the issue and it did not occur. In the past would have occurred several
times with that many runs.
2021-01-13 19:44:00 -08:00
Johnnie Birch
d17815a239 Zero newly allocated registers whose immediate use depends on content not being NaN
An intermittent failure during SIMD spectests is described in #2432. This patch
corrects code written in a way that assumes comparing fp equality of a register with itself will
always return true. This is not true when the register value is NaN as NaN. In this case, and
with all ordered comparisons involving NaN, the comparisons will always return false.
This patch corrects that assumption for SIMD Fabs and Fneg which seem to be the only
instructions generating the failure with #2432.
2021-01-13 19:44:00 -08:00
Chris Fallin
2b2f369bbb Merge pull request #2576 from cfallin/cmp-load-bug
x64 bugfix: prevent load-op fusion of cmp because it could be emitted multiple times.
2021-01-13 10:33:37 -08:00
Chris Fallin
4638de673c x64 bugfix: prevent load-op fusion of cmp because it could be emitted multiple times.
On x64, the new backend generates `cmp` instructions at their use-sites
when possible (when the icmp that generates a boolean is known) so that
the condition flows directly through flags rather than a materialized
boolean. E.g., both `bint` (boolean to int) and `select` (conditional
select) instruction lowerings invoke `emit_cmp()` to do so.

Load-op fusion in `emit_cmp()` nominally allowed `cmp` to use its `cmp
reg, mem` form.

However, the mergeable-load condition (load has only single use) was not
adequately checked. Consider the sequence:

```
    v2 = load.i64 v1
    v3 = icmp eq v0, v2
    v4 = bint.i64 v3
    v5 = select.i64 v3, v0, v1
```

The load `v2` is only used in the `icmp` at `v3`. However, the cmp will
be separately codegen'd twice, once for the `bint` and once for the
`select`.

Prior to this fix, the above example would result in the load at `v2`
sinking to the `cmp` just above the `select`; we then emit another `cmp`
for the `bint`, but the load has already been used once so we do not
allow merging. We thus (i) expect the register for `v2` to contain the
loaded value, but (ii) skip the codegen for the load because it has been
sunk. This results in a regalloc error (unexpected livein) as the
unfilled register is upward-exposed to the entry point.

Because of this, we need to accept only the reg, reg form in
`emit_cmp()` (and the FP equivalent). We could get marginally better
code by tracking whether the `cmp` we are emitting comes from an
`icmp`/`fcmp` with only one use; but IMHO simplicity is a better rule
here when subtle interactions occur.
2021-01-13 09:48:51 -08:00
Nick Fitzgerald
90b80a2d3c Merge pull request #2574 from fitzgen/randomize-location-of-heap-objects
wasmtime-bench-api: Randomize the locations of heap objects
2021-01-13 09:35:46 -08:00
Nick Fitzgerald
bc6dc083f0 wasmtime-bench-api: Randomize the locations of heap objects
This helps us avoid measurement bias due to accidental locality of unrelated
heap objects. See *Stabilizer: Statistically Sound Performance Evaluation* by
Curtsinger and Berger for details (although Stabilizer deals with much more than
just the location of heap allocations):
https://people.cs.umass.edu/~emery/pubs/stabilizer-asplos13.pdf
2021-01-12 15:43:26 -08:00
Pat Hickey
47ff726c61 Merge pull request #2570 from bytecodealliance/pch/wiggle_flags_bitflags
wiggle: generate flags using `bitflags`
2021-01-12 13:48:35 -08:00
Pat Hickey
32f162aa78 fix windows flags 2021-01-12 09:51:09 -08:00
Pat Hickey
75a9dc7fe2 wasi-common: wiggle flags are now bitflags!
this mostly mechanical change is just getting rid of passing to
`contains` by reference.
2021-01-11 18:27:55 -08:00
Pat Hickey
ed44a19e5e wiggle: use bitflags to generate flags
more consistient with the rest of the ecosystem.
2021-01-11 18:20:57 -08:00
Pat Hickey
e2fb99af86 wiggle: depend on bitflags, and re-export it. 2021-01-11 18:04:43 -08:00
Pat Hickey
94467bcd9a wiggle: bugfix, generated code should use Names::runtime_mod not wiggle
as the crate from which these deps come.

I worked around this in lucet, but I'll be able to revert that
workaround.
2021-01-11 18:03:48 -08:00
Chris Fallin
7ed7c088a4 Merge pull request #2564 from cfallin/load-coalesce-bug
machinst lowering: update inst color when scanning across branch to allow more load-op merging.
2021-01-11 12:06:29 -08:00
Nick Fitzgerald
af772c86c5 Merge pull request #2568 from fitzgen/cargo-toml-metadata
Cargo.toml metadata for publishing
2021-01-11 11:21:47 -08:00
Chris Fallin
b4426be072 machinst lowering: update inst color when scanning across branch to allow more load-op merging.
A branch is considered side-effecting and so updates the instruction
color (which is our way of computing how far instructions can sink).
However, in the lowering loop, we did not update current instruction
color when scanning backward across branches, which are side-effecting.
As a result, the color was stale and fewer load-op merges were permitted
than are actually possible.

Note that this would not have resulted in any correctness issues, as the
stale color is too high (so no merges are permitted that should have
been disallowed).

Fixes #2562.
2021-01-11 11:20:44 -08:00
Nick Fitzgerald
3068d55fa1 wasi-nn: Fix keyword form in Cargo.toml metadata
Keywords may not have spaces, apparently.
2021-01-11 10:46:00 -08:00
Nick Fitzgerald
5ce6e009fc Add Cargo.toml metadata to peepmatic-test-operator crate 2021-01-11 10:46:00 -08:00
Julian Seward
07652ca0d4 wasm->CLIF: fn translate_operator: Select/TypedSelect: add missing bitcasts
The translation of Operator::Select and Operator::TypedSelect for vector-typed
operands, lacks the relevant bitcasting of the operands to I8X16.  This commit
adds it.
2021-01-11 11:59:05 +01:00
Chris Fallin
cacebfb19c Merge pull request #2563 from abrown/fix-build
fix: `dst` should be `Writable`, not `ValueRegs`
2021-01-08 17:31:39 -08:00
Andrew Brown
2adb0e8964 security: upgrade smallvec to 1.6.1
Fixes advisory https://rustsec.org/advisories/RUSTSEC-2021-0003.
2021-01-08 16:54:54 -08:00
Andrew Brown
b25a3c387e fix: dst should be Writable, not ValueRegs 2021-01-08 16:49:28 -08:00
Andrew Brown
09a5b91b9d x64: make several structures debuggable 2021-01-08 16:21:57 -08:00
Andrew Brown
bb2dd5b68b [machinst x64]: implement load*_zero for x64 2021-01-08 16:21:57 -08:00
Chris Fallin
81bc811236 Merge pull request #2558 from cfallin/pic-symbol-refs
x64: support PC-rel symbol references using the GOT when in PIC mode.
2021-01-08 10:03:10 -08:00
Yury Delendik
3580205f12 [Cranelift][Atomics] Add address folding for atomic notify/wait. (#2556)
* fold address in wasm wait and notify ops

* add atomics addr folding tests
2021-01-08 11:55:21 -06:00
Chris Fallin
3ee898cb2c x64: support PC-rel symbol references using the GOT when in PIC mode. 2021-01-07 22:46:56 -08:00
Nick Fitzgerald
5de5bf1565 Merge pull request #2550 from bytecodealliance/pch/wiggle_trapping
wiggle: introduce Trap enum
2021-01-07 16:23:21 -08:00
Nick Fitzgerald
9f4859b963 Merge pull request #2557 from fitzgen/wasmtime-0.22.0
Wasmtime 0.22.0
2021-01-07 15:59:09 -08:00
Nick Fitzgerald
3a3f35e158 Add release notes for Wasmtime 0.22.0 2021-01-07 15:17:02 -08:00
Pat Hickey
539058b329 fix windows 2021-01-07 14:57:18 -08:00
Nick Fitzgerald
5ad82de3c5 Bump Wasmtime to 0.22.0; Cranelift to 0.69.0 2021-01-07 14:51:12 -08:00
Pat Hickey
b149a03d5d wasi-common: instead of panicking, use an Error::Unsupported that Traps 2021-01-07 14:05:49 -08:00
Nick Fitzgerald
ee7131bc0b Merge pull request #2555 from alexcrichton/doc-module-linking
Document that the module linking proposal is implemented
2021-01-07 13:21:49 -08:00
Nick Fitzgerald
79aaeb5eda docs: Add wasm-{smith,encoder} crates to Wasm proposal checklist (#2554) 2021-01-07 14:11:42 -06:00
Pat Hickey
030f01345a cli exit tests: valid wasi commands must export a memory
wiggle enforces this but the specially-overridden proc_exit
function did not. Now that we proc_exit through wiggle, wiggle
will trap if it cannot import the instance's memory
2021-01-07 11:45:35 -08:00
Pat Hickey
07c9b65fa4 fix 2021-01-07 11:45:11 -08:00
Pat Hickey
ec1bfeefb3 fix tests 2021-01-07 11:45:11 -08:00
Pat Hickey
cd3adb1abd Trap::I32Exit is a better name 2021-01-07 11:45:11 -08:00
Pat Hickey
1dab7c8f94 wasi submodule: noreturn annotations are merged into main 2021-01-07 11:45:11 -08:00
Pat Hickey
2483ad4c1c wasi-nn: UserErrorConversion error is now a wiggle::Trap 2021-01-07 11:45:11 -08:00
Pat Hickey
745c592863 readme: expand wiggle docs 2021-01-07 11:45:11 -08:00
Pat Hickey
4a574c14eb wasi-common: port to use wiggle::Trap 2021-01-07 11:45:11 -08:00
Pat Hickey
1c7c18b026 WASI submodule: mark proc_exit funcs as noreturn in the witx 2021-01-07 11:45:11 -08:00
Pat Hickey
f8f9b14c6f wiggle: introduce wiggle::Trap, which can be either a String or I32
also, make noreturn functions always return a Trap

wasmtime-wiggle can trivially turn a wiggle::Trap into a wasmtime::Trap.
lucet will have to do the same.
2021-01-07 11:45:11 -08:00
Alex Crichton
6354edc7bd Document that the module linking proposal is implemented
Forgot to do this earlier!
2021-01-07 11:41:23 -08:00
Léo Gaspard
c0c4834c64 wasi-nn: rebuild if the witx files change 2021-01-06 15:56:46 -08:00
Pat Hickey
4018a06da2 Merge pull request #2549 from bytecodealliance/pch/wiggle_missing_memory_is_trap
wasmtime-wiggle: missing memory can just Trap
2021-01-06 11:39:58 -08:00
Pat Hickey
d4aaae3e86 wasi-nn: remove missing_memory from wasmtime_integration 2021-01-06 10:59:29 -08:00
Chris Fallin
f579d088ba Merge pull request #2538 from cfallin/multi-reg-framework
Multi-register value support: framework for Values wider than machine registers.
2021-01-06 09:58:45 -08:00