diff options
author | Thomas Lively <tlively@google.com> | 2023-12-20 14:17:35 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-20 14:17:35 -0800 |
commit | fb7d00b336c8d682cbaaf02c96dab64b39d941ba (patch) | |
tree | 8b01240df861436fd0b74d2175155fa334f724bc /test/unit/input | |
parent | 2b81d39e133ff443c09837c7b0bf77e661d15345 (diff) | |
download | binaryen-fb7d00b336c8d682cbaaf02c96dab64b39d941ba.tar.gz binaryen-fb7d00b336c8d682cbaaf02c96dab64b39d941ba.tar.bz2 binaryen-fb7d00b336c8d682cbaaf02c96dab64b39d941ba.zip |
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.
Diffstat (limited to 'test/unit/input')
-rw-r--r-- | test/unit/input/asyncify-coroutine.wat | 7 | ||||
-rw-r--r-- | test/unit/input/asyncify-sleep.wat | 23 | ||||
-rw-r--r-- | test/unit/input/asyncify-stackOverflow.wat | 3 | ||||
-rw-r--r-- | test/unit/input/stack_ir.wat | 3 |
4 files changed, 16 insertions, 20 deletions
diff --git a/test/unit/input/asyncify-coroutine.wat b/test/unit/input/asyncify-coroutine.wat index ace97c6e6..1d46c1269 100644 --- a/test/unit/input/asyncify-coroutine.wat +++ b/test/unit/input/asyncify-coroutine.wat @@ -5,7 +5,7 @@ (import "env" "yield" (func $yield (param i32))) (export "memory" (memory 0)) ;; simple linear progression in a loop - (func "linear" (result i32) + (func $linear (export "linear") (result i32) (local $x i32) (loop $l (call $yield (local.get $x)) @@ -16,7 +16,7 @@ ) ) ;; exponential in a loop - (func "exponential" (result i32) + (func $exponential (export "exponential") (result i32) (local $x i32) (local.set $x (i32.const 1) @@ -30,7 +30,7 @@ ) ) ;; just some weird numbers, no loop - (func "weird" (result i32) + (func $weird (export "weird") (result i32) (call $yield (i32.const 42)) (call $yield (i32.const 1337)) (call $yield (i32.const 0)) @@ -41,4 +41,3 @@ (unreachable) ) ) - diff --git a/test/unit/input/asyncify-sleep.wat b/test/unit/input/asyncify-sleep.wat index 91fb5a327..6d54f5c07 100644 --- a/test/unit/input/asyncify-sleep.wat +++ b/test/unit/input/asyncify-sleep.wat @@ -8,17 +8,17 @@ (global $temp (mut i32) (i32.const 0)) (table 10 funcref) (elem (i32.const 5) $tablefunc) - (func "minimal" (result i32) + (func $minimal (export "minimal") (result i32) (call $sleep) (i32.const 21) ) - (func "repeat" (result i32) + (func $repeat (export "repeat") (result i32) ;; sleep twice, then return 42 (call $sleep) (call $sleep) (i32.const 42) ) - (func "local" (result i32) + (func $local (export "local") (result i32) (local $x i32) (local.set $x (i32.load (i32.const 0))) ;; a zero that the optimizer won't see (local.set $x @@ -27,7 +27,7 @@ (call $sleep) (local.get $x) ) - (func "local2" (result i32) + (func $local2 (export "local2") (result i32) (local $x i32) (local.set $x (i32.load (i32.const 0))) ;; a zero that the optimizer won't see (local.set $x @@ -39,7 +39,7 @@ ) (local.get $x) ) - (func "params" (param $x i32) (param $y i32) (result i32) + (func $params (export "params") (param $x i32) (param $y i32) (result i32) (local.set $x (i32.add (local.get $x) (i32.const 17)) ;; add 10 ) @@ -65,7 +65,7 @@ ) ) ) - (func "deeper" (param $x i32) (result i32) + (func $deeper (export "deeper") (param $x i32) (result i32) (call $pre) (call $inner (local.get $x)) (call $post) @@ -92,7 +92,7 @@ ) ) ) - (func "factorial-loop" (param $x i32) (result i32) + (func $factorial-loop (export "factorial-loop") (param $x i32) (result i32) (local $i i32) (local $ret i32) (local.set $ret (i32.const 1)) @@ -121,14 +121,14 @@ (br $l) ) ) - (func "end_tunnel" (param $x i32) (result i32) + (func $end_tunnel (export "end_tunnel") (param $x i32) (result i32) (local.set $x (i32.add (local.get $x) (i32.const 22)) ) (call $sleep) (i32.add (local.get $x) (i32.const 5)) ) - (func "do_tunnel" (param $x i32) (result i32) + (func $do_tunnel (export "do_tunnel") (param $x i32) (result i32) (local.set $x (i32.add (local.get $x) (i32.const 11)) ) @@ -145,7 +145,7 @@ (call $sleep) (i32.add (local.get $y) (i32.const 30)) ) - (func "call_indirect" (param $x i32) (param $y i32) (result i32) + (func $call_indirect (export "call_indirect") (param $x i32) (param $y i32) (result i32) (local.set $x (i32.add (local.get $x) (i32.const 1)) ) @@ -162,7 +162,7 @@ (call $sleep) (i32.add (local.get $y) (i32.const 300)) ;; total is 10+30+90+300=430 + y's original value ) - (func "if_else" (param $x i32) (param $y i32) (result i32) + (func $if_else (export "if_else") (param $x i32) (param $y i32) (result i32) (if (i32.eq (local.get $x) (i32.const 1)) (local.set $y (i32.add (local.get $y) (i32.const 10)) @@ -197,4 +197,3 @@ (local.get $y) ) ) - diff --git a/test/unit/input/asyncify-stackOverflow.wat b/test/unit/input/asyncify-stackOverflow.wat index a36a06b40..b838f2360 100644 --- a/test/unit/input/asyncify-stackOverflow.wat +++ b/test/unit/input/asyncify-stackOverflow.wat @@ -2,7 +2,7 @@ (memory 1 2) (import "env" "sleep" (func $sleep)) (export "memory" (memory 0)) - (func "many_locals" (param $x i32) (result i32) + (func $many_locals (export "many_locals") (param $x i32) (result i32) (local $y i32) (local $z i32) (local.set $y @@ -19,4 +19,3 @@ ) ) ) - diff --git a/test/unit/input/stack_ir.wat b/test/unit/input/stack_ir.wat index 0d5d0dfc3..6969052c9 100644 --- a/test/unit/input/stack_ir.wat +++ b/test/unit/input/stack_ir.wat @@ -1,6 +1,6 @@ (module (import "env" "bar" (func $bar (param i32) (result i32))) - (func "foo1" (result i32) + (func $foo1 (export "foo1") (result i32) (local $x i32) (local.set $x (call $bar (i32.const 0))) (drop @@ -9,4 +9,3 @@ (local.get $x) ;; local2stack can help here ) ) - |