diff options
author | Ben Smith <binji@chromium.org> | 2020-04-14 08:47:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-14 08:47:42 -0700 |
commit | 10a9b0563efea0ab00abf6846c0ebcb53f492404 (patch) | |
tree | 7f328712e00ca50e7b7a90483e34d2803e29b811 /test | |
parent | 343d24bf620594c985065d193bde2c3fc282a53e (diff) | |
download | wabt-10a9b0563efea0ab00abf6846c0ebcb53f492404.tar.gz wabt-10a9b0563efea0ab00abf6846c0ebcb53f492404.tar.bz2 wabt-10a9b0563efea0ab00abf6846c0ebcb53f492404.zip |
Add exnref value type to parser (#1389)
The exnref type was already supported in the type checker, and other
parts of the code, but there was no way to name the type in the text
format.
This PR also fixes makes binary-reader.cc check for just the
exceptions_enabled flag to enable exnref. The exception-handling
proposal depends on the reference types proposal, but that is now
handled at a higher level, in the `UpdateDependencies` function.
Fixes issue #1388.
Diffstat (limited to 'test')
-rw-r--r-- | test/dump/br_on_exn.txt | 49 | ||||
-rw-r--r-- | test/dump/rethrow.txt | 33 | ||||
-rw-r--r-- | test/dump/throw.txt | 31 | ||||
-rw-r--r-- | test/dump/try-multi.txt | 75 | ||||
-rw-r--r-- | test/dump/try.txt | 45 | ||||
-rw-r--r-- | test/parse/func/local-exnref.txt | 3 | ||||
-rw-r--r-- | test/parse/func/param-exnref.txt | 3 | ||||
-rw-r--r-- | test/parse/func/result-exnref.txt | 3 | ||||
-rw-r--r-- | test/parse/module/global-exnref.txt | 3 |
9 files changed, 146 insertions, 99 deletions
diff --git a/test/dump/br_on_exn.txt b/test/dump/br_on_exn.txt index 8b62732d..7fab7497 100644 --- a/test/dump/br_on_exn.txt +++ b/test/dump/br_on_exn.txt @@ -43,30 +43,37 @@ 0000019: 00 ; event attribute 000001a: 00 ; event signature index 0000017: 03 ; FIXUP section size -; section "Code" (10) -000001b: 0a ; section code +; section "DataCount" (12) +000001b: 0c ; section code 000001c: 00 ; section size (guess) -000001d: 01 ; num functions +000001d: 00 ; data count +000001c: 01 ; FIXUP section size +; section "Code" (10) +000001e: 0a ; section code +000001f: 00 ; section size (guess) +0000020: 01 ; num functions ; function body 0 -000001e: 00 ; func body size (guess) -000001f: 00 ; local decl count -0000020: 02 ; block -0000021: 7f ; i32 -0000022: 06 ; try -0000023: 40 ; void -0000024: 07 ; catch -0000025: 0a ; br_on_exn -0000026: 01 ; break depth -0000027: 00 ; event index -0000028: 1a ; drop -0000029: 0b ; end -000002a: 41 ; i32.const -000002b: 00 ; i32 literal +0000021: 00 ; func body size (guess) +0000022: 00 ; local decl count +0000023: 02 ; block +0000024: 7f ; i32 +0000025: 06 ; try +0000026: 40 ; void +0000027: 07 ; catch +0000028: 0a ; br_on_exn +0000029: 01 ; break depth +000002a: 00 ; event index +000002b: 1a ; drop 000002c: 0b ; end -000002d: 1a ; drop -000002e: 0b ; end -000001e: 10 ; FIXUP func body size -000001c: 12 ; FIXUP section size +000002d: 41 ; i32.const +000002e: 00 ; i32 literal +000002f: 0b ; end +0000030: 1a ; drop +0000031: 0b ; end +0000021: 10 ; FIXUP func body size +000001f: 12 ; FIXUP section size +; move data: [1e, 32) -> [1b, 2f) +; truncate to 47 (0x2f) br_on_exn.wasm: file format wasm 0x1 diff --git a/test/dump/rethrow.txt b/test/dump/rethrow.txt index 2e039b43..8ed2c998 100644 --- a/test/dump/rethrow.txt +++ b/test/dump/rethrow.txt @@ -33,21 +33,28 @@ 0000015: 00 ; event attribute 0000016: 00 ; event signature index 0000013: 03 ; FIXUP section size -; section "Code" (10) -0000017: 0a ; section code +; section "DataCount" (12) +0000017: 0c ; section code 0000018: 00 ; section size (guess) -0000019: 01 ; num functions +0000019: 00 ; data count +0000018: 01 ; FIXUP section size +; section "Code" (10) +000001a: 0a ; section code +000001b: 00 ; section size (guess) +000001c: 01 ; num functions ; function body 0 -000001a: 00 ; func body size (guess) -000001b: 00 ; local decl count -000001c: 06 ; try -000001d: 40 ; void -000001e: 07 ; catch -000001f: 09 ; rethrow -0000020: 0b ; end -0000021: 0b ; end -000001a: 07 ; FIXUP func body size -0000018: 09 ; FIXUP section size +000001d: 00 ; func body size (guess) +000001e: 00 ; local decl count +000001f: 06 ; try +0000020: 40 ; void +0000021: 07 ; catch +0000022: 09 ; rethrow +0000023: 0b ; end +0000024: 0b ; end +000001d: 07 ; FIXUP func body size +000001b: 09 ; FIXUP section size +; move data: [1a, 25) -> [17, 22) +; truncate to 34 (0x22) rethrow.wasm: file format wasm 0x1 diff --git a/test/dump/throw.txt b/test/dump/throw.txt index 42a8d2c9..d0118709 100644 --- a/test/dump/throw.txt +++ b/test/dump/throw.txt @@ -36,20 +36,27 @@ 0000019: 00 ; event attribute 000001a: 00 ; event signature index 0000017: 03 ; FIXUP section size -; section "Code" (10) -000001b: 0a ; section code +; section "DataCount" (12) +000001b: 0c ; section code 000001c: 00 ; section size (guess) -000001d: 01 ; num functions +000001d: 00 ; data count +000001c: 01 ; FIXUP section size +; section "Code" (10) +000001e: 0a ; section code +000001f: 00 ; section size (guess) +0000020: 01 ; num functions ; function body 0 -000001e: 00 ; func body size (guess) -000001f: 00 ; local decl count -0000020: 41 ; i32.const -0000021: 01 ; i32 literal -0000022: 08 ; throw -0000023: 00 ; throw event -0000024: 0b ; end -000001e: 06 ; FIXUP func body size -000001c: 08 ; FIXUP section size +0000021: 00 ; func body size (guess) +0000022: 00 ; local decl count +0000023: 41 ; i32.const +0000024: 01 ; i32 literal +0000025: 08 ; throw +0000026: 00 ; throw event +0000027: 0b ; end +0000021: 06 ; FIXUP func body size +000001f: 08 ; FIXUP section size +; move data: [1e, 28) -> [1b, 25) +; truncate to 37 (0x25) throw.wasm: file format wasm 0x1 diff --git a/test/dump/try-multi.txt b/test/dump/try-multi.txt index 19181ecc..76fabdf3 100644 --- a/test/dump/try-multi.txt +++ b/test/dump/try-multi.txt @@ -49,43 +49,50 @@ 000001a: 00 ; function 0 signature index 000001b: 00 ; function 1 signature index 0000018: 03 ; FIXUP section size -; section "Code" (10) -000001c: 0a ; section code +; section "DataCount" (12) +000001c: 0c ; section code 000001d: 00 ; section size (guess) -000001e: 02 ; num functions +000001e: 00 ; data count +000001d: 01 ; FIXUP section size +; section "Code" (10) +000001f: 0a ; section code +0000020: 00 ; section size (guess) +0000021: 02 ; num functions ; function body 0 -000001f: 00 ; func body size (guess) -0000020: 00 ; local decl count -0000021: 06 ; try -0000022: 01 ; block type function index -0000023: 41 ; i32.const -0000024: 01 ; i32 literal -0000025: 41 ; i32.const -0000026: 02 ; i32 literal -0000027: 07 ; catch -0000028: 1a ; drop -0000029: 41 ; i32.const -000002a: 03 ; i32 literal -000002b: 41 ; i32.const -000002c: 04 ; i32 literal -000002d: 0b ; end -000002e: 0f ; return -000002f: 0b ; end -000001f: 10 ; FIXUP func body size +0000022: 00 ; func body size (guess) +0000023: 00 ; local decl count +0000024: 06 ; try +0000025: 01 ; block type function index +0000026: 41 ; i32.const +0000027: 01 ; i32 literal +0000028: 41 ; i32.const +0000029: 02 ; i32 literal +000002a: 07 ; catch +000002b: 1a ; drop +000002c: 41 ; i32.const +000002d: 03 ; i32 literal +000002e: 41 ; i32.const +000002f: 04 ; i32 literal +0000030: 0b ; end +0000031: 0f ; return +0000032: 0b ; end +0000022: 10 ; FIXUP func body size ; function body 1 -0000030: 00 ; func body size (guess) -0000031: 00 ; local decl count -0000032: 41 ; i32.const -0000033: 00 ; i32 literal -0000034: 06 ; try -0000035: 02 ; block type function index -0000036: 1a ; drop -0000037: 07 ; catch -0000038: 1a ; drop -0000039: 0b ; end -000003a: 0b ; end -0000030: 0a ; FIXUP func body size -000001d: 1d ; FIXUP section size +0000033: 00 ; func body size (guess) +0000034: 00 ; local decl count +0000035: 41 ; i32.const +0000036: 00 ; i32 literal +0000037: 06 ; try +0000038: 02 ; block type function index +0000039: 1a ; drop +000003a: 07 ; catch +000003b: 1a ; drop +000003c: 0b ; end +000003d: 0b ; end +0000033: 0a ; FIXUP func body size +0000020: 1d ; FIXUP section size +; move data: [1f, 3e) -> [1c, 3b) +; truncate to 59 (0x3b) try-multi.wasm: file format wasm 0x1 diff --git a/test/dump/try.txt b/test/dump/try.txt index 713a22e0..8c4edd29 100644 --- a/test/dump/try.txt +++ b/test/dump/try.txt @@ -28,27 +28,34 @@ 0000010: 01 ; num functions 0000011: 00 ; function 0 signature index 000000f: 02 ; FIXUP section size -; section "Code" (10) -0000012: 0a ; section code +; section "DataCount" (12) +0000012: 0c ; section code 0000013: 00 ; section size (guess) -0000014: 01 ; num functions +0000014: 00 ; data count +0000013: 01 ; FIXUP section size +; section "Code" (10) +0000015: 0a ; section code +0000016: 00 ; section size (guess) +0000017: 01 ; num functions ; function body 0 -0000015: 00 ; func body size (guess) -0000016: 00 ; local decl count -0000017: 06 ; try -0000018: 7f ; i32 -0000019: 01 ; nop -000001a: 41 ; i32.const -000001b: 07 ; i32 literal -000001c: 07 ; catch -000001d: 1a ; drop -000001e: 41 ; i32.const -000001f: 08 ; i32 literal -0000020: 0b ; end -0000021: 1a ; drop -0000022: 0b ; end -0000015: 0d ; FIXUP func body size -0000013: 0f ; FIXUP section size +0000018: 00 ; func body size (guess) +0000019: 00 ; local decl count +000001a: 06 ; try +000001b: 7f ; i32 +000001c: 01 ; nop +000001d: 41 ; i32.const +000001e: 07 ; i32 literal +000001f: 07 ; catch +0000020: 1a ; drop +0000021: 41 ; i32.const +0000022: 08 ; i32 literal +0000023: 0b ; end +0000024: 1a ; drop +0000025: 0b ; end +0000018: 0d ; FIXUP func body size +0000016: 0f ; FIXUP section size +; move data: [15, 26) -> [12, 23) +; truncate to 35 (0x23) try.wasm: file format wasm 0x1 diff --git a/test/parse/func/local-exnref.txt b/test/parse/func/local-exnref.txt new file mode 100644 index 00000000..6330ca00 --- /dev/null +++ b/test/parse/func/local-exnref.txt @@ -0,0 +1,3 @@ +;;; TOOL: wat2wasm +;;; ARGS: --enable-exceptions +(module (func (local exnref))) diff --git a/test/parse/func/param-exnref.txt b/test/parse/func/param-exnref.txt new file mode 100644 index 00000000..44aa8bd8 --- /dev/null +++ b/test/parse/func/param-exnref.txt @@ -0,0 +1,3 @@ +;;; TOOL: wat2wasm +;;; ARGS: --enable-exceptions +(module (func (param exnref))) diff --git a/test/parse/func/result-exnref.txt b/test/parse/func/result-exnref.txt new file mode 100644 index 00000000..c104ee0b --- /dev/null +++ b/test/parse/func/result-exnref.txt @@ -0,0 +1,3 @@ +;;; TOOL: wat2wasm +;;; ARGS: --enable-exceptions +(module (func (result exnref) ref.null)) diff --git a/test/parse/module/global-exnref.txt b/test/parse/module/global-exnref.txt new file mode 100644 index 00000000..4e5d3931 --- /dev/null +++ b/test/parse/module/global-exnref.txt @@ -0,0 +1,3 @@ +;;; TOOL: wat2wasm +;;; ARGS: --enable-exceptions +(module (global exnref (ref.null))) |