diff options
author | Ben Smith <binjimin@gmail.com> | 2018-03-02 17:48:10 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-02 17:48:10 -0800 |
commit | c0e3c8ae30236582060dfa830bf405b209d9e149 (patch) | |
tree | b0723ece60bf89f31c2a19701465e9af19e9f6f3 /test/roundtrip | |
parent | 2c591c592b5e1480e4d69093dd051348c1ec5f0e (diff) | |
download | wabt-c0e3c8ae30236582060dfa830bf405b209d9e149.tar.gz wabt-c0e3c8ae30236582060dfa830bf405b209d9e149.tar.bz2 wabt-c0e3c8ae30236582060dfa830bf405b209d9e149.zip |
WIP on support for level1 exception spec (#773)
Implemented:
* Parsing `try`, `if_except`, `throw`, `rethrow`
* Validation
* Binary and text output
Still missing:
* `except_ref` for locals
* Interpreter implementation
Diffstat (limited to 'test/roundtrip')
-rw-r--r-- | test/roundtrip/fold-if_except.txt | 28 | ||||
-rw-r--r-- | test/roundtrip/fold-rethrow.txt | 21 | ||||
-rw-r--r-- | test/roundtrip/fold-throw.txt | 21 | ||||
-rw-r--r-- | test/roundtrip/fold-try.txt | 24 | ||||
-rw-r--r-- | test/roundtrip/generate-except-names.txt | 41 | ||||
-rw-r--r-- | test/roundtrip/try-exports-inline.txt | 18 | ||||
-rw-r--r-- | test/roundtrip/try-exports.txt | 19 | ||||
-rw-r--r-- | test/roundtrip/try-imports.txt | 29 | ||||
-rw-r--r-- | test/roundtrip/try.txt | 29 |
9 files changed, 135 insertions, 95 deletions
diff --git a/test/roundtrip/fold-if_except.txt b/test/roundtrip/fold-if_except.txt new file mode 100644 index 00000000..8770bd58 --- /dev/null +++ b/test/roundtrip/fold-if_except.txt @@ -0,0 +1,28 @@ +;;; TOOL: run-roundtrip +;;; ARGS: --stdout --fold-exprs --enable-exceptions --debug-names +(module + (except $e i32) + (func + try + nop + catch + if_except $label $e + drop + else + nop + end + end)) +(;; STDOUT ;;; +(module + (type (;0;) (func)) + (func (;0;) (type 0) + (try ;; label = @1 + (nop) + (catch + (if_except 0 ;; label = @2 + (then + (drop)) + (else + (nop)))))) + (except (;0;) i32)) +;;; STDOUT ;;) diff --git a/test/roundtrip/fold-rethrow.txt b/test/roundtrip/fold-rethrow.txt new file mode 100644 index 00000000..5d5c31f5 --- /dev/null +++ b/test/roundtrip/fold-rethrow.txt @@ -0,0 +1,21 @@ +;;; TOOL: run-roundtrip +;;; ARGS: --stdout --fold-exprs --enable-exceptions +(module + (except $e0 i32) + + (func + try + catch + rethrow + end + ) +) +(;; STDOUT ;;; +(module + (type (;0;) (func)) + (func (;0;) (type 0) + (try ;; label = @1 + (catch + (rethrow)))) + (except (;0;) i32)) +;;; STDOUT ;;) diff --git a/test/roundtrip/fold-throw.txt b/test/roundtrip/fold-throw.txt new file mode 100644 index 00000000..832cba89 --- /dev/null +++ b/test/roundtrip/fold-throw.txt @@ -0,0 +1,21 @@ +;;; TOOL: run-roundtrip +;;; ARGS: --stdout --fold-exprs --enable-exceptions +(module + (except $e0 i32) + (except $e1 f32 i32) + + (func i32.const 1 throw $e0) + (func f32.const 2 i32.const 1 throw $e1)) +(;; STDOUT ;;; +(module + (type (;0;) (func)) + (func (;0;) (type 0) + (throw 0 + (i32.const 1))) + (func (;1;) (type 0) + (throw 1 + (f32.const 0x1p+1 (;=2;)) + (i32.const 1))) + (except (;0;) i32) + (except (;1;) f32 i32)) +;;; STDOUT ;;) diff --git a/test/roundtrip/fold-try.txt b/test/roundtrip/fold-try.txt new file mode 100644 index 00000000..1a241ff9 --- /dev/null +++ b/test/roundtrip/fold-try.txt @@ -0,0 +1,24 @@ +;;; TOOL: run-roundtrip +;;; ARGS: --stdout --fold-exprs --enable-exceptions --debug-names +(module + (func (result i32) + try (result i32) + nop + i32.const 7 + catch + drop + i32.const 8 + end + ) +) +(;; STDOUT ;;; +(module + (type (;0;) (func (result i32))) + (func (;0;) (type 0) (result i32) + (try (result i32) ;; label = @1 + (nop) + (i32.const 7) + (catch + (drop) + (i32.const 8))))) +;;; STDOUT ;;) diff --git a/test/roundtrip/generate-except-names.txt b/test/roundtrip/generate-except-names.txt new file mode 100644 index 00000000..9d186c14 --- /dev/null +++ b/test/roundtrip/generate-except-names.txt @@ -0,0 +1,41 @@ +;;; TOOL: run-roundtrip +;;; ARGS: --stdout --generate-names --enable-exceptions +(module + (except $e0 i32) + (except $e1 f32) + + (func + try + catch + if_except $label $e0 + drop + end + end + + try + catch + if_except $label $e1 + drop + end + end + ) +) +(;; STDOUT ;;; +(module + (type $t0 (func)) + (func $f0 (type $t0) + try ;; label = @1 + catch + if_except $E0 $e0 + drop + end + end + try ;; label = @1 + catch + if_except $E1 $e1 + drop + end + end) + (except $e0 i32) + (except $e1 f32)) +;;; STDOUT ;;) diff --git a/test/roundtrip/try-exports-inline.txt b/test/roundtrip/try-exports-inline.txt deleted file mode 100644 index f097ae0d..00000000 --- a/test/roundtrip/try-exports-inline.txt +++ /dev/null @@ -1,18 +0,0 @@ -;;; TOOL: run-roundtrip -;;; ARGS: --stdout --enable-exceptions --inline-exports -(module - (except $ex i32) - (export "except" (except $ex)) - (func (result i32) - i32.const 7 - throw $ex - ) -) -(;; STDOUT ;;; -(module - (type (;0;) (func (result i32))) - (func (;0;) (type 0) (result i32) - i32.const 7 - throw 0) - (except (;0;) (export "except") i32)) -;;; STDOUT ;;) diff --git a/test/roundtrip/try-exports.txt b/test/roundtrip/try-exports.txt deleted file mode 100644 index 7df3f37b..00000000 --- a/test/roundtrip/try-exports.txt +++ /dev/null @@ -1,19 +0,0 @@ -;;; TOOL: run-roundtrip -;;; ARGS: --stdout --enable-exceptions -(module - (except $ex i32) - (export "except" (except $ex)) - (func (result i32) - i32.const 7 - throw $ex - ) -) -(;; STDOUT ;;; -(module - (type (;0;) (func (result i32))) - (func (;0;) (type 0) (result i32) - i32.const 7 - throw 0) - (export "except" (except 0)) - (except (;0;) i32)) -;;; STDOUT ;;) diff --git a/test/roundtrip/try-imports.txt b/test/roundtrip/try-imports.txt deleted file mode 100644 index 02d543fa..00000000 --- a/test/roundtrip/try-imports.txt +++ /dev/null @@ -1,29 +0,0 @@ -;;; TOOL: run-roundtrip -;;; ARGS: --stdout --enable-exceptions -(module - (import "c++" "except" (except $ex i32)) - (func (result i32) - try $try1 (result i32) - nop - i32.const 7 - catch $ex - nop - catch_all - rethrow $try1 - end - ) -) -(;; STDOUT ;;; -(module - (type (;0;) (func (result i32))) - (import "c++" "except" (except (;0;) i32)) - (func (;0;) (type 0) (result i32) - try (result i32) ;; label = @1 - nop - i32.const 7 - catch 0 - nop - catch_all - rethrow 0 (;@1;) - end)) -;;; STDOUT ;;) diff --git a/test/roundtrip/try.txt b/test/roundtrip/try.txt deleted file mode 100644 index 1830f7ef..00000000 --- a/test/roundtrip/try.txt +++ /dev/null @@ -1,29 +0,0 @@ -;;; TOOL: run-roundtrip -;;; ARGS: --stdout --enable-exceptions -(module - (except $ex i32) - (func (result i32) - try $try1 (result i32) - nop - i32.const 7 - catch $ex - nop - catch_all - rethrow $try1 - end - ) -) -(;; STDOUT ;;; -(module - (type (;0;) (func (result i32))) - (func (;0;) (type 0) (result i32) - try (result i32) ;; label = @1 - nop - i32.const 7 - catch 0 - nop - catch_all - rethrow 0 (;@1;) - end) - (except (;0;) i32)) -;;; STDOUT ;;) |