From 670b73681c56a42930f65c7a293a062e168c39fc Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 15 Feb 2023 18:21:26 -0800 Subject: [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. --- test/lit/passes/precompute-gc.wast | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'test/lit/passes/precompute-gc.wast') 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) + ) + ) ) -- cgit v1.2.3