diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/lit/basic/typed_continuations_contnew.wast | 69 | ||||
-rw-r--r-- | test/lit/wat-kitchen-sink.wast | 32 |
2 files changed, 91 insertions, 10 deletions
diff --git a/test/lit/basic/typed_continuations_contnew.wast b/test/lit/basic/typed_continuations_contnew.wast new file mode 100644 index 000000000..c0539cb9a --- /dev/null +++ b/test/lit/basic/typed_continuations_contnew.wast @@ -0,0 +1,69 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. + +;; RUN: wasm-opt %s -all -o %t.text.wast -g -S +;; RUN: wasm-as %s -all -g -o %t.wasm +;; RUN: wasm-dis %t.wasm -all -o %t.bin.wast +;; RUN: wasm-as %s -all -o %t.nodebug.wasm +;; RUN: wasm-dis %t.nodebug.wasm -all -o %t.bin.nodebug.wast +;; RUN: cat %t.text.wast | filecheck %s --check-prefix=CHECK-TEXT +;; RUN: cat %t.bin.wast | filecheck %s --check-prefix=CHECK-BIN +;; RUN: cat %t.bin.nodebug.wast | filecheck %s --check-prefix=CHECK-BIN-NODEBUG + +(module + ;; CHECK-TEXT: (type $ft (func (param i32) (result i32))) + ;; CHECK-BIN: (type $ft (func (param i32) (result i32))) + (type $ft (func (param i32) (result i32))) + ;; CHECK-TEXT: (type $ct (cont $ft)) + ;; CHECK-BIN: (type $ct (cont $ft)) + (type $ct (cont $ft)) + + ;; CHECK-TEXT: (type $2 (func (result (ref $ct)))) + + ;; CHECK-TEXT: (elem declare func $g) + + ;; CHECK-TEXT: (func $g (type $ft) (param $0 i32) (result i32) + ;; CHECK-TEXT-NEXT: (i32.const 123) + ;; CHECK-TEXT-NEXT: ) + ;; CHECK-BIN: (type $2 (func (result (ref $ct)))) + + ;; CHECK-BIN: (elem declare func $g) + + ;; CHECK-BIN: (func $g (type $ft) (param $0 i32) (result i32) + ;; CHECK-BIN-NEXT: (i32.const 123) + ;; CHECK-BIN-NEXT: ) + (func $g (param i32) (result i32) + (i32.const 123) + ) + ;; CHECK-BIN-NODEBUG: (type $0 (func (param i32) (result i32))) + + ;; CHECK-BIN-NODEBUG: (type $1 (cont $0)) + + ;; CHECK-BIN-NODEBUG: (type $2 (func (result (ref $1)))) + + ;; CHECK-BIN-NODEBUG: (elem declare func $0) + (elem declare func $g) + + ;; CHECK-TEXT: (func $h (type $2) (result (ref $ct)) + ;; CHECK-TEXT-NEXT: (cont.new $ct + ;; CHECK-TEXT-NEXT: (ref.func $g) + ;; CHECK-TEXT-NEXT: ) + ;; CHECK-TEXT-NEXT: ) + ;; CHECK-BIN: (func $h (type $2) (result (ref $ct)) + ;; CHECK-BIN-NEXT: (cont.new $ct + ;; CHECK-BIN-NEXT: (ref.func $g) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + (func $h (result (ref $ct)) + (cont.new $ct (ref.func $g)) + ) + +) +;; CHECK-BIN-NODEBUG: (func $0 (type $0) (param $0 i32) (result i32) +;; CHECK-BIN-NODEBUG-NEXT: (i32.const 123) +;; CHECK-BIN-NODEBUG-NEXT: ) + +;; CHECK-BIN-NODEBUG: (func $1 (type $2) (result (ref $1)) +;; CHECK-BIN-NODEBUG-NEXT: (cont.new $1 +;; CHECK-BIN-NODEBUG-NEXT: (ref.func $0) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/wat-kitchen-sink.wast b/test/lit/wat-kitchen-sink.wast index 770c08665..c0c35acf7 100644 --- a/test/lit/wat-kitchen-sink.wast +++ b/test/lit/wat-kitchen-sink.wast @@ -27,6 +27,10 @@ ;; CHECK: (type $9 (func (param i32 i64 v128))) + ;; CHECK: (type $simple (func (param i32 i64) (result f32))) + + ;; CHECK: (type $simple-cont (cont $simple)) + ;; CHECK: (rec ;; CHECK-NEXT: (type $s0 (struct )) (type $s0 (struct)) @@ -36,20 +40,16 @@ (rec) - ;; CHECK: (type $12 (func)) + ;; CHECK: (type $14 (func)) ;; CHECK: (type $packed-i8 (array (mut i8))) ;; CHECK: (type $many (sub (func (param i32 i64 f32 f64) (result anyref (ref func))))) - ;; CHECK: (type $15 (func (param i32))) + ;; CHECK: (type $17 (func (param i32))) ;; CHECK: (type $a0 (array i32)) - ;; CHECK: (type $simple (func (param i32 i64) (result f32))) - - ;; CHECK: (type $simple-cont (cont $simple)) - ;; CHECK: (type $19 (func (param i32 i64) (result i32 i64))) ;; CHECK: (type $20 (func (result exnref))) @@ -190,6 +190,8 @@ ;; CHECK: (type $to-f32-cont (cont $to-f32)) + ;; CHECK: (type $89 (func (param (ref $simple)) (result (ref $simple-cont)))) + ;; CHECK: (type $s2 (struct (field i32))) (type $s2 (struct i32)) ;; CHECK: (type $s3 (struct (field i64))) @@ -258,7 +260,7 @@ ;; imported memories (memory (export "mem") (export "mem2") (import "" "mem") 0) - ;; CHECK: (type $100 (func (param (ref $s0) (ref $s1) (ref $s2) (ref $s3) (ref $s4) (ref $s5) (ref $s6) (ref $s7) (ref $s8) (ref $a0) (ref $a1) (ref $a2) (ref $a3) (ref $subvoid) (ref $submany) (ref $all-types)))) + ;; CHECK: (type $101 (func (param (ref $s0) (ref $s1) (ref $s2) (ref $s3) (ref $s4) (ref $s5) (ref $s6) (ref $s7) (ref $s8) (ref $a0) (ref $a1) (ref $a2) (ref $a3) (ref $subvoid) (ref $submany) (ref $all-types)))) ;; CHECK: (import "" "mem" (memory $mimport$0 0)) @@ -468,11 +470,11 @@ ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) - ;; CHECK: (func $f1 (type $15) (param $0 i32) + ;; CHECK: (func $f1 (type $17) (param $0 i32) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $f1 (param i32)) - ;; CHECK: (func $f2 (type $15) (param $x i32) + ;; CHECK: (func $f2 (type $17) (param $x i32) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $f2 (param $x i32)) @@ -5080,7 +5082,17 @@ br 0 ) - ;; CHECK: (func $use-types (type $100) (param $0 (ref $s0)) (param $1 (ref $s1)) (param $2 (ref $s2)) (param $3 (ref $s3)) (param $4 (ref $s4)) (param $5 (ref $s5)) (param $6 (ref $s6)) (param $7 (ref $s7)) (param $8 (ref $s8)) (param $9 (ref $a0)) (param $10 (ref $a1)) (param $11 (ref $a2)) (param $12 (ref $a3)) (param $13 (ref $subvoid)) (param $14 (ref $submany)) (param $15 (ref $all-types)) + ;; CHECK: (func $contnew (type $89) (param $f (ref $simple)) (result (ref $simple-cont)) + ;; CHECK-NEXT: (cont.new $simple-cont + ;; CHECK-NEXT: (local.get $f) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $contnew (param $f (ref $simple)) (result (ref $simple-cont)) + local.get $f + cont.new $simple-cont + ) + + ;; CHECK: (func $use-types (type $101) (param $0 (ref $s0)) (param $1 (ref $s1)) (param $2 (ref $s2)) (param $3 (ref $s3)) (param $4 (ref $s4)) (param $5 (ref $s5)) (param $6 (ref $s6)) (param $7 (ref $s7)) (param $8 (ref $s8)) (param $9 (ref $a0)) (param $10 (ref $a1)) (param $11 (ref $a2)) (param $12 (ref $a3)) (param $13 (ref $subvoid)) (param $14 (ref $submany)) (param $15 (ref $all-types)) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $use-types |