-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests/misc_testsuite/component-model-async/fused.wast
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
- Loading branch information
Showing
2 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
;;! component_model_async = true | ||
|
||
;; async lower -> async lift | ||
(component | ||
(component $lifter | ||
(core module $m | ||
(import "" "task.return" (func $task-return (param i32))) | ||
(func (export "foo") (param i32) (call $task-return (local.get 0))) | ||
) | ||
(core type $task-return (func (param i32))) | ||
(core func $task-return (canon task.return $task-return)) | ||
(core instance $i (instantiate $m | ||
(with "" (instance (export "task.return" (func $task-return)))) | ||
)) | ||
|
||
(func (export "foo") (param "p1" u32) (result u32) | ||
(canon lift (core func $i "foo") async) | ||
) | ||
) | ||
|
||
(component $lowerer | ||
(import "a" (func $foo (param "p1" u32) (result u32))) | ||
(core module $libc (memory (export "memory") 1)) | ||
(core instance $libc (instantiate $libc)) | ||
(core func $foo (canon lower (func $foo) async (memory $libc "memory"))) | ||
(core module $m | ||
(import "libc" "memory" (memory 1)) | ||
(import "" "foo" (func $foo (param i32 i32) (result i32))) | ||
(func (export "run") | ||
block | ||
(i32.store offset=0 (i32.const 1200) (i32.const 42)) | ||
(call $foo (i32.const 1200) (i32.const 1204)) | ||
(i32.eq (i32.load offset=0 (i32.const 1204)) (i32.const 42)) | ||
br_if 0 | ||
unreachable | ||
end | ||
) | ||
) | ||
(core instance $i (instantiate $m | ||
(with "libc" (instance $libc)) | ||
(with "" (instance (export "foo" (func $foo)))) | ||
)) | ||
(func (export "run") (canon lift (core func $i "run"))) | ||
) | ||
|
||
(instance $lifter (instantiate $lifter)) | ||
(instance $lowerer (instantiate $lowerer (with "a" (func $lifter "foo")))) | ||
(func (export "run") (alias export $lowerer "run")) | ||
) | ||
|
||
;; TODO: this requires async support in `wasmtime-wast`: | ||
;;(assert_return (invoke "run")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters