Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 13 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -769,3 +769,18 @@ fpr = "fpr"

[workspace.metadata.typos.files]
extend-exclude = [ "docs/js/mermaid*.js", "crates/wasi-nn/**/*.txt", "*.isle" ]

[patch.crates-io]
wasmparser = { git = 'https://github.com/alexcrichton/wasm-tools', branch = 'gate-async-on-sync-type' }
wat = { git = 'https://github.com/alexcrichton/wasm-tools', branch = 'gate-async-on-sync-type' }
wast = { git = 'https://github.com/alexcrichton/wasm-tools', branch = 'gate-async-on-sync-type' }
wasmprinter = { git = 'https://github.com/alexcrichton/wasm-tools', branch = 'gate-async-on-sync-type' }
wasm-encoder = { git = 'https://github.com/alexcrichton/wasm-tools', branch = 'gate-async-on-sync-type' }
wasm-smith = { git = 'https://github.com/alexcrichton/wasm-tools', branch = 'gate-async-on-sync-type' }
wasm-mutate = { git = 'https://github.com/alexcrichton/wasm-tools', branch = 'gate-async-on-sync-type' }
wit-parser = { git = 'https://github.com/alexcrichton/wasm-tools', branch = 'gate-async-on-sync-type' }
wit-component = { git = 'https://github.com/alexcrichton/wasm-tools', branch = 'gate-async-on-sync-type' }
wasm-wave = { git = 'https://github.com/alexcrichton/wasm-tools', branch = 'gate-async-on-sync-type' }
wasm-compose = { git = 'https://github.com/alexcrichton/wasm-tools', branch = 'gate-async-on-sync-type' }
wasm-metadata = { git = 'https://github.com/alexcrichton/wasm-tools', branch = 'gate-async-on-sync-type' }
json-from-wast = { git = 'https://github.com/alexcrichton/wasm-tools', branch = 'gate-async-on-sync-type' }
3 changes: 3 additions & 0 deletions crates/test-util/src/wast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,9 @@ impl WastTest {
// memory64.
"test/wasm-tools/memory64.wast",
"test/wasm-tools/resources.wast",
// Not updated upstream yet
"test/async/cross-abi-calls.wast",
"test/async/trap-on-reenter.wast",
];
if unsupported.iter().any(|part| self.path.ends_with(part)) {
return true;
Expand Down
2 changes: 1 addition & 1 deletion tests/all/component_model/async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,7 @@ async fn drop_deadlocked_typed_future() -> Result<()> {
(func (export "set-backpressure")
(canon lift (core func $i "set-backpressure")))

(func (export "target")
(func (export "target") async
(canon lift (core func $i "target") async (callback (func $i "callback"))))
)
"#,
Expand Down
2 changes: 1 addition & 1 deletion tests/all/component_model/bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ mod no_imports_concurrent {
(with "" (instance (export "task.return" (func $task-return))))
))

(func $f (export "bar")
(func $f (export "bar") async
(canon lift (core func $i "bar") async (callback (func $i "callback")))
)

Expand Down
26 changes: 13 additions & 13 deletions tests/all/component_model/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -827,12 +827,12 @@ async fn async_reentrance() -> Result<()> {
(core instance $shim (instantiate $shim
(with "" (instance (export "task.return" (func $task-return))))
))
(func $shim-export (param "p1" u32) (result u32)
(func $shim-export async (param "p1" u32) (result u32)
(canon lift (core func $shim "export") async (callback (func $shim "callback")))
)

(component $inner
(import "import" (func $import (param "p1" u32) (result u32)))
(import "import" (func $import async (param "p1" u32) (result u32)))
(core module $libc (memory (export "memory") 1))
(core instance $libc (instantiate $libc))
(core func $import (canon lower (func $import) async (memory $libc "memory")))
Expand All @@ -859,7 +859,7 @@ async fn async_reentrance() -> Result<()> {
))
(with "libc" (instance $libc))
))
(func (export "export") (param "p1" u32) (result u32)
(func (export "export") async (param "p1" u32) (result u32)
(canon lift (core func $i "export") async (callback (func $i "callback")))
)
)
Expand Down Expand Up @@ -897,7 +897,7 @@ async fn async_reentrance() -> Result<()> {
))
(with "libc" (instance $libc))
))
(func (export "export") (param "p1" u32) (result u32)
(func (export "export") async (param "p1" u32) (result u32)
(canon lift (core func $donut "export") async (callback (func $donut "callback")))
)
)"#;
Expand Down Expand Up @@ -946,7 +946,7 @@ async fn missing_task_return_call_stackless() -> Result<()> {
(core instance $i (instantiate $m
(with "" (instance (export "task.return" (func $task-return))))
))
(func (export "foo") (canon lift (core func $i "foo") async (callback (func $i "callback"))))
(func (export "foo") async (canon lift (core func $i "foo") async (callback (func $i "callback"))))
)"#,
"wasm trap: async-lifted export failed to produce a result",
)
Expand Down Expand Up @@ -988,7 +988,7 @@ async fn missing_task_return_call_stackless_explicit_thread() -> Result<()> {
))
(with "libc" (instance $libc))
))
(func (export "foo") (canon lift (core func $i "foo") async (callback (func $i "callback"))))
(func (export "foo") async (canon lift (core func $i "foo") async (callback (func $i "callback"))))
)"#,
"wasm trap: async-lifted export failed to produce a result",
)
Expand Down Expand Up @@ -1028,7 +1028,7 @@ async fn missing_task_return_call_stackful_explicit_thread() -> Result<()> {
))
(with "libc" (instance $libc))
))
(func (export "foo") (canon lift (core func $i "foo") async))
(func (export "foo") async (canon lift (core func $i "foo") async))
)"#,
"wasm trap: async-lifted export failed to produce a result",
)
Expand All @@ -1047,7 +1047,7 @@ async fn missing_task_return_call_stackful() -> Result<()> {
(core instance $i (instantiate $m
(with "" (instance (export "task.return" (func $task-return))))
))
(func (export "foo") (canon lift (core func $i "foo") async))
(func (export "foo") async (canon lift (core func $i "foo") async))
)"#,
"wasm trap: async-lifted export failed to produce a result",
)
Expand All @@ -1066,7 +1066,7 @@ async fn task_return_type_mismatch() -> Result<()> {
(core instance $i (instantiate $m
(with "" (instance (export "task.return" (func $task-return))))
))
(func (export "foo") (canon lift (core func $i "foo") async))
(func (export "foo") async (canon lift (core func $i "foo") async))
)"#,
"invalid `task.return` signature and/or options for current task",
)
Expand All @@ -1087,7 +1087,7 @@ async fn task_return_memory_mismatch() -> Result<()> {
(core instance $i (instantiate $m
(with "" (instance (export "task.return" (func $task-return))))
))
(func (export "foo") (canon lift (core func $i "foo") async))
(func (export "foo") async (canon lift (core func $i "foo") async))
)"#,
"invalid `task.return` signature and/or options for current task",
)
Expand All @@ -1106,7 +1106,7 @@ async fn task_return_string_encoding_mismatch() -> Result<()> {
(core instance $i (instantiate $m
(with "" (instance (export "task.return" (func $task-return))))
))
(func (export "foo") (canon lift (core func $i "foo") async))
(func (export "foo") async (canon lift (core func $i "foo") async))
)"#,
"invalid `task.return` signature and/or options for current task",
)
Expand Down Expand Up @@ -1244,7 +1244,7 @@ async fn test_many_parameters(dynamic: bool, concurrent: bool) -> Result<()> {
(with "libc" (instance $libc))
))

(type $t (func
(type $t (func async
(param "p1" s8) ;; offset 0, size 1
(param "p2" u64) ;; offset 8, size 8
(param "p3" float32) ;; offset 16, size 4
Expand Down Expand Up @@ -1715,7 +1715,7 @@ async fn test_many_results(dynamic: bool, concurrent: bool) -> Result<()> {
(with "libc" (instance $libc))
))

(type $t (func (result $tuple)))
(type $t (func async (result $tuple)))
(func (export "many-results") (type $t)
(canon lift
(core func $i "foo")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,60 +33,60 @@
))

(func (export "turn-on-backpressure") (canon lift (core func $i "turn-on-backpressure")))
(func (export "f")
(func (export "f") async
(canon lift (core func $i "f") async (callback (func $i "callback"))))
)
(instance $A (instantiate $A))

(component $B
(import "A" (instance $A
(export "f" (func))
(export "f" (func async))
(export "turn-on-backpressure" (func))
))

(core module $libc (memory (export "mem") 1))
(core instance $libc (instantiate $libc))

(core func $f (canon lower (func $A "f") async (memory $libc "mem")))
(core func $turn-on-backpressure (canon lower (func $A "turn-on-backpressure")))
(core func $waitable-set.new (canon waitable-set.new))
(core func $waitable.join (canon waitable.join))
(core func $waitable-set.wait (canon waitable-set.wait (memory $libc "mem")))

(core module $m
(import "" "f" (func $f (result i32)))
(import "" "turn-on-backpressure" (func $turn-on-backpressure))
(import "" "waitable-set.new" (func $waitable-set.new (result i32)))
(import "" "waitable.join" (func $waitable.join (param i32 i32)))
(import "" "waitable-set.wait" (func $waitable-set.wait (param i32 i32) (result i32)))

(func (export "f")
(local $status i32)
(local $set i32)
call $turn-on-backpressure

(local.set $status (call $f))

;; low 4 bits should be "STARTING == 0"
(i32.ne
(i32.const 0)
(i32.and
(local.get $status)
(i32.const 0xf)))
if unreachable end

;; make a new waitable set and join our subtask into it
(local.set $set (call $waitable-set.new))
(call $waitable.join
(i32.shr_u (local.get $status) (i32.const 4))
(local.get $set))

;; block waiting for our task, which should deadlock (?)
(call $waitable-set.wait (local.get $set) (i32.const 0))
unreachable
)
)

(core instance $i (instantiate $m
(with "" (instance
(export "f" (func $f))
Expand All @@ -96,13 +96,13 @@
(export "waitable-set.wait" (func $waitable-set.wait))
))
))

(func (export "f") async (canon lift (core func $i "f")))
)

(instance $B (instantiate $B (with "A" (instance $A))))

(func (export "f") (alias export $B "f"))
(func (export "f") (alias export $B "f"))
)

(assert_trap (invoke "f") "deadlock detected")
Loading
Loading