From fb7d00b336c8d682cbaaf02c96dab64b39d941ba Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 20 Dec 2023 14:17:35 -0800 Subject: Drop support for non-standard quoted function names (#6188) We previously supported a non-standard `(func "name" ...` syntax for declaring functions exported with the quoted name. Since that is not part of the standard text format, drop support for it, replacing it with the standard `(func $name (export "name") ...` syntax instead. Also replace our other usage of the quoted form in our text output, which was where we quoted names containing characters that are not allowed to appear in standard names. To handle that case, adjust our output from `"$name"` to `$"name"`, which is the standards-track way of supporting such names. Also fix how we detect non-standard name characters to match the spec. Update the lit test output generation script to account for these changes, including by making the `$` prefix on names mandatory. This causes the script to stop interpreting declarative element segments with the `(elem declare ...` syntax as being named "declare", so prevent our generated output from regressing by counting "declare" as a name in the script. --- test/lit/passes/dae_all-features.wast | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'test/lit/passes/dae_all-features.wast') diff --git a/test/lit/passes/dae_all-features.wast b/test/lit/passes/dae_all-features.wast index dee38f646..17626c953 100644 --- a/test/lit/passes/dae_all-features.wast +++ b/test/lit/passes/dae_all-features.wast @@ -361,21 +361,20 @@ ) ) (module ;; both operations at once: remove params and return value - (func "a" + ;; CHECK: (type $0 (func)) + + ;; CHECK: (export "a" (func $a)) + + ;; CHECK: (func $a (type $0) + ;; CHECK-NEXT: (call $b) + ;; CHECK-NEXT: ) + (func $a (export "a") (drop (call $b (i32.const 1) ) ) ) - ;; CHECK: (type $0 (func)) - - ;; CHECK: (export "a" (func $0)) - - ;; CHECK: (func $0 (type $0) - ;; CHECK-NEXT: (call $b) - ;; CHECK-NEXT: ) - ;; CHECK: (func $b (type $0) ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (drop @@ -467,7 +466,7 @@ ;; CHECK: (elem declare func $0) - ;; CHECK: (export "export" (func $1)) + ;; CHECK: (export "export" (func $export)) ;; CHECK: (func $0 (type $0) (param $0 funcref) (param $1 i32) (param $2 f64) (result i64) ;; CHECK-NEXT: (nop) @@ -477,15 +476,15 @@ (nop) (unreachable) ) - (func "export" (param $0 f32) (result funcref) + ;; CHECK: (func $export (type $1) (param $0 f32) (result funcref) + ;; CHECK-NEXT: (ref.func $0) + ;; CHECK-NEXT: ) + (func $export (export "export") (param $0 f32) (result funcref) ;; a ref.func should prevent us from changing the type of a function, as it ;; may escape (ref.func $0) ) ) -;; CHECK: (func $1 (type $1) (param $0 f32) (result funcref) -;; CHECK-NEXT: (ref.func $0) -;; CHECK-NEXT: ) (module ;; CHECK: (type $i64 (func (param i64))) (type $i64 (func (param i64))) -- cgit v1.2.3