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/exec/strings.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/exec/strings.wast')
-rw-r--r-- | test/lit/exec/strings.wast | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/lit/exec/strings.wast b/test/lit/exec/strings.wast new file mode 100644 index 000000000..2852337c8 --- /dev/null +++ b/test/lit/exec/strings.wast @@ -0,0 +1,36 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --output=fuzz-exec and should not be edited. + +;; RUN: wasm-opt %s -all --fuzz-exec -q -o /dev/null 2>&1 | filecheck %s + +(module + (type $array16 (array (mut i16))) + + ;; CHECK: [fuzz-exec] calling new_wtf16_array + ;; CHECK-NEXT: [fuzz-exec] note result: new_wtf16_array => string("ello") + (func "new_wtf16_array" (result stringref) + (string.new_wtf16_array + (array.init_static $array16 + (i32.const 104) ;; h + (i32.const 101) ;; e + (i32.const 108) ;; l + (i32.const 108) ;; l + (i32.const 111) ;; o + ) + (i32.const 1) ;; start from index 1, to chop off the 'h' + (i32.const 5) + ) + ) + + ;; CHECK: [fuzz-exec] calling const + ;; CHECK-NEXT: [fuzz-exec] note result: const => string("world") + (func "const" (result stringref) + (string.const "world") + ) +) +;; CHECK: [fuzz-exec] calling new_wtf16_array +;; CHECK-NEXT: [fuzz-exec] note result: new_wtf16_array => string("ello") + +;; CHECK: [fuzz-exec] calling const +;; CHECK-NEXT: [fuzz-exec] note result: const => string("world") +;; CHECK-NEXT: [fuzz-exec] comparing const +;; CHECK-NEXT: [fuzz-exec] comparing new_wtf16_array |