Update the wasm-tools family of crates (#5310)

Most of the changes here are the updates to the component model which
includes optional URL fields in imports/exports.
This commit is contained in:
Alex Crichton
2022-11-21 15:37:16 -06:00
committed by GitHub
parent c74706aa59
commit b305f251fb
21 changed files with 331 additions and 127 deletions

View File

@@ -7,7 +7,7 @@
(func $foo (canon lift (core func $m "")))
(component $c
(import "" (func $foo))
(import "a" (func $foo))
(core func $foo (canon lower (func $foo)))
(core module $m2
@@ -17,7 +17,7 @@
(core instance $m2 (instantiate $m2 (with "" (instance (export "" (func $foo))))))
)
(instance $c (instantiate $c (with "" (func $foo))))
(instance $c (instantiate $c (with "a" (func $foo))))
)
;; boolean parameters
@@ -835,7 +835,7 @@
(func (export "s16") (param "a" s16) (canon lift (core func $m "s")))
)
(component $c2
(import "" (instance $i
(import "a" (instance $i
(export "u8" (func (param "a" u8)))
(export "s8" (func (param "a" s8)))
(export "u16" (func (param "a" u16)))
@@ -878,7 +878,7 @@
))
)
(instance $c1 (instantiate $c1))
(instance $c2 (instantiate $c2 (with "" (instance $c1))))
(instance $c2 (instantiate $c2 (with "a" (instance $c1))))
)
;; translation of locals between different types
@@ -956,7 +956,7 @@
(func (export "e") (type $func_e) (canon lift (core func $m "e")))
)
(component $c2
(import "" (instance $i
(import "a" (instance $i
(export "a" (func (type $func_a)))
(export "b" (func (type $func_b)))
(export "c" (func (type $func_c)))
@@ -1008,7 +1008,7 @@
))
)
(instance $c1 (instantiate $c1))
(instance $c2 (instantiate $c2 (with "" (instance $c1))))
(instance $c2 (instantiate $c2 (with "a" (instance $c1))))
)
;; different size variants
@@ -1063,7 +1063,7 @@
(func (export "a") (param "x" u8) (param "a" $a) (canon lift (core func $m "a")))
)
(component $c2
(import "" (instance $i
(import "a" (instance $i
(export "a" (func (param "x" u8) (param "a" $a)))
))
@@ -1111,7 +1111,7 @@
))
)
(instance $c1 (instantiate $c1))
(instance $c2 (instantiate $c2 (with "" (instance $c1))))
(instance $c2 (instantiate $c2 (with "a" (instance $c1))))
)
;; roundtrip some valid chars
@@ -1124,7 +1124,7 @@
(func (export "a") (param "a" char) (result char) (canon lift (core func $m "a")))
)
(component $c2
(import "" (instance $i
(import "a" (instance $i
(export "a" (func (param "a" char) (result char)))
))
@@ -1158,7 +1158,7 @@
(func (export "roundtrip") (param "a" char) (canon lift (core func $m "roundtrip")))
)
(instance $c1 (instantiate $c1))
(instance $c2 (instantiate $c2 (with "" (instance $c1))))
(instance $c2 (instantiate $c2 (with "a" (instance $c1))))
(export "roundtrip" (func $c2 "roundtrip"))
)
@@ -1176,7 +1176,7 @@
(func (export "a") (param "a" char) (canon lift (core func $m "a")))
)
(component $c2
(import "" (instance $i (export "a" (func (param "a" char)))))
(import "a" (instance $i (export "a" (func (param "a" char)))))
(core func $a (canon lower (func $i "a")))
(core module $m
(import "" "a" (func $a (param i32)))
@@ -1186,7 +1186,7 @@
(core instance (instantiate $m (with "" (instance (export "a" (func $a))))))
)
(instance $c1 (instantiate $c1))
(instance $c2 (instantiate $c2 (with "" (instance $c1))))
(instance $c2 (instantiate $c2 (with "a" (instance $c1))))
)
"unreachable")
(assert_trap
@@ -1197,7 +1197,7 @@
(func (export "a") (param "a" char) (canon lift (core func $m "a")))
)
(component $c2
(import "" (instance $i (export "a" (func (param "a" char)))))
(import "a" (instance $i (export "a" (func (param "a" char)))))
(core func $a (canon lower (func $i "a")))
(core module $m
(import "" "a" (func $a (param i32)))
@@ -1207,7 +1207,7 @@
(core instance (instantiate $m (with "" (instance (export "a" (func $a))))))
)
(instance $c1 (instantiate $c1))
(instance $c2 (instantiate $c2 (with "" (instance $c1))))
(instance $c2 (instantiate $c2 (with "a" (instance $c1))))
)
"unreachable")
(assert_trap
@@ -1218,7 +1218,7 @@
(func (export "a") (param "a" char) (canon lift (core func $m "a")))
)
(component $c2
(import "" (instance $i (export "a" (func (param "a" char)))))
(import "a" (instance $i (export "a" (func (param "a" char)))))
(core func $a (canon lower (func $i "a")))
(core module $m
(import "" "a" (func $a (param i32)))
@@ -1228,7 +1228,7 @@
(core instance (instantiate $m (with "" (instance (export "a" (func $a))))))
)
(instance $c1 (instantiate $c1))
(instance $c2 (instantiate $c2 (with "" (instance $c1))))
(instance $c2 (instantiate $c2 (with "a" (instance $c1))))
)
"unreachable")
@@ -1332,7 +1332,7 @@
(instance $c1 (instantiate $c1))
(component $c2
(import "" (instance $i
(import "a" (instance $i
(export "f0" (func (param "a" $f0)))
(export "f1" (func (param "a" $f1)))
(export "f8" (func (param "a" $f8)))
@@ -1397,7 +1397,7 @@
))
))
)
(instance (instantiate $c2 (with "" (instance $c1))))
(instance (instantiate $c2 (with "a" (instance $c1))))
)
;; Adapters are used slightly out-of-order here to stress the internals of

View File

@@ -70,7 +70,7 @@
;; Test to see if a component with a type export can be instantiated.
(component
(type string)
(export "" (type 0))
(export "a" (type 0))
)
;; double-check the start function runs by ensuring that a trap shows up and it

View File

@@ -330,8 +330,8 @@
)
(component $c1
(component $c2 (export "")
(component $c3 (export "")
(component $c2 (export "a")
(component $c3 (export "a")
(alias outer $C $m (core module $my_module))
(alias outer $C $c (component $my_component))
@@ -342,8 +342,8 @@
)
(instance $i1 (instantiate $c1))
(instance $i2 (instantiate (component $i1 "")))
(instance $i3 (instantiate (component $i2 "")))
(instance $i2 (instantiate (component $i1 "a")))
(instance $i3 (instantiate (component $i2 "a")))
(core instance $m1 (instantiate (module $i3 "m")))
(instance $c (instantiate (component $i3 "c")))
@@ -412,10 +412,10 @@
;; thread the host function through an instance
(component $c
(import "" (func $f (result u32)))
(import "a" (func $f (result u32)))
(export "f" (func $f))
)
(instance $c (instantiate $c (with "" (func $import))))
(instance $c (instantiate $c (with "a" (func $import))))
(alias export $c "f" (func $import2))
;; thread the host function into a nested component

View File

@@ -23,20 +23,20 @@
(assert_invalid
(component
(import "" (component))
(import "a" (component))
)
"root-level component imports are not supported")
(assert_invalid
(component
(component (export ""))
(component (export "a"))
)
"exporting a component from the root component is not supported")
(component
(core module $m (func (export "")))
(core instance $m (instantiate $m))
(func (export "") (canon lift (core func $m "")))
(func (export "a") (canon lift (core func $m "")))
)
(assert_return (invoke ""))
(assert_return (invoke "a"))

View File

@@ -8,13 +8,13 @@
(memory (export "memory") 1)
)
(core instance $m (instantiate $m))
(func (export "") (param "a" string)
(func (export "a") (param "a" string)
(canon lift (core func $m "") (realloc (func $m "realloc")) (memory $m "memory"))
)
)
(component $c2
(import "" (func $f (param "a" string)))
(import "a" (func $f (param "a" string)))
(core module $libc
(memory (export "memory") 1)
)
@@ -30,7 +30,7 @@
)
(instance $c (instantiate $c))
(instance $c2 (instantiate $c2 (with "" (func $c ""))))
(instance $c2 (instantiate $c2 (with "a" (func $c "a"))))
)
"unreachable")
@@ -44,13 +44,13 @@
(memory (export "memory") 1)
)
(core instance $m (instantiate $m))
(func (export "") (param "a" string)
(func (export "a") (param "a" string)
(canon lift (core func $m "") (realloc (func $m "realloc")) (memory $m "memory"))
)
)
(component $c2
(import "" (func $f (param "a" string)))
(import "a" (func $f (param "a" string)))
(core module $libc
(memory (export "memory") 1)
)
@@ -66,7 +66,7 @@
)
(instance $c (instantiate $c))
(instance $c2 (instantiate $c2 (with "" (func $c ""))))
(instance $c2 (instantiate $c2 (with "a" (func $c "a"))))
)
"unreachable")
@@ -80,14 +80,14 @@
(memory (export "memory") 1)
)
(core instance $m (instantiate $m))
(func (export "") (param "a" string)
(func (export "a") (param "a" string)
(canon lift (core func $m "") (realloc (func $m "realloc")) (memory $m "memory")
string-encoding=utf8)
)
)
(component $c2
(import "" (func $f (param "a" string)))
(import "a" (func $f (param "a" string)))
(core module $libc
(memory (export "memory") 1)
)
@@ -103,6 +103,6 @@
)
(instance $c (instantiate $c))
(instance $c2 (instantiate $c2 (with "" (func $c ""))))
(instance $c2 (instantiate $c2 (with "a" (func $c "a"))))
)
"unreachable")

View File

@@ -60,7 +60,7 @@
(type (instance))
(type (component
(import "" (func (type $empty)))
(import "x" (func (type $empty)))
(import "y" (func))
(import "z" (component))
@@ -71,7 +71,7 @@
))
(type (instance
(export "" (func (type $empty)))
(export "x" (func (type $empty)))
(export "y" (func))
(export "z" (component))
@@ -97,7 +97,7 @@
(component $C2
(alias outer $C $f (core type $my_f))
(import "" (core module (type $m)))
(import "a" (core module (type $m)))
(import "x" (core module
(alias outer $C2 $my_f (type $my_f))
(import "" "1" (func (type $my_f)))