Created
April 25, 2016 19:29
-
-
Save binji/df243a024b0550dfa48fdbacc2130335 to your computer and use it in GitHub Desktop.
sexpr-wasm spec json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"modules": [ | |
{"filename": "switch-spec.0.wasm", "commands": [ | |
{"type": "assert_return", "name": "$assert_return_0", "file": "third_party/testsuite/switch.wast", "line": 125}, | |
{"type": "assert_return", "name": "$assert_return_1", "file": "third_party/testsuite/switch.wast", "line": 126}, | |
{"type": "assert_return", "name": "$assert_return_2", "file": "third_party/testsuite/switch.wast", "line": 127}, | |
{"type": "assert_return", "name": "$assert_return_3", "file": "third_party/testsuite/switch.wast", "line": 128}, | |
{"type": "assert_return", "name": "$assert_return_4", "file": "third_party/testsuite/switch.wast", "line": 129}, | |
{"type": "assert_return", "name": "$assert_return_5", "file": "third_party/testsuite/switch.wast", "line": 130}, | |
{"type": "assert_return", "name": "$assert_return_6", "file": "third_party/testsuite/switch.wast", "line": 131}, | |
{"type": "assert_return", "name": "$assert_return_7", "file": "third_party/testsuite/switch.wast", "line": 132}, | |
{"type": "assert_return", "name": "$assert_return_8", "file": "third_party/testsuite/switch.wast", "line": 133}, | |
{"type": "assert_return", "name": "$assert_return_9", "file": "third_party/testsuite/switch.wast", "line": 135}, | |
{"type": "assert_return", "name": "$assert_return_10", "file": "third_party/testsuite/switch.wast", "line": 136}, | |
{"type": "assert_return", "name": "$assert_return_11", "file": "third_party/testsuite/switch.wast", "line": 137}, | |
{"type": "assert_return", "name": "$assert_return_12", "file": "third_party/testsuite/switch.wast", "line": 138}, | |
{"type": "assert_return", "name": "$assert_return_13", "file": "third_party/testsuite/switch.wast", "line": 139}, | |
{"type": "assert_return", "name": "$assert_return_14", "file": "third_party/testsuite/switch.wast", "line": 140}, | |
{"type": "assert_return", "name": "$assert_return_15", "file": "third_party/testsuite/switch.wast", "line": 141}, | |
{"type": "assert_return", "name": "$assert_return_16", "file": "third_party/testsuite/switch.wast", "line": 143}, | |
{"type": "assert_return", "name": "$assert_return_17", "file": "third_party/testsuite/switch.wast", "line": 144}, | |
{"type": "assert_return", "name": "$assert_return_18", "file": "third_party/testsuite/switch.wast", "line": 145}, | |
{"type": "assert_return", "name": "$assert_return_19", "file": "third_party/testsuite/switch.wast", "line": 146}, | |
{"type": "assert_return", "name": "$assert_return_20", "file": "third_party/testsuite/switch.wast", "line": 147}, | |
{"type": "assert_return", "name": "$assert_return_21", "file": "third_party/testsuite/switch.wast", "line": 148}, | |
{"type": "assert_return", "name": "$assert_return_22", "file": "third_party/testsuite/switch.wast", "line": 149}, | |
{"type": "assert_return", "name": "$assert_return_23", "file": "third_party/testsuite/switch.wast", "line": 150}, | |
{"type": "assert_return", "name": "$assert_return_24", "file": "third_party/testsuite/switch.wast", "line": 151}, | |
{"type": "assert_return", "name": "$assert_return_25", "file": "third_party/testsuite/switch.wast", "line": 153} | |
]} | |
]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
00000000: 0061 736d 0b00 0000 0474 7970 650f 0340 .asm.....type..@ | |
00000010: 0101 0101 4001 0201 0240 0001 0108 6675 ....@[email protected] | |
00000020: 6e63 7469 6f6e 1f1e 0001 0002 0202 0202 nction.......... | |
00000030: 0202 0202 0202 0202 0202 0202 0202 0202 ................ | |
00000040: 0202 0202 0202 0665 7870 6f72 74fe 031e .......export... | |
00000050: 0004 7374 6d74 0104 6578 7072 0203 6172 ..stmt..expr..ar | |
00000060: 6703 0663 6f72 6e65 7204 1024 6173 7365 g..corner..$asse | |
00000070: 7274 5f72 6574 7572 6e5f 3005 1024 6173 rt_return_0..$as | |
00000080: 7365 7274 5f72 6574 7572 6e5f 3106 1024 sert_return_1..$ | |
00000090: 6173 7365 7274 5f72 6574 7572 6e5f 3207 assert_return_2. | |
000000a0: 1024 6173 7365 7274 5f72 6574 7572 6e5f .$assert_return_ | |
000000b0: 3308 1024 6173 7365 7274 5f72 6574 7572 3..$assert_retur | |
000000c0: 6e5f 3409 1024 6173 7365 7274 5f72 6574 n_4..$assert_ret | |
000000d0: 7572 6e5f 350a 1024 6173 7365 7274 5f72 urn_5..$assert_r | |
000000e0: 6574 7572 6e5f 360b 1024 6173 7365 7274 eturn_6..$assert | |
000000f0: 5f72 6574 7572 6e5f 370c 1024 6173 7365 _return_7..$asse | |
00000100: 7274 5f72 6574 7572 6e5f 380d 1024 6173 rt_return_8..$as | |
00000110: 7365 7274 5f72 6574 7572 6e5f 390e 1124 sert_return_9..$ | |
00000120: 6173 7365 7274 5f72 6574 7572 6e5f 3130 assert_return_10 | |
00000130: 0f11 2461 7373 6572 745f 7265 7475 726e ..$assert_return | |
00000140: 5f31 3110 1124 6173 7365 7274 5f72 6574 _11..$assert_ret | |
00000150: 7572 6e5f 3132 1111 2461 7373 6572 745f urn_12..$assert_ | |
00000160: 7265 7475 726e 5f31 3312 1124 6173 7365 return_13..$asse | |
00000170: 7274 5f72 6574 7572 6e5f 3134 1311 2461 rt_return_14..$a | |
00000180: 7373 6572 745f 7265 7475 726e 5f31 3514 ssert_return_15. | |
00000190: 1124 6173 7365 7274 5f72 6574 7572 6e5f .$assert_return_ | |
000001a0: 3136 1511 2461 7373 6572 745f 7265 7475 16..$assert_retu | |
000001b0: 726e 5f31 3716 1124 6173 7365 7274 5f72 rn_17..$assert_r | |
000001c0: 6574 7572 6e5f 3138 1711 2461 7373 6572 eturn_18..$asser | |
000001d0: 745f 7265 7475 726e 5f31 3918 1124 6173 t_return_19..$as | |
000001e0: 7365 7274 5f72 6574 7572 6e5f 3230 1911 sert_return_20.. | |
000001f0: 2461 7373 6572 745f 7265 7475 726e 5f32 $assert_return_2 | |
00000200: 311a 1124 6173 7365 7274 5f72 6574 7572 1..$assert_retur | |
00000210: 6e5f 3232 1b11 2461 7373 6572 745f 7265 n_22..$assert_re | |
00000220: 7475 726e 5f32 331c 1124 6173 7365 7274 turn_23..$assert | |
00000230: 5f72 6574 7572 6e5f 3234 1d11 2461 7373 _return_24..$ass | |
00000240: 6572 745f 7265 7475 726e 5f32 3504 636f ert_return_25.co | |
00000250: 6465 8004 1e6b 0101 0110 e400 1501 0101 de...k.......... | |
00000260: 0101 0101 0101 0101 0014 0008 0800 0000 ................ | |
00000270: 0001 0000 0002 0000 0003 0000 0004 0000 ................ | |
00000280: 0005 0000 0006 0000 0008 0000 0007 0000 ................ | |
00000290: 000f 1400 090f 000f 0f10 0014 0041 1501 .............A.. | |
000002a0: 0006 050f 0006 040f 10e5 0015 0100 0603 ................ | |
000002b0: 0f10 e500 1501 0f10 e600 1501 0f0f 1401 ................ | |
000002c0: 095d 0101 0211 e400 1501 0101 0101 0101 .].............. | |
000002d0: 0101 0101 0014 00a1 0808 0000 0000 0100 ................ | |
000002e0: 0000 0200 0000 0300 0000 0600 0000 0500 ................ | |
000002f0: 0000 0400 0000 0800 0000 0700 0000 0f14 ................ | |
00000300: 0009 0f00 0f0f 1100 1400 5c06 050f 11e5 ..........\..... | |
00000310: 0015 010f 0f0f 1401 0601 0f11 7b0f 0931 ............{..1 | |
00000320: 0001 100a 0110 e400 0110 e807 0110 0214 ................ | |
00000330: 0042 1003 1400 4708 0301 0000 0002 0000 .B....G......... | |
00000340: 0003 0000 0000 0000 000f 400f 400f 400f ..........@.@.@. | |
00000350: 090e 0001 0010 0008 0000 0000 000f 1001 ................ | |
00000360: 0800 1000 1600 1000 4d08 0010 0116 0010 ........M....... | |
00000370: 7f4d 0800 1002 1600 107e 4d08 0010 0316 .M.......~M..... | |
00000380: 0010 7d4d 0900 1004 1600 10e4 004d 0900 ..}M.........M.. | |
00000390: 1005 1600 10e5 004d 0900 1006 1600 10e6 .......M........ | |
000003a0: 004d 0900 1007 1600 10e4 004d 0900 1076 .M.........M...v | |
000003b0: 1600 10e6 004d 0800 1100 1601 1100 6808 .....M........h. | |
000003c0: 0011 0116 0111 7f68 0800 1102 1601 117e .......h.......~ | |
000003d0: 6808 0011 0316 0111 7d68 0900 1106 1601 h.......}h...... | |
000003e0: 11e5 0068 0800 1107 1601 117b 6809 0011 ...h.......{h... | |
000003f0: 7616 0111 e400 6809 0010 0016 0210 ee00 v.....h......... | |
00000400: 4d08 0010 0116 0210 0c4d 0800 1002 1602 M........M...... | |
00000410: 1004 4d09 0010 0316 0210 dc08 4d09 0010 ..M.........M... | |
00000420: 0416 0210 f600 4d08 0010 0516 0210 144d ......M........M | |
00000430: 0800 1006 1602 100c 4d09 0010 0716 0210 ........M....... | |
00000440: e408 4d09 0010 0816 0210 fe00 4d06 0016 ..M.........M... | |
00000450: 0310 014d ...M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(module | |
;; Statement switch | |
(func $stmt (param $i i32) (result i32) | |
(local $j i32) | |
(set_local $j (i32.const 100)) | |
(block $switch | |
(block $7 | |
(block $default | |
(block $6 | |
(block $5 | |
(block $4 | |
(block $3 | |
(block $2 | |
(block $1 | |
(block $0 | |
(br_table $0 $1 $2 $3 $4 $5 $6 $7 $default | |
(get_local $i) | |
) | |
) ;; 0 | |
(return (get_local $i)) | |
) ;; 1 | |
(nop) | |
;; fallthrough | |
) ;; 2 | |
;; fallthrough | |
) ;; 3 | |
(set_local $j (i32.sub (i32.const 0) (get_local $i))) | |
(br $switch) | |
) ;; 4 | |
(br $switch) | |
) ;; 5 | |
(set_local $j (i32.const 101)) | |
(br $switch) | |
) ;; 6 | |
(set_local $j (i32.const 101)) | |
;; fallthrough | |
) ;; default | |
(set_local $j (i32.const 102)) | |
) ;; 7 | |
;; fallthrough | |
) | |
(return (get_local $j)) | |
) | |
;; Expression switch | |
(func $expr (param $i i64) (result i64) | |
(local $j i64) | |
(set_local $j (i64.const 100)) | |
(return | |
(block $switch | |
(block $7 | |
(block $default | |
(block $4 | |
(block $5 | |
(block $6 | |
(block $3 | |
(block $2 | |
(block $1 | |
(block $0 | |
(br_table $0 $1 $2 $3 $4 $5 $6 $7 $default | |
(i32.wrap/i64 (get_local $i)) | |
) | |
) ;; 0 | |
(return (get_local $i)) | |
) ;; 1 | |
(nop) | |
;; fallthrough | |
) ;; 2 | |
;; fallthrough | |
) ;; 3 | |
(br $switch (i64.sub (i64.const 0) (get_local $i))) | |
) ;; 6 | |
(set_local $j (i64.const 101)) | |
;; fallthrough | |
) ;; 4 | |
;; fallthrough | |
) ;; 5 | |
;; fallthrough | |
) ;; default | |
(br $switch (get_local $j)) | |
) ;; 7 | |
(i64.const -5) | |
) | |
) | |
) | |
;; Argument switch | |
(func $arg (param $i i32) (result i32) | |
(return | |
(block $2 | |
(i32.add (i32.const 10) | |
(block $1 | |
(i32.add (i32.const 100) | |
(block $0 | |
(i32.add (i32.const 1000) | |
(block $default | |
(br_table $0 $1 $2 $default | |
(i32.mul (i32.const 2) (get_local $i)) | |
(i32.and (i32.const 3) (get_local $i)) | |
) | |
) | |
) | |
) | |
) | |
) | |
) | |
) | |
) | |
) | |
;; Corner cases | |
(func $corner (result i32) | |
(block | |
(br_table 0 (i32.const 0)) | |
) | |
(i32.const 1) | |
) | |
(export "stmt" $stmt) | |
(export "expr" $expr) | |
(export "arg" $arg) | |
(export "corner" $corner) | |
) | |
(assert_return (invoke "stmt" (i32.const 0)) (i32.const 0)) | |
(assert_return (invoke "stmt" (i32.const 1)) (i32.const -1)) | |
(assert_return (invoke "stmt" (i32.const 2)) (i32.const -2)) | |
(assert_return (invoke "stmt" (i32.const 3)) (i32.const -3)) | |
(assert_return (invoke "stmt" (i32.const 4)) (i32.const 100)) | |
(assert_return (invoke "stmt" (i32.const 5)) (i32.const 101)) | |
(assert_return (invoke "stmt" (i32.const 6)) (i32.const 102)) | |
(assert_return (invoke "stmt" (i32.const 7)) (i32.const 100)) | |
(assert_return (invoke "stmt" (i32.const -10)) (i32.const 102)) | |
(assert_return (invoke "expr" (i64.const 0)) (i64.const 0)) | |
(assert_return (invoke "expr" (i64.const 1)) (i64.const -1)) | |
(assert_return (invoke "expr" (i64.const 2)) (i64.const -2)) | |
(assert_return (invoke "expr" (i64.const 3)) (i64.const -3)) | |
(assert_return (invoke "expr" (i64.const 6)) (i64.const 101)) | |
(assert_return (invoke "expr" (i64.const 7)) (i64.const -5)) | |
(assert_return (invoke "expr" (i64.const -10)) (i64.const 100)) | |
(assert_return (invoke "arg" (i32.const 0)) (i32.const 110)) | |
(assert_return (invoke "arg" (i32.const 1)) (i32.const 12)) | |
(assert_return (invoke "arg" (i32.const 2)) (i32.const 4)) | |
(assert_return (invoke "arg" (i32.const 3)) (i32.const 1116)) | |
(assert_return (invoke "arg" (i32.const 4)) (i32.const 118)) | |
(assert_return (invoke "arg" (i32.const 5)) (i32.const 20)) | |
(assert_return (invoke "arg" (i32.const 6)) (i32.const 12)) | |
(assert_return (invoke "arg" (i32.const 7)) (i32.const 1124)) | |
(assert_return (invoke "arg" (i32.const 8)) (i32.const 126)) | |
(assert_return (invoke "corner") (i32.const 1)) | |
(assert_invalid (module (func (br_table 3 (i32.const 0)))) "unknown label") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment