diff options
author | Alon Zakai <azakai@google.com> | 2023-02-15 18:21:26 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-15 18:21:26 -0800 |
commit | 670b73681c56a42930f65c7a293a062e168c39fc (patch) | |
tree | 47bda97e22a789338e25a817d44531ddfe405d8e /test/lit/passes/precompute-gc.wast | |
parent | c4d15efc62fb6e6b55dd128e62896c93ca52c98a (diff) | |
download | binaryen-670b73681c56a42930f65c7a293a062e168c39fc.tar.gz binaryen-670b73681c56a42930f65c7a293a062e168c39fc.tar.bz2 binaryen-670b73681c56a42930f65c7a293a062e168c39fc.zip |
[Strings] Initial string execution support (#5491)
Store string data as GC data. Inefficient (one Const per char), but ok for now.
Implement string.new_wtf16 and string.const, enough for basic testing.
Create strings in makeConstantExpression, which enables ctor-eval support.
Print strings in fuzz-exec which makes testing easier.
Diffstat (limited to 'test/lit/passes/precompute-gc.wast')
-rw-r--r-- | test/lit/passes/precompute-gc.wast | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/lit/passes/precompute-gc.wast b/test/lit/passes/precompute-gc.wast index f53ced968..0c5b9f8b8 100644 --- a/test/lit/passes/precompute-gc.wast +++ b/test/lit/passes/precompute-gc.wast @@ -23,6 +23,8 @@ ;; NOMNL: (type $B (struct (field (mut f64)))) (type $B (struct (field (mut f64)))) + (type $array16 (array (mut i16))) + (type $func-return-i32 (func (result i32))) ;; CHECK: (import "fuzzing-support" "log-i32" (func $log (param i32))) @@ -1429,4 +1431,42 @@ ) ) ) + + ;; CHECK: (func $strings (type $ref|string|_=>_none) (param $param (ref string)) + ;; CHECK-NEXT: (local $s (ref string)) + ;; CHECK-NEXT: (local.set $s + ;; CHECK-NEXT: (string.const "hello, world") + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (call $strings + ;; CHECK-NEXT: (string.const "hello, world") + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (call $strings + ;; CHECK-NEXT: (string.const "hello, world") + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; NOMNL: (func $strings (type $ref|string|_=>_none) (param $param (ref string)) + ;; NOMNL-NEXT: (local $s (ref string)) + ;; NOMNL-NEXT: (local.set $s + ;; NOMNL-NEXT: (string.const "hello, world") + ;; NOMNL-NEXT: ) + ;; NOMNL-NEXT: (call $strings + ;; NOMNL-NEXT: (string.const "hello, world") + ;; NOMNL-NEXT: ) + ;; NOMNL-NEXT: (call $strings + ;; NOMNL-NEXT: (string.const "hello, world") + ;; NOMNL-NEXT: ) + ;; NOMNL-NEXT: ) + (func $strings (param $param (ref string)) + (local $s (ref string)) + (local.set $s + (string.const "hello, world") + ) + ;; The constant string should be propagated twice, to both of these calls. + (call $strings + (local.get $s) + ) + (call $strings + (local.get $s) + ) + ) ) |