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/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/strings.wast')
-rw-r--r-- | test/lit/strings.wast | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/test/lit/strings.wast b/test/lit/strings.wast index 63139d900..1e38ff894 100644 --- a/test/lit/strings.wast +++ b/test/lit/strings.wast @@ -22,19 +22,21 @@ ;; CHECK: (type $array (array (mut i8))) (type $array (array_subtype (mut i8) data)) - ;; CHECK: (type $none_=>_none (func)) - ;; CHECK: (type $array16 (array (mut i16))) (type $array16 (array_subtype (mut i16) data)) ;; CHECK: (type $stringref_stringview_wtf8_stringview_wtf16_stringview_iter_stringref_stringview_wtf8_stringview_wtf16_stringview_iter_ref|string|_ref|stringview_wtf8|_ref|stringview_wtf16|_ref|stringview_iter|_=>_none (func (param stringref stringview_wtf8 stringview_wtf16 stringview_iter stringref stringview_wtf8 stringview_wtf16 stringview_iter (ref string) (ref stringview_wtf8) (ref stringview_wtf16) (ref stringview_iter)))) + ;; CHECK: (type $ref|string|_=>_none (func (param (ref string)))) + ;; CHECK: (type $stringview_wtf16_=>_none (func (param stringview_wtf16))) ;; CHECK: (type $ref|$array|_ref|$array16|_=>_none (func (param (ref $array) (ref $array16)))) ;; CHECK: (type $stringref_ref|$array|_ref|$array16|_=>_none (func (param stringref (ref $array) (ref $array16)))) + ;; CHECK: (type $none_=>_none (func)) + ;; CHECK: (type $ref|$array|_=>_none (func (param (ref $array)))) ;; CHECK: (type $stringref_=>_i32 (func (param stringref) (result i32))) @@ -109,25 +111,26 @@ ) ) - ;; CHECK: (func $string.const (type $none_=>_none) - ;; CHECK-NEXT: (drop + ;; CHECK: (func $string.const (type $ref|string|_=>_none) (param $param (ref string)) + ;; CHECK-NEXT: (call $string.const ;; CHECK-NEXT: (string.const "foo") ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (call $string.const ;; CHECK-NEXT: (string.const "foo") ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (call $string.const ;; CHECK-NEXT: (string.const "bar") ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - (func $string.const - (drop + (func $string.const (param $param (ref string)) + ;; Use calls to avoid precompute removing dropped constants. + (call $string.const (string.const "foo") ) - (drop + (call $string.const (string.const "foo") ;; intentionally repeat the previous one ) - (drop + (call $string.const (string.const "bar") ) ) |