Update wasm-tools dependencies (#4970)

* Update wasm-tools dependencies

This update brings in a number of features such as:

* The component model binary format and AST has been slightly adjusted
  in a few locations. Names are dropped from parameters/results now in
  the internal representation since they were not used anyway. At this
  time the ability to bind a multi-return function has not been exposed.

* The `wasmparser` validator pass will now share allocations with prior
  functions, providing what's probably a very minor speedup for Wasmtime
  itself.

* The text format for many component-related tests now requires named
  parameters.

* Some new relaxed-simd instructions are updated to be ignored.

I hope to have a follow-up to expose the multi-return ability to the
embedding API of components.

* Update audit information for new crates
This commit is contained in:
Alex Crichton
2022-09-27 13:12:34 -05:00
committed by GitHub
parent 10deb9b7fe
commit 29c7de7340
31 changed files with 407 additions and 331 deletions

View File

@@ -189,7 +189,7 @@ fn make_echo_component_with_params(type_definition: &str, params: &[Param]) -> S
(type $Foo {type_definition})
(func (export "echo") (param $Foo) (result $Foo)
(func (export "echo") (param "a" $Foo) (result "b" $Foo)
(canon lift
(core func $i "echo")
(memory $i "memory")

View File

@@ -60,10 +60,10 @@ fn typecheck() -> Result<()> {
(func (export "thunk")
(canon lift (core func $i "thunk"))
)
(func (export "tuple-thunk") (param (tuple)) (result (tuple))
(func (export "tuple-thunk") (param "a" (tuple)) (result (tuple))
(canon lift (core func $i "thunk"))
)
(func (export "take-string") (param string)
(func (export "take-string") (param "a" string)
(canon lift (core func $i "take-string") (memory $i "memory") (realloc (func $i "realloc")))
)
(func (export "take-two-args") (param "a" s32) (param "b" (list u8))
@@ -154,14 +154,14 @@ fn integers() -> Result<()> {
(func (export "ret-i32-100000") (result i32) i32.const 100000)
)
(core instance $i (instantiate (module $m)))
(func (export "take-u8") (param u8) (canon lift (core func $i "take-i32-100")))
(func (export "take-s8") (param s8) (canon lift (core func $i "take-i32-100")))
(func (export "take-u16") (param u16) (canon lift (core func $i "take-i32-100")))
(func (export "take-s16") (param s16) (canon lift (core func $i "take-i32-100")))
(func (export "take-u32") (param u32) (canon lift (core func $i "take-i32-100")))
(func (export "take-s32") (param s32) (canon lift (core func $i "take-i32-100")))
(func (export "take-u64") (param u64) (canon lift (core func $i "take-i64-100")))
(func (export "take-s64") (param s64) (canon lift (core func $i "take-i64-100")))
(func (export "take-u8") (param "a" u8) (canon lift (core func $i "take-i32-100")))
(func (export "take-s8") (param "a" s8) (canon lift (core func $i "take-i32-100")))
(func (export "take-u16") (param "a" u16) (canon lift (core func $i "take-i32-100")))
(func (export "take-s16") (param "a" s16) (canon lift (core func $i "take-i32-100")))
(func (export "take-u32") (param "a" u32) (canon lift (core func $i "take-i32-100")))
(func (export "take-s32") (param "a" s32) (canon lift (core func $i "take-i32-100")))
(func (export "take-u64") (param "a" u64) (canon lift (core func $i "take-i64-100")))
(func (export "take-s64") (param "a" s64) (canon lift (core func $i "take-i64-100")))
(func (export "ret-u8") (result u8) (canon lift (core func $i "ret-i32-0")))
(func (export "ret-s8") (result s8) (canon lift (core func $i "ret-i32-0")))
@@ -420,7 +420,7 @@ fn type_layers() -> Result<()> {
)
)
(core instance $i (instantiate $m))
(func (export "take-u32") (param u32) (canon lift (core func $i "take-i32-100")))
(func (export "take-u32") (param "a" u32) (canon lift (core func $i "take-i32-100")))
)
"#;
@@ -472,16 +472,16 @@ fn floats() -> Result<()> {
)
(core instance $i (instantiate $m))
(func (export "f32-to-u32") (param float32) (result u32)
(func (export "f32-to-u32") (param "a" float32) (result u32)
(canon lift (core func $i "i32.reinterpret_f32"))
)
(func (export "f64-to-u64") (param float64) (result u64)
(func (export "f64-to-u64") (param "a" float64) (result u64)
(canon lift (core func $i "i64.reinterpret_f64"))
)
(func (export "u32-to-f32") (param u32) (result float32)
(func (export "u32-to-f32") (param "a" u32) (result float32)
(canon lift (core func $i "f32.reinterpret_i32"))
)
(func (export "u64-to-f64") (param u64) (result float64)
(func (export "u64-to-f64") (param "a" u64) (result float64)
(canon lift (core func $i "f64.reinterpret_i64"))
)
)
@@ -545,10 +545,10 @@ fn bools() -> Result<()> {
)
(core instance $i (instantiate $m))
(func (export "u32-to-bool") (param u32) (result bool)
(func (export "u32-to-bool") (param "a" u32) (result bool)
(canon lift (core func $i "pass"))
)
(func (export "bool-to-u32") (param bool) (result u32)
(func (export "bool-to-u32") (param "a" bool) (result u32)
(canon lift (core func $i "pass"))
)
)
@@ -584,10 +584,10 @@ fn chars() -> Result<()> {
)
(core instance $i (instantiate $m))
(func (export "u32-to-char") (param u32) (result char)
(func (export "u32-to-char") (param "a" u32) (result char)
(canon lift (core func $i "pass"))
)
(func (export "char-to-u32") (param char) (result u32)
(func (export "char-to-u32") (param "a" char) (result u32)
(canon lift (core func $i "pass"))
)
)
@@ -722,21 +722,21 @@ fn strings() -> Result<()> {
)
(core instance $i (instantiate $m))
(func (export "list8-to-str") (param (list u8)) (result string)
(func (export "list8-to-str") (param "a" (list u8)) (result string)
(canon lift
(core func $i "roundtrip")
(memory $i "memory")
(realloc (func $i "realloc"))
)
)
(func (export "str-to-list8") (param string) (result (list u8))
(func (export "str-to-list8") (param "a" string) (result (list u8))
(canon lift
(core func $i "roundtrip")
(memory $i "memory")
(realloc (func $i "realloc"))
)
)
(func (export "list16-to-str") (param (list u16)) (result string)
(func (export "list16-to-str") (param "a" (list u16)) (result string)
(canon lift
(core func $i "roundtrip")
string-encoding=utf16
@@ -744,7 +744,7 @@ fn strings() -> Result<()> {
(realloc (func $i "realloc"))
)
)
(func (export "str-to-list16") (param string) (result (list u16))
(func (export "str-to-list16") (param "a" string) (result (list u16))
(canon lift
(core func $i "roundtrip")
string-encoding=utf16
@@ -1001,10 +1001,10 @@ fn some_traps() -> Result<()> {
)
(core instance $i (instantiate $m))
(func (export "take-list-unreachable") (param (list u8))
(func (export "take-list-unreachable") (param "a" (list u8))
(canon lift (core func $i "take-list") (memory $i "memory") (realloc (func $i "realloc")))
)
(func (export "take-string-unreachable") (param string)
(func (export "take-string-unreachable") (param "a" string)
(canon lift (core func $i "take-list") (memory $i "memory") (realloc (func $i "realloc")))
)
@@ -1034,10 +1034,10 @@ fn some_traps() -> Result<()> {
)
(core instance $i2 (instantiate $m2))
(func (export "take-list-base-oob") (param (list u8))
(func (export "take-list-base-oob") (param "a" (list u8))
(canon lift (core func $i2 "take-list") (memory $i2 "memory") (realloc (func $i2 "realloc")))
)
(func (export "take-string-base-oob") (param string)
(func (export "take-string-base-oob") (param "a" string)
(canon lift (core func $i2 "take-list") (memory $i2 "memory") (realloc (func $i2 "realloc")))
)
(func (export "take-many-base-oob") (type $t)
@@ -1054,10 +1054,10 @@ fn some_traps() -> Result<()> {
)
(core instance $i3 (instantiate $m3))
(func (export "take-list-end-oob") (param (list u8))
(func (export "take-list-end-oob") (param "a" (list u8))
(canon lift (core func $i3 "take-list") (memory $i3 "memory") (realloc (func $i3 "realloc")))
)
(func (export "take-string-end-oob") (param string)
(func (export "take-string-end-oob") (param "a" string)
(canon lift (core func $i3 "take-list") (memory $i3 "memory") (realloc (func $i3 "realloc")))
)
(func (export "take-many-end-oob") (type $t)
@@ -1453,23 +1453,23 @@ fn option() -> Result<()> {
)
(core instance $i (instantiate $m))
(func (export "option-unit-to-u32") (param (option (tuple))) (result u32)
(func (export "option-unit-to-u32") (param "a" (option (tuple))) (result u32)
(canon lift (core func $i "pass0"))
)
(func (export "option-u8-to-tuple") (param (option u8)) (result "a" u32) (result "b" u32)
(func (export "option-u8-to-tuple") (param "a" (option u8)) (result "a" u32) (result "b" u32)
(canon lift (core func $i "pass1") (memory $i "memory"))
)
(func (export "option-u32-to-tuple") (param (option u32)) (result "a" u32) (result "b" u32)
(func (export "option-u32-to-tuple") (param "a" (option u32)) (result "a" u32) (result "b" u32)
(canon lift (core func $i "pass1") (memory $i "memory"))
)
(func (export "option-string-to-tuple") (param (option string)) (result "a" u32) (result "b" string)
(func (export "option-string-to-tuple") (param "a" (option string)) (result "a" u32) (result "b" string)
(canon lift
(core func $i "pass2")
(memory $i "memory")
(realloc (func $i "realloc"))
)
)
(func (export "to-option-unit") (param u32) (result (option (tuple)))
(func (export "to-option-unit") (param "a" u32) (result (option (tuple)))
(canon lift (core func $i "pass0"))
)
(func (export "to-option-u8") (param "a" u32) (param "b" u32) (result (option u8))
@@ -1646,21 +1646,21 @@ fn expected() -> Result<()> {
)
(core instance $i (instantiate $m))
(func (export "take-expected-unit") (param (result)) (result u32)
(func (export "take-expected-unit") (param "a" (result)) (result u32)
(canon lift (core func $i "pass0"))
)
(func (export "take-expected-u8-f32") (param (result u8 (error float32))) (result "a" u32) (result "b" u32)
(func (export "take-expected-u8-f32") (param "a" (result u8 (error float32))) (result "a" u32) (result "b" u32)
(canon lift (core func $i "pass1") (memory $i "memory"))
)
(type $list (list u8))
(func (export "take-expected-string") (param (result string (error $list))) (result "a" u32) (result "b" string)
(func (export "take-expected-string") (param "a" (result string (error $list))) (result "a" u32) (result "b" string)
(canon lift
(core func $i "pass2")
(memory $i "memory")
(realloc (func $i "realloc"))
)
)
(func (export "to-expected-unit") (param u32) (result (result))
(func (export "to-expected-unit") (param "a" u32) (result (result))
(canon lift (core func $i "pass0"))
)
(func (export "to-expected-s16-f32") (param "a" u32) (param "b" u32) (result (result s16 (error float32)))
@@ -1782,7 +1782,7 @@ fn fancy_list() -> Result<()> {
(type $b (result (error string)))
(type $input (list (tuple $a $b)))
(func (export "take")
(param $input)
(param "a" $input)
(result "ptr" u32)
(result "len" u32)
(result "list" (list u8))
@@ -2226,7 +2226,7 @@ fn lower_then_lift() -> Result<()> {
let component = format!(
r#"
(component $c
(import "s" (func $f (param string)))
(import "s" (func $f (param "a" string)))
(core module $libc
(memory (export "memory") 1)
@@ -2237,7 +2237,7 @@ fn lower_then_lift() -> Result<()> {
(core func $f_lower
(canon lower (func $f) (memory $libc "memory"))
)
(func $f2 (param string)
(func $f2 (param "a" string)
(canon lift (core func $f_lower)
(memory $libc "memory")
(realloc (func $libc "realloc"))
@@ -2266,7 +2266,7 @@ fn lower_then_lift() -> Result<()> {
let component = format!(
r#"
(component $c
(import "s2" (func $f (param string) (result u32)))
(import "s2" (func $f (param "a" string) (result u32)))
(core module $libc
(memory (export "memory") 1)
@@ -2277,7 +2277,7 @@ fn lower_then_lift() -> Result<()> {
(core func $f_lower
(canon lower (func $f) (memory $libc "memory"))
)
(func $f2 (param string) (result string)
(func $f2 (param "a" string) (result string)
(canon lift (core func $f_lower)
(memory $libc "memory")
(realloc (func $libc "realloc"))
@@ -2328,7 +2328,7 @@ fn errors_that_poison_instance() -> Result<()> {
(memory (export "m") 1)
)
(core instance $m2 (instantiate $m2))
(func (export "f3") (param string)
(func (export "f3") (param "a" string)
(canon lift (core func $m2 "f") (realloc (func $m2 "r")) (memory $m2 "m"))
)
@@ -2398,7 +2398,7 @@ fn errors_that_poison_instance() -> Result<()> {
fn run_export_with_internal_adapter() -> Result<()> {
let component = r#"
(component
(type $t (func (param u32) (result u32)))
(type $t (func (param "a" u32) (result u32)))
(component $a
(core module $m
(func (export "add-five") (param i32) (result i32)

View File

@@ -26,7 +26,7 @@ fn can_compile() -> Result<()> {
&engine,
format!(
r#"(component
(import "" (func $f (param string)))
(import "" (func $f (param "a" string)))
{libc}
(core func (canon lower (func $f) (memory $libc "memory") (realloc (func $libc "realloc"))))
)"#
@@ -36,11 +36,11 @@ fn can_compile() -> Result<()> {
&engine,
format!(
r#"(component
(import "f1" (func $f1 (param string) (result string)))
(import "f1" (func $f1 (param "a" string) (result string)))
{libc}
(core func (canon lower (func $f1) (memory $libc "memory") (realloc (func $libc "realloc"))))
(import "f2" (func $f2 (param u32) (result (list u8))))
(import "f2" (func $f2 (param "a" u32) (result (list u8))))
(core instance $libc2 (instantiate $libc))
(core func (canon lower (func $f2) (memory $libc2 "memory") (realloc (func $libc2 "realloc"))))
@@ -53,7 +53,7 @@ fn can_compile() -> Result<()> {
&engine,
format!(
r#"(component
(import "log" (func $log (param string)))
(import "log" (func $log (param "a" string)))
{libc}
(core func $log_lower (canon lower (func $log) (memory $libc "memory") (realloc (func $libc "realloc"))))
@@ -84,7 +84,7 @@ fn can_compile() -> Result<()> {
fn simple() -> Result<()> {
let component = r#"
(component
(import "" (func $log (param string)))
(import "" (func $log (param "a" string)))
(core module $libc
(memory (export "memory") 1)
@@ -231,7 +231,7 @@ fn attempt_to_leave_during_malloc() -> Result<()> {
(func (export "run")
(canon lift (core func $m "run"))
)
(func (export "take-string") (param string)
(func (export "take-string") (param "a" string)
(canon lift (core func $m "take-string") (memory $m "memory") (realloc (func $m "realloc")))
)
)
@@ -395,10 +395,10 @@ fn stack_and_heap_args_and_rets() -> Result<()> {
string string string string
string string string string
string))
(import "f1" (func $f1 (param u32) (result u32)))
(import "f2" (func $f2 (param $many_params) (result u32)))
(import "f3" (func $f3 (param u32) (result string)))
(import "f4" (func $f4 (param $many_params) (result string)))
(import "f1" (func $f1 (param "a" u32) (result u32)))
(import "f2" (func $f2 (param "a" $many_params) (result u32)))
(import "f3" (func $f3 (param "a" u32) (result string)))
(import "f4" (func $f4 (param "a" $many_params) (result string)))
(core module $libc
{REALLOC_AND_FREE}
@@ -658,7 +658,7 @@ fn bad_import_alignment() -> Result<()> {
string string string string
string
))
(import "unaligned-argptr" (func $unaligned_argptr (param $many_arg)))
(import "unaligned-argptr" (func $unaligned_argptr (param "a" $many_arg)))
(core module $libc_panic
(memory (export "memory") 1)
(func (export "realloc") (param i32 i32 i32 i32) (result i32)

View File

@@ -109,10 +109,10 @@ fn thread_options_through_inner() -> Result<()> {
let component = format!(
r#"
(component
(import "hostfn" (func $host (param u32) (result string)))
(import "hostfn" (func $host (param "a" u32) (result string)))
(component $c
(import "hostfn" (func $host (param u32) (result string)))
(import "hostfn" (func $host (param "a" u32) (result string)))
(core module $libc
(memory (export "memory") 1)
@@ -144,7 +144,7 @@ fn thread_options_through_inner() -> Result<()> {
(with "libc" (instance $libc))
))
(func (export "run") (param u32) (result string)
(func (export "run") (param "a" u32) (result string)
(canon lift
(core func $m "run")
(memory $m "memory")

View File

@@ -103,7 +103,7 @@ fn test_roundtrip(engine: &Engine, src: &str, dst: &str) -> Result<()> {
format!(
r#"
(component {name}
(import "echo" (func $echo (param string) (result string)))
(import "echo" (func $echo (param "a" string) (result string)))
(core instance $libc (instantiate $libc))
(core func $echo (canon lower (func $echo)
(memory $libc "memory")
@@ -114,7 +114,7 @@ fn test_roundtrip(engine: &Engine, src: &str, dst: &str) -> Result<()> {
(with "libc" (instance $libc))
(with "" (instance (export "echo" (func $echo))))
))
(func (export "echo") (param string) (result string)
(func (export "echo") (param "a" string) (result string)
(canon lift
(core func $echo "echo")
(memory $libc "memory")
@@ -132,7 +132,7 @@ fn test_roundtrip(engine: &Engine, src: &str, dst: &str) -> Result<()> {
let component = format!(
r#"
(component
(import "host" (func $host (param string) (result string)))
(import "host" (func $host (param "a" string) (result string)))
(core module $libc
(memory (export "memory") 1)
@@ -213,14 +213,14 @@ fn test_ptr_out_of_bounds(engine: &Engine, src: &str, dst: &str) -> Result<()> {
(memory (export "memory") 1)
)
(core instance $m (instantiate $m))
(func (export "") (param string)
(func (export "") (param "a" string)
(canon lift (core func $m "") (realloc (func $m "realloc")) (memory $m "memory")
string-encoding={dst})
)
)
(component $c2
(import "" (func $f (param string)))
(import "" (func $f (param "a" string)))
(core module $libc
(memory (export "memory") 1)
)
@@ -281,14 +281,14 @@ fn test_ptr_overflow(engine: &Engine, src: &str, dst: &str) -> Result<()> {
(memory (export "memory") 1)
)
(core instance $m (instantiate $m))
(func (export "") (param string)
(func (export "") (param "a" string)
(canon lift (core func $m "") (realloc (func $m "realloc")) (memory $m "memory")
string-encoding={dst})
)
)
(component $c2
(import "" (func $f (param string)))
(import "" (func $f (param "a" string)))
(core module $libc
(memory (export "memory") 1)
)
@@ -300,7 +300,7 @@ fn test_ptr_overflow(engine: &Engine, src: &str, dst: &str) -> Result<()> {
(func (export "f") (param i32) (call $f (i32.const 1000) (local.get 0)))
)
(core instance $m (instantiate $m (with "" (instance (export "" (func $f))))))
(func (export "f") (param u32) (canon lift (core func $m "f")))
(func (export "f") (param "a" u32) (canon lift (core func $m "f")))
)
(instance $c (instantiate $c))
@@ -386,14 +386,14 @@ fn test_realloc_oob(engine: &Engine, src: &str, dst: &str) -> Result<()> {
(memory (export "memory") 1)
)
(core instance $m (instantiate $m))
(func (export "") (param string)
(func (export "") (param "a" string)
(canon lift (core func $m "") (realloc (func $m "realloc")) (memory $m "memory")
string-encoding={dst})
)
)
(component $c2
(import "" (func $f (param string)))
(import "" (func $f (param "a" string)))
(core module $libc
(memory (export "memory") 1)
)
@@ -534,14 +534,14 @@ fn test_raw_when_encoded(
(memory (export "memory") 1)
)
(core instance $m (instantiate $m))
(func (export "") (param string)
(func (export "") (param "a" string)
(canon lift (core func $m "") (realloc (func $m "realloc")) (memory $m "memory")
string-encoding={dst})
)
)
(component $c2
(import "" (func $f (param string)))
(import "" (func $f (param "a" string)))
(core module $libc
(memory (export "memory") 1)
(func (export "realloc") (param i32 i32 i32 i32) (result i32) i32.const 0)