* Upgrade wasm-tools crates, namely the component model This commit pulls in the latest versions of all of the `wasm-tools` family of crates. There were two major changes that happened in `wasm-tools` in the meantime: * bytecodealliance/wasm-tools#697 - this commit introduced a new API for more efficiently reading binary operators from a wasm binary. The old `Operator`-based reading was left in place, however, and continues to be what Wasmtime uses. I hope to update Wasmtime in a future PR to use this new API, but for now the biggest change is... * bytecodealliance/wasm-tools#703 - this commit was a major update to the component model AST. This commit almost entirely deals with the fallout of this change. The changes made to the component model were: 1. The `unit` type no longer exists. This was generally a simple change where the `Unit` case in a few different locations were all removed. 2. The `expected` type was renamed to `result`. This similarly was relatively lightweight and mostly just a renaming on the surface. I took this opportunity to rename `val::Result` to `val::ResultVal` and `types::Result` to `types::ResultType` to avoid clashing with the standard library types. The `Option`-based types were handled with this as well. 3. The payload type of `variant` and `result` types are now optional. This affected many locations that calculate flat type representations, ABI information, etc. The `#[derive(ComponentType)]` macro now specifically handles Rust-defined `enum` types which have no payload to the equivalent in the component model. 4. Functions can now return multiple parameters. This changed the signature of invoking component functions because the return value is now bound by `ComponentNamedList` (renamed from `ComponentParams`). This had a large effect in the tests, fuzz test case generation, etc. 5. Function types with 2-or-more parameters/results must uniquely name all parameters/results. This mostly affected the text format used throughout the tests. I haven't added specifically new tests for multi-return but I changed a number of tests to use it. Additionally I've updated the fuzzers to all exercise multi-return as well so I think we should get some good coverage with that. * Update version numbers * Use crates.io
127 lines
6.3 KiB
Plaintext
127 lines
6.3 KiB
Plaintext
(module
|
|
;; NB this should use a shared memory when it's supported
|
|
(memory 1)
|
|
|
|
(func (export "32.load8u") (param i32) (result i32)
|
|
local.get 0 i32.atomic.load8_u)
|
|
(func (export "32.load16u") (param i32) (result i32)
|
|
local.get 0 i32.atomic.load16_u)
|
|
(func (export "32.load32u") (param i32) (result i32)
|
|
local.get 0 i32.atomic.load)
|
|
(func (export "64.load8u") (param i32) (result i64)
|
|
local.get 0 i64.atomic.load8_u)
|
|
(func (export "64.load16u") (param i32) (result i64)
|
|
local.get 0 i64.atomic.load16_u)
|
|
(func (export "64.load32u") (param i32) (result i64)
|
|
local.get 0 i64.atomic.load32_u)
|
|
(func (export "64.load64u") (param i32) (result i64)
|
|
local.get 0 i64.atomic.load)
|
|
|
|
(func (export "32.store8") (param i32)
|
|
local.get 0 i32.const 0 i32.atomic.store8)
|
|
(func (export "32.store16") (param i32)
|
|
local.get 0 i32.const 0 i32.atomic.store16)
|
|
(func (export "32.store32") (param i32)
|
|
local.get 0 i32.const 0 i32.atomic.store)
|
|
(func (export "64.store8") (param i32)
|
|
local.get 0 i64.const 0 i64.atomic.store8)
|
|
(func (export "64.store16") (param i32)
|
|
local.get 0 i64.const 0 i64.atomic.store16)
|
|
(func (export "64.store32") (param i32)
|
|
local.get 0 i64.const 0 i64.atomic.store32)
|
|
(func (export "64.store64") (param i32)
|
|
local.get 0 i64.const 0 i64.atomic.store)
|
|
|
|
(func (export "32.load8u o1") (param i32) (result i32)
|
|
local.get 0 i32.atomic.load8_u offset=1)
|
|
(func (export "32.load16u o1") (param i32) (result i32)
|
|
local.get 0 i32.atomic.load16_u offset=1)
|
|
(func (export "32.load32u o1") (param i32) (result i32)
|
|
local.get 0 i32.atomic.load offset=1)
|
|
(func (export "64.load8u o1") (param i32) (result i64)
|
|
local.get 0 i64.atomic.load8_u offset=1)
|
|
(func (export "64.load16u o1") (param i32) (result i64)
|
|
local.get 0 i64.atomic.load16_u offset=1)
|
|
(func (export "64.load32u o1") (param i32) (result i64)
|
|
local.get 0 i64.atomic.load32_u offset=1)
|
|
(func (export "64.load64u o1") (param i32) (result i64)
|
|
local.get 0 i64.atomic.load offset=1)
|
|
|
|
(func (export "32.store8 o1") (param i32)
|
|
local.get 0 i32.const 0 i32.atomic.store8 offset=1)
|
|
(func (export "32.store16 o1") (param i32)
|
|
local.get 0 i32.const 0 i32.atomic.store16 offset=1)
|
|
(func (export "32.store32 o1") (param i32)
|
|
local.get 0 i32.const 0 i32.atomic.store offset=1)
|
|
(func (export "64.store8 o1") (param i32)
|
|
local.get 0 i64.const 0 i64.atomic.store8 offset=1)
|
|
(func (export "64.store16 o1") (param i32)
|
|
local.get 0 i64.const 0 i64.atomic.store16 offset=1)
|
|
(func (export "64.store32 o1") (param i32)
|
|
local.get 0 i64.const 0 i64.atomic.store32 offset=1)
|
|
(func (export "64.store64 o1") (param i32)
|
|
local.get 0 i64.const 0 i64.atomic.store offset=1)
|
|
)
|
|
|
|
;; aligned loads
|
|
(assert_return (invoke "32.load8u" (i32.const 0)) (i32.const 0))
|
|
(assert_return (invoke "32.load16u" (i32.const 0)) (i32.const 0))
|
|
(assert_return (invoke "32.load32u" (i32.const 0)) (i32.const 0))
|
|
(assert_return (invoke "64.load8u" (i32.const 0)) (i64.const 0))
|
|
(assert_return (invoke "64.load16u" (i32.const 0)) (i64.const 0))
|
|
(assert_return (invoke "64.load64u" (i32.const 0)) (i64.const 0))
|
|
(assert_return (invoke "32.load8u o1" (i32.const 0)) (i32.const 0))
|
|
(assert_return (invoke "32.load16u o1" (i32.const 1)) (i32.const 0))
|
|
(assert_return (invoke "32.load32u o1" (i32.const 3)) (i32.const 0))
|
|
(assert_return (invoke "64.load8u o1" (i32.const 0)) (i64.const 0))
|
|
(assert_return (invoke "64.load16u o1" (i32.const 1)) (i64.const 0))
|
|
(assert_return (invoke "64.load32u o1" (i32.const 3)) (i64.const 0))
|
|
(assert_return (invoke "64.load64u o1" (i32.const 7)) (i64.const 0))
|
|
|
|
;; misaligned loads
|
|
(assert_return (invoke "32.load8u" (i32.const 1)) (i32.const 0))
|
|
(assert_trap (invoke "32.load16u" (i32.const 1)) "misaligned memory access")
|
|
(assert_trap (invoke "32.load32u" (i32.const 1)) "misaligned memory access")
|
|
(assert_return (invoke "64.load8u" (i32.const 1)) (i64.const 0))
|
|
(assert_trap (invoke "64.load16u" (i32.const 1)) "misaligned memory access")
|
|
(assert_trap (invoke "64.load32u" (i32.const 1)) "misaligned memory access")
|
|
(assert_trap (invoke "64.load64u" (i32.const 1)) "misaligned memory access")
|
|
(assert_return (invoke "32.load8u o1" (i32.const 0)) (i32.const 0))
|
|
(assert_trap (invoke "32.load16u o1" (i32.const 0)) "misaligned memory access")
|
|
(assert_trap (invoke "32.load32u o1" (i32.const 0)) "misaligned memory access")
|
|
(assert_return (invoke "64.load8u o1" (i32.const 0)) (i64.const 0))
|
|
(assert_trap (invoke "64.load16u o1" (i32.const 0)) "misaligned memory access")
|
|
(assert_trap (invoke "64.load32u o1" (i32.const 0)) "misaligned memory access")
|
|
(assert_trap (invoke "64.load64u o1" (i32.const 0)) "misaligned memory access")
|
|
|
|
;; aligned stores
|
|
(assert_return (invoke "32.store8" (i32.const 0)))
|
|
(assert_return (invoke "32.store16" (i32.const 0)))
|
|
(assert_return (invoke "32.store32" (i32.const 0)))
|
|
(assert_return (invoke "64.store8" (i32.const 0)))
|
|
(assert_return (invoke "64.store16" (i32.const 0)))
|
|
(assert_return (invoke "64.store64" (i32.const 0)))
|
|
(assert_return (invoke "32.store8 o1" (i32.const 0)))
|
|
(assert_return (invoke "32.store16 o1" (i32.const 1)))
|
|
(assert_return (invoke "32.store32 o1" (i32.const 3)))
|
|
(assert_return (invoke "64.store8 o1" (i32.const 0)))
|
|
(assert_return (invoke "64.store16 o1" (i32.const 1)))
|
|
(assert_return (invoke "64.store32 o1" (i32.const 3)))
|
|
(assert_return (invoke "64.store64 o1" (i32.const 7)))
|
|
|
|
;; misaligned stores
|
|
(assert_return (invoke "32.store8" (i32.const 1)))
|
|
(assert_trap (invoke "32.store16" (i32.const 1)) "misaligned memory access")
|
|
(assert_trap (invoke "32.store32" (i32.const 1)) "misaligned memory access")
|
|
(assert_return (invoke "64.store8" (i32.const 1)))
|
|
(assert_trap (invoke "64.store16" (i32.const 1)) "misaligned memory access")
|
|
(assert_trap (invoke "64.store32" (i32.const 1)) "misaligned memory access")
|
|
(assert_trap (invoke "64.store64" (i32.const 1)) "misaligned memory access")
|
|
(assert_return (invoke "32.store8 o1" (i32.const 0)))
|
|
(assert_trap (invoke "32.store16 o1" (i32.const 0)) "misaligned memory access")
|
|
(assert_trap (invoke "32.store32 o1" (i32.const 0)) "misaligned memory access")
|
|
(assert_return (invoke "64.store8 o1" (i32.const 0)))
|
|
(assert_trap (invoke "64.store16 o1" (i32.const 0)) "misaligned memory access")
|
|
(assert_trap (invoke "64.store32 o1" (i32.const 0)) "misaligned memory access")
|
|
(assert_trap (invoke "64.store64 o1" (i32.const 0)) "misaligned memory access")
|