Remove `for_each_section_of_type` in favor of making the module's
sections defined as distinct fields. This means it is no longer possible
to have two of the same section (which is invalid in WebAssembly, for
anything other than custom sections).
(cherry picked from commit 23cfee22058880f8251d9627e7f6640d466c37a9)
`Module::functions` created clones of all of the functions in the
module. It provided a _slightly_ better API, but ended up costing around
40ms when instantiating spidermonkey.
(cherry picked from commit dc52998341bb86ad8fb790fb72f943e43b16e8e5)
`swizzle` had the wrong operands, and the vector masking boolean logic
was incorrect in the internal `shuffle_or_0` implementation. `shuffle`
was previously implemented as a dynamic swizzle, when it uses an
immediate operand for lane indices in the spec.
(cherry picked from commit 9cc3e7d32d150dd30d683c1a8cf0bd59676f14ab)
Also make `store_to_memory` take a `MemoryArgument` so that we no longer
have to make "synthetic instructions" in some scenarios.
(cherry picked from commit ea67bc989f58e27a28f473819e4265a0ad0af97f)
Previously we relied on signed overflow, this commit makes the same
behaviour explicit (avoiding UB in the process).
(cherry picked from commit 8c8310f0bddc874a9f7f07c4158f0abc799357d4)
With this we pass an additional ~2100 tests.
We are left with 7106 WASM fails :).
There's still some test cases in the iNxM tests that fail with
this PR, but they are somewhat weird.
(cherry picked from commit b4acd4fb0b7f4105c7ef673ccc00904114c3c468)
Co-authored-by: Diego Frias <styx5242@gmail.com>
Previously the validator put a `v128` on the stack, which is not what
the spec defines.
(cherry picked from commit 0d38572d8bd2a276be1b6066b62efd376ddbd4d6)
After a `memory.grow`, the type of the memory instance should be
updated so potential memory imports on the boundary are unlinkable.
(cherry picked from commit cdb6e834a1c0eaa6e62a9018026a599916332ab3)
Single-type blocktypes previously gave loop labels an arity of 1, even
though they're shorthand for `[] -> [T]`.
(cherry picked from commit ad6a80144c23f9ccdeeccb123a9de85396524040)
As far as I know, they're not in the spec and don't serve any purposes
in the internals of LibWasm.
(cherry picked from commit 5382fbb6171555264e29872029330e1373b39671)
NaN bit patterns are now (hopefully) preserved. `static_cast` does not
preserve the bit pattern of a given NaN, so ideally we'd use some other
sort of cast and avoid `static_cast` altogether, but that's a large
change for this commit. For now, this fixes the issues found in spec
tests.
(cherry picked from commit c882498d4450c4c2e46d77a8ab36afc4eb412c00)
Otherwise we'd hit a VERIFY in AK::SIMD::shuffle() when that operand
contains an out-of-range value, the spec tests indicate that a swizzle
with an out-of-range index should return 0.
The data segment offset should be checked _before_ checking if the
contents of the segment are non-existent.
(cherry picked from commit 78c56d80f90f913e4cbc14c865af308c6af9aeae)
The big improvement included in this commit is stack height mismatch
validation. There are other minor improvements included (related to the
validation algorithm). The method of supporting stack polymorphism has
changed to be more like the spec, which was necessary for confidently
handling stack height mismatches.
See:
https://webassembly.github.io/spec/core/appendix/algorithm.html
(cherry picked from commit 9b58271f8b6de2dbfff416780a54e0322f9c6799)
Previously, the validator had a lot of extraneous information related to
frames. Now, there's just one stack with all the necessary information
derived from it.
(cherry picked from commit ad54b69de9df6ccd44178cbe49779e313f95f273)
Previously, `memory.fill` filled memory with 4-byte values, even though
`memory.fill` should fill with just one byte. Also fixes some other
issues with some of the bulk memory instructions, like `memory.init`.
(cherry picked from commit d8ee2e343df25d12637e08d54908b4fd86a22dc3)
Adds all the arithmetic ops for f32x4 and f64x2 SIMD instructions.
With this, we pass 8375 additional tests :)
Quite a few of the spec tests for this are still failing.
I confirmed with the wasmer runtime manually for a number of them,
and we seem to match their and results. I'm not really sure
what's happening here, a spec bug or wasmer is broken in
the same way.
18476 failed before.
10101 failed after.