diff --git a/lib/parse/assembly/index.ts b/lib/parse/assembly/index.ts index 1f8a11c9..ed11da9a 100644 --- a/lib/parse/assembly/index.ts +++ b/lib/parse/assembly/index.ts @@ -7,7 +7,7 @@ import { ExternalKind, NameType, MAX_PAGES, - MAX_TABLES, + MAX_ELEMS, Opcode } from "../src/common"; @@ -199,7 +199,7 @@ export function parse(begin: usize, end: usize): void { let type = readVarint(7) & 0x7f; let flags = readVaruint(1); let initial = readVaruint(32); - let maximum: u32 = flags & 1 ? readVaruint(32) : MAX_TABLES; + let maximum = flags & 1 ? readVaruint(32) : MAX_ELEMS; opt.onTableImport( tbl_space_index++, type, @@ -212,7 +212,7 @@ export function parse(begin: usize, end: usize): void { case ExternalKind.Memory: { let flags = readVaruint(1); let initial = readVaruint(32); - let maximum: u32 = flags & 1 ? readVaruint(32) : MAX_PAGES; + let maximum = flags & 1 ? readVaruint(32) : MAX_PAGES; opt.onMemoryImport( mem_space_index++, initial, @@ -247,12 +247,29 @@ export function parse(begin: usize, end: usize): void { } break; } + case SectionId.Table: { + let count = readVaruint(32); + for (let index: u32 = 0; index < count; ++index) { + let type = readVaruint(7) & 0x7f; + let flags = readVaruint(1); + let initial = readVaruint(32); + let maximum = flags & 1 ? readVaruint(32) : MAX_ELEMS; + opt.onTable( + tbl_space_index++, + type, + initial, + maximum, + flags + ); + } + break; + } case SectionId.Memory: { let count = readVaruint(32); for (let index: u32 = 0; index < count; ++index) { let flags = readVaruint(1); let initial = readVaruint(32); - let maximum: u32 = flags ? readVaruint(32) : MAX_PAGES; + let maximum = flags & 1 ? readVaruint(32) : MAX_PAGES; opt.onMemory( mem_space_index++, initial, diff --git a/lib/parse/assembly/options.ts b/lib/parse/assembly/options.ts index 4d652f44..e4ca8ad2 100644 --- a/lib/parse/assembly/options.ts +++ b/lib/parse/assembly/options.ts @@ -10,6 +10,7 @@ export declare function onMemoryImport(index: u32, initial: u32, maximum: u32, f export declare function onGlobalImport(index: u32, type: u32, mutability: u32): void; export declare function onMemory(index: u32, initial: u32, maximum: u32, flags: u32): void; export declare function onFunction(index: u32, typeIndex: u32): void; +export declare function onTable(index: u32, type: u32, initial: u32, maximum: u32, flags: u32): void; export declare function onGlobal(index: u32, type: u32, mutability: u32): void; export declare function onExport(index: u32, kind: u32, kindIndex: u32, nameOffset: u32, nameLength: u32): void; export declare function onStart(index: u32): void; diff --git a/lib/parse/build/index.wat b/lib/parse/build/index.wat index 5820149e..00363158 100644 --- a/lib/parse/build/index.wat +++ b/lib/parse/build/index.wat @@ -9,6 +9,7 @@ (type $v (func)) (type $I (func (result i64))) (type $iv (func (param i32))) + (type $FUNCSIG$i (func (result i32))) (import "options" "onSection" (func $assembly/options/onSection (param i32 i32 i32 i32 i32) (result i32))) (import "options" "onType" (func $assembly/options/onType (param i32 i32))) (import "options" "onTypeParam" (func $assembly/options/onTypeParam (param i32 i32 i32))) @@ -19,6 +20,7 @@ (import "options" "onMemoryImport" (func $assembly/options/onMemoryImport (param i32 i32 i32 i32))) (import "options" "onGlobalImport" (func $assembly/options/onGlobalImport (param i32 i32 i32))) (import "options" "onFunction" (func $assembly/options/onFunction (param i32 i32))) + (import "options" "onTable" (func $assembly/options/onTable (param i32 i32 i32 i32 i32))) (import "options" "onMemory" (func $assembly/options/onMemory (param i32 i32 i32 i32))) (import "options" "onGlobal" (func $assembly/options/onGlobal (param i32 i32 i32))) (import "options" "onExport" (func $assembly/options/onExport (param i32 i32 i32 i32 i32))) @@ -29,9 +31,35 @@ (import "options" "onSourceMappingURL" (func $assembly/options/onSourceMappingURL (param i32 i32))) (import "env" "memory" (memory $0 0)) (global $assembly/index/off (mut i32) (i32.const 0)) - (export "parse" (func $assembly/index/parse)) + (global $src/common/SectionId.Custom (mut i32) (i32.const 0)) + (global $src/common/SectionId.Type (mut i32) (i32.const 1)) + (global $src/common/SectionId.Import (mut i32) (i32.const 2)) + (global $src/common/SectionId.Function (mut i32) (i32.const 3)) + (global $src/common/SectionId.Table (mut i32) (i32.const 4)) + (global $src/common/SectionId.Memory (mut i32) (i32.const 5)) + (global $src/common/SectionId.Global (mut i32) (i32.const 6)) + (global $src/common/SectionId.Export (mut i32) (i32.const 7)) + (global $src/common/SectionId.Start (mut i32) (i32.const 8)) + (global $src/common/SectionId.Element (mut i32) (i32.const 9)) + (global $src/common/SectionId.Code (mut i32) (i32.const 10)) + (global $src/common/SectionId.Data (mut i32) (i32.const 11)) + (global $src/common/ExternalKind.Function (mut i32) (i32.const 0)) + (global $src/common/ExternalKind.Table (mut i32) (i32.const 1)) + (global $src/common/ExternalKind.Memory (mut i32) (i32.const 2)) + (global $src/common/ExternalKind.Global (mut i32) (i32.const 3)) + (global $src/common/Opcode.end (mut i32) (i32.const 11)) + (global $src/common/Opcode.get_global (mut i32) (i32.const 35)) + (global $src/common/Opcode.i32_const (mut i32) (i32.const 65)) + (global $src/common/Opcode.i64_const (mut i32) (i32.const 66)) + (global $src/common/Opcode.f32_const (mut i32) (i32.const 67)) + (global $src/common/Opcode.f64_const (mut i32) (i32.const 68)) + (global $src/common/NameType.Module (mut i32) (i32.const 0)) + (global $src/common/NameType.Function (mut i32) (i32.const 1)) + (global $src/common/NameType.Local (mut i32) (i32.const 2)) (export "memory" (memory $0)) - (func $assembly/index/readVaruint (; 18 ;) (type $ii) (param $0 i32) (result i32) + (export "parse" (func $assembly/index/parse)) + (func $assembly/index/readVaruint (; 19 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) + (local $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -45,30 +73,30 @@ (loop $continue|0 (set_local $0 (i32.add - (tee_local $3 + (tee_local $1 (get_local $0) ) (i32.const 1) ) ) ;;@ assembly/index.ts:43:4 - (set_local $1 + (set_local $2 (i32.or - (get_local $1) + (get_local $2) ;;@ assembly/index.ts:43:11 (i32.shl (i32.and ;;@ assembly/index.ts:42:4 - (tee_local $3 + (tee_local $1 ;;@ assembly/index.ts:42:10 (i32.load8_u - (get_local $3) + (get_local $1) ) ) ;;@ assembly/index.ts:43:18 (i32.const 127) ) - (get_local $2) + (get_local $3) ) ) ) @@ -78,16 +106,16 @@ (i32.eqz ;;@ assembly/index.ts:44:9 (i32.and - (get_local $3) + (get_local $1) ;;@ assembly/index.ts:44:16 (i32.const 128) ) ) ) ;;@ assembly/index.ts:45:4 - (set_local $2 + (set_local $3 (i32.add - (get_local $2) + (get_local $3) ;;@ assembly/index.ts:45:11 (i32.const 7) ) @@ -99,9 +127,9 @@ (set_global $assembly/index/off (get_local $0) ) - (get_local $1) + (get_local $2) ) - (func $assembly/index/readVarint (; 19 ;) (type $ii) (param $0 i32) (result i32) + (func $assembly/index/readVarint (; 20 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -202,7 +230,7 @@ (get_local $4) ) ) - (func $assembly/index/readVarint64 (; 20 ;) (type $I) (result i64) + (func $assembly/index/readVarint64 (; 21 ;) (; has Stack IR ;) (type $I) (result i64) (local $0 i64) (local $1 i64) (local $2 i32) @@ -308,7 +336,7 @@ (get_local $2) ) ) - (func $assembly/index/skipInitExpr (; 21 ;) (type $v) + (func $assembly/index/skipInitExpr (; 22 ;) (; has Stack IR ;) (type $v) (local $0 i32) (local $1 i32) ;;@ assembly/index.ts:83:2 @@ -335,35 +363,35 @@ (i32.ne (get_local $0) ;;@ assembly/index.ts:84:9 - (i32.const 65) + (get_global $src/common/Opcode.i32_const) ) (block (br_if $case1|0 (i32.eq (get_local $0) ;;@ assembly/index.ts:88:9 - (i32.const 66) + (get_global $src/common/Opcode.i64_const) ) ) (br_if $case2|0 (i32.eq (get_local $0) ;;@ assembly/index.ts:92:9 - (i32.const 67) + (get_global $src/common/Opcode.f32_const) ) ) (br_if $case3|0 (i32.eq (get_local $0) ;;@ assembly/index.ts:96:9 - (i32.const 68) + (get_global $src/common/Opcode.f64_const) ) ) (br_if $case4|0 (i32.eq (get_local $0) ;;@ assembly/index.ts:100:9 - (i32.const 35) + (get_global $src/common/Opcode.get_global) ) ) (br $case5|0) @@ -420,10 +448,7 @@ ) ;;@ assembly/index.ts:101:6 (drop - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:101:18 - (i32.const 32) - ) + (call $assembly/index/readVaruint) ) ;;@ assembly/index.ts:102:6 (br $break|0) @@ -450,13 +475,13 @@ (i32.ne (get_local $0) ;;@ assembly/index.ts:106:24 - (i32.const 11) + (get_global $src/common/Opcode.end) ) ;;@ assembly/index.ts:106:36 (unreachable) ) ) - (func $assembly/index/parse (; 22 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $assembly/index/parse (; 23 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -474,16 +499,16 @@ (set_global $assembly/index/off (get_local $0) ) - (set_local $2 + (set_local $0 (i32.load - (tee_local $0 + (tee_local $6 (get_global $assembly/index/off) ) ) ) (set_global $assembly/index/off (i32.add - (get_local $0) + (get_local $6) (i32.const 4) ) ) @@ -491,23 +516,23 @@ (if ;;@ assembly/index.ts:113:6 (i32.ne - (get_local $2) + (get_local $0) ;;@ assembly/index.ts:113:15 (i32.const 1836278016) ) ;;@ assembly/index.ts:113:27 (unreachable) ) - (set_local $2 + (set_local $0 (i32.load - (tee_local $0 + (tee_local $6 (get_global $assembly/index/off) ) ) ) (set_global $assembly/index/off (i32.add - (get_local $0) + (get_local $6) (i32.const 4) ) ) @@ -515,7 +540,7 @@ (if ;;@ assembly/index.ts:115:6 (i32.ne - (get_local $2) + (get_local $0) ;;@ assembly/index.ts:115:17 (i32.const 1) ) @@ -531,23 +556,17 @@ ) (block ;;@ assembly/index.ts:122:4 - (set_local $4 + (set_local $2 ;;@ assembly/index.ts:122:13 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:122:25 - (i32.const 7) - ) + (call $assembly/index/readVaruint) ) ;;@ assembly/index.ts:123:4 - (set_local $2 + (set_local $8 ;;@ assembly/index.ts:123:22 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:123:34 - (i32.const 32) - ) + (call $assembly/index/readVaruint) ) ;;@ assembly/index.ts:124:4 - (set_local $6 + (set_local $5 ;;@ assembly/index.ts:124:19 (i32.const 0) ) @@ -558,14 +577,14 @@ ) ;;@ assembly/index.ts:126:4 (if - (get_local $4) + (get_local $2) ;;@ assembly/index.ts:132:11 (if ;;@ assembly/index.ts:132:15 (i32.gt_u - (get_local $4) + (get_local $2) ;;@ assembly/index.ts:132:20 - (i32.const 11) + (get_global $src/common/SectionId.Data) ) ;;@ assembly/index.ts:132:41 (unreachable) @@ -573,20 +592,17 @@ ;;@ assembly/index.ts:126:13 (block ;;@ assembly/index.ts:127:6 - (set_local $8 + (set_local $4 ;;@ assembly/index.ts:127:19 (get_global $assembly/index/off) ) ;;@ assembly/index.ts:128:6 (set_local $0 ;;@ assembly/index.ts:128:17 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:128:29 - (i32.const 32) - ) + (call $assembly/index/readVaruint) ) ;;@ assembly/index.ts:129:6 - (set_local $6 + (set_local $5 ;;@ assembly/index.ts:129:17 (get_global $assembly/index/off) ) @@ -598,13 +614,13 @@ ) ) ;;@ assembly/index.ts:131:6 - (set_local $2 + (set_local $8 (i32.sub - (get_local $2) + (get_local $8) ;;@ assembly/index.ts:131:21 (i32.sub (get_global $assembly/index/off) - (get_local $8) + (get_local $4) ) ) ) @@ -615,1130 +631,1173 @@ (i32.and ;;@ assembly/index.ts:134:12 (call $assembly/options/onSection - (get_local $4) + (get_local $2) ;;@ assembly/index.ts:133:4 - (tee_local $8 + (tee_local $4 ;;@ assembly/index.ts:133:22 (get_global $assembly/index/off) ) - (get_local $2) - (get_local $6) + (get_local $8) + (get_local $5) (get_local $0) ) (i32.const 1) ) ;;@ assembly/index.ts:140:7 (block $break|1 - (block $case11|1 - (block $case10|1 - (block $case7|1 - (block $case6|1 - (block $case5|1 - (block $case4|1 - (block $case3|1 - (block $case2|1 - (block $case1|1 - (if - (i32.ne - (get_local $4) - ;;@ assembly/index.ts:142:13 - (i32.const 1) - ) - (block - (block $tablify|0 - (br_table $case1|1 $case2|1 $tablify|0 $case3|1 $case4|1 $case5|1 $case6|1 $tablify|0 - (i32.sub - (get_local $4) - (i32.const 2) + (block $case12|1 + (block $case11|1 + (block $case8|1 + (block $case7|1 + (block $case6|1 + (block $case5|1 + (block $case4|1 + (block $case3|1 + (block $case2|1 + (block $case1|1 + (if + (i32.ne + (get_local $2) + ;;@ assembly/index.ts:142:13 + (get_global $src/common/SectionId.Type) + ) + (block + (br_if $case1|1 + (i32.eq + (get_local $2) + ;;@ assembly/index.ts:171:13 + (get_global $src/common/SectionId.Import) ) ) - ) - (br_if $case7|1 - (i32.eqz - (get_local $4) - ) - ) - (block $tablify|00 - (br_table $case10|1 $case10|1 $case10|1 $tablify|00 - (i32.sub - (get_local $4) - (i32.const 9) + (br_if $case2|1 + (i32.eq + (get_local $2) + ;;@ assembly/index.ts:239:13 + (get_global $src/common/SectionId.Function) ) ) + (br_if $case3|1 + (i32.eq + (get_local $2) + ;;@ assembly/index.ts:250:13 + (get_global $src/common/SectionId.Table) + ) + ) + (br_if $case4|1 + (i32.eq + (get_local $2) + ;;@ assembly/index.ts:267:13 + (get_global $src/common/SectionId.Memory) + ) + ) + (br_if $case5|1 + (i32.eq + (get_local $2) + ;;@ assembly/index.ts:282:13 + (get_global $src/common/SectionId.Global) + ) + ) + (br_if $case6|1 + (i32.eq + (get_local $2) + ;;@ assembly/index.ts:296:13 + (get_global $src/common/SectionId.Export) + ) + ) + (br_if $case7|1 + (i32.eq + (get_local $2) + ;;@ assembly/index.ts:314:13 + (get_global $src/common/SectionId.Start) + ) + ) + (br_if $case8|1 + (i32.eq + (get_local $2) + ;;@ assembly/index.ts:321:13 + (get_global $src/common/SectionId.Custom) + ) + ) + (br_if $case11|1 + (i32.eq + (get_local $2) + ;;@ assembly/index.ts:394:13 + (get_global $src/common/SectionId.Element) + ) + ) + (br_if $case11|1 + (i32.eq + (get_local $2) + ;;@ assembly/index.ts:395:13 + (get_global $src/common/SectionId.Code) + ) + ) + (br_if $case11|1 + (i32.eq + (get_local $2) + ;;@ assembly/index.ts:396:13 + (get_global $src/common/SectionId.Data) + ) + ) + (br $case12|1) ) - (br $case11|1) ) - ) - ;;@ assembly/index.ts:143:10 - (set_local $4 - ;;@ assembly/index.ts:143:22 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:143:34 - (i32.const 32) + ;;@ assembly/index.ts:143:10 + (set_local $2 + ;;@ assembly/index.ts:143:22 + (call $assembly/index/readVaruint) ) + ;;@ assembly/index.ts:144:10 + (block $break|2 + ;;@ assembly/index.ts:144:15 + (set_local $3 + ;;@ assembly/index.ts:144:32 + (i32.const 0) + ) + (loop $repeat|2 + (br_if $break|2 + ;;@ assembly/index.ts:144:35 + (i32.ge_u + (get_local $3) + (get_local $2) + ) + ) + ;;@ assembly/index.ts:146:16 + (call $assembly/options/onType + (get_local $3) + ;;@ assembly/index.ts:145:23 + (i32.and + (call $assembly/index/readVarint + ;;@ assembly/index.ts:145:34 + (i32.const 7) + ) + ;;@ assembly/index.ts:145:39 + (i32.const 127) + ) + ) + ;;@ assembly/index.ts:150:12 + (set_local $4 + ;;@ assembly/index.ts:150:29 + (call $assembly/index/readVaruint) + ) + ;;@ assembly/index.ts:151:12 + (block $break|3 + ;;@ assembly/index.ts:151:17 + (set_local $7 + ;;@ assembly/index.ts:151:39 + (i32.const 0) + ) + (loop $repeat|3 + (br_if $break|3 + ;;@ assembly/index.ts:151:42 + (i32.ge_u + (get_local $7) + (get_local $4) + ) + ) + ;;@ assembly/index.ts:153:18 + (call $assembly/options/onTypeParam + (get_local $3) + (get_local $7) + ;;@ assembly/index.ts:152:30 + (i32.and + (call $assembly/index/readVarint + ;;@ assembly/index.ts:152:41 + (i32.const 7) + ) + ;;@ assembly/index.ts:152:46 + (i32.const 127) + ) + ) + ;;@ assembly/index.ts:151:67 + (set_local $7 + (i32.add + (get_local $7) + (i32.const 1) + ) + ) + (br $repeat|3) + ) + ) + ;;@ assembly/index.ts:159:12 + (set_local $7 + ;;@ assembly/index.ts:159:30 + (call $assembly/index/readVaruint) + ) + ;;@ assembly/index.ts:160:12 + (block $break|4 + ;;@ assembly/index.ts:160:17 + (set_local $5 + ;;@ assembly/index.ts:160:40 + (i32.const 0) + ) + (loop $repeat|4 + (br_if $break|4 + ;;@ assembly/index.ts:160:43 + (i32.ge_u + (get_local $5) + (get_local $7) + ) + ) + ;;@ assembly/index.ts:162:18 + (call $assembly/options/onTypeReturn + (get_local $3) + (get_local $5) + ;;@ assembly/index.ts:161:31 + (i32.and + (call $assembly/index/readVarint + ;;@ assembly/index.ts:161:42 + (i32.const 7) + ) + ;;@ assembly/index.ts:161:47 + (i32.const 127) + ) + ) + ;;@ assembly/index.ts:160:70 + (set_local $5 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (br $repeat|4) + ) + ) + ;;@ assembly/index.ts:144:50 + (set_local $3 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (br $repeat|2) + ) + ) + ;;@ assembly/index.ts:169:10 + (br $break|1) ) - ;;@ assembly/index.ts:144:10 - (block $break|2 - ;;@ assembly/index.ts:144:15 + ;;@ assembly/index.ts:172:10 + (set_local $2 + ;;@ assembly/index.ts:172:22 + (call $assembly/index/readVaruint) + ) + ;;@ assembly/index.ts:173:10 + (block $break|5 + ;;@ assembly/index.ts:173:15 (set_local $3 - ;;@ assembly/index.ts:144:32 + ;;@ assembly/index.ts:173:32 (i32.const 0) ) - (loop $repeat|2 - (br_if $break|2 - ;;@ assembly/index.ts:144:35 + (loop $repeat|5 + (br_if $break|5 + ;;@ assembly/index.ts:173:35 (i32.ge_u (get_local $3) - (get_local $4) + (get_local $2) ) ) - ;;@ assembly/index.ts:146:16 - (call $assembly/options/onType - (get_local $3) - ;;@ assembly/index.ts:145:23 - (i32.and - (call $assembly/index/readVarint - ;;@ assembly/index.ts:145:34 - (i32.const 7) - ) - ;;@ assembly/index.ts:145:39 - (i32.const 127) - ) - ) - ;;@ assembly/index.ts:150:12 - (set_local $0 - ;;@ assembly/index.ts:150:29 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:150:41 - (i32.const 32) - ) - ) - ;;@ assembly/index.ts:151:12 - (block $break|3 - ;;@ assembly/index.ts:151:17 - (set_local $7 - ;;@ assembly/index.ts:151:39 - (i32.const 0) - ) - (loop $repeat|3 - (br_if $break|3 - ;;@ assembly/index.ts:151:42 - (i32.ge_u - (get_local $7) - (get_local $0) - ) - ) - ;;@ assembly/index.ts:153:18 - (call $assembly/options/onTypeParam - (get_local $3) - (get_local $7) - ;;@ assembly/index.ts:152:30 - (i32.and - (call $assembly/index/readVarint - ;;@ assembly/index.ts:152:41 - (i32.const 7) - ) - ;;@ assembly/index.ts:152:46 - (i32.const 127) - ) - ) - ;;@ assembly/index.ts:151:67 - (set_local $7 - (i32.add - (get_local $7) - (i32.const 1) - ) - ) - (br $repeat|3) - ) - ) - ;;@ assembly/index.ts:159:12 + ;;@ assembly/index.ts:174:12 (set_local $7 - ;;@ assembly/index.ts:159:30 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:159:42 + ;;@ assembly/index.ts:174:29 + (call $assembly/index/readVaruint) + ) + ;;@ assembly/index.ts:175:12 + (set_local $4 + ;;@ assembly/index.ts:175:29 + (get_global $assembly/index/off) + ) + ;;@ assembly/index.ts:176:12 + (set_global $assembly/index/off + (i32.add + (get_global $assembly/index/off) + (get_local $7) + ) + ) + ;;@ assembly/index.ts:177:12 + (set_local $9 + ;;@ assembly/index.ts:177:28 + (call $assembly/index/readVaruint) + ) + ;;@ assembly/index.ts:178:12 + (set_local $5 + ;;@ assembly/index.ts:178:28 + (get_global $assembly/index/off) + ) + ;;@ assembly/index.ts:179:12 + (set_global $assembly/index/off + (i32.add + (get_global $assembly/index/off) + (get_local $9) + ) + ) + (set_local $0 + (i32.load8_u + (tee_local $6 + (get_global $assembly/index/off) + ) + ) + ) + (set_global $assembly/index/off + (i32.add + (get_local $6) (i32.const 1) ) ) - ;;@ assembly/index.ts:160:12 - (block $break|4 - ;;@ assembly/index.ts:160:17 - (set_local $5 - ;;@ assembly/index.ts:160:40 - (i32.const 0) - ) - (loop $repeat|4 - (br_if $break|4 - ;;@ assembly/index.ts:160:43 - (i32.ge_u - (get_local $5) - (get_local $7) - ) - ) - ;;@ assembly/index.ts:162:18 - (call $assembly/options/onTypeReturn - (get_local $3) - (get_local $5) - ;;@ assembly/index.ts:161:31 - (i32.and - (call $assembly/index/readVarint - ;;@ assembly/index.ts:161:42 - (i32.const 7) + ;;@ assembly/index.ts:181:16 + (call $assembly/options/onImport + (get_local $3) + (get_local $0) + (get_local $4) + (get_local $7) + (get_local $5) + (get_local $9) + ) + ;;@ assembly/index.ts:189:12 + (block $break|6 + (block $case4|6 + (block $case3|6 + (block $case2|6 + (block $case1|6 + (if + (i32.ne + (tee_local $6 + (get_local $0) + ) + ;;@ assembly/index.ts:190:19 + (get_global $src/common/ExternalKind.Function) + ) + (block + (br_if $case1|6 + (i32.eq + (get_local $6) + ;;@ assembly/index.ts:198:19 + (get_global $src/common/ExternalKind.Table) + ) + ) + (br_if $case2|6 + (i32.eq + (get_local $6) + ;;@ assembly/index.ts:212:19 + (get_global $src/common/ExternalKind.Memory) + ) + ) + (br_if $case3|6 + (i32.eq + (get_local $6) + ;;@ assembly/index.ts:224:19 + (get_global $src/common/ExternalKind.Global) + ) + ) + (br $case4|6) + ) + ) + (set_local $11 + (i32.add + (tee_local $10 + (get_local $11) + ) + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:192:20 + (call $assembly/options/onFunctionImport + (get_local $10) + ;;@ assembly/index.ts:191:27 + (call $assembly/index/readVaruint) + ) + ;;@ assembly/index.ts:196:16 + (br $break|6) ) - ;;@ assembly/index.ts:161:47 - (i32.const 127) + ;;@ assembly/index.ts:199:16 + (set_local $6 + ;;@ assembly/index.ts:199:27 + (i32.and + (call $assembly/index/readVarint + ;;@ assembly/index.ts:199:38 + (i32.const 7) + ) + ;;@ assembly/index.ts:199:43 + (i32.const 127) + ) + ) + ;;@ assembly/index.ts:200:16 + (set_local $10 + ;;@ assembly/index.ts:200:28 + (call $assembly/index/readVaruint) + ) + (set_local $12 + (i32.add + (tee_local $0 + (get_local $12) + ) + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:203:20 + (call $assembly/options/onTableImport + (get_local $0) + (get_local $6) + (tee_local $4 + ;;@ assembly/index.ts:201:30 + (call $assembly/index/readVaruint) + ) + (tee_local $8 + ;;@ assembly/index.ts:202:30 + (if (result i32) + (i32.and + (get_local $10) + ;;@ assembly/index.ts:202:38 + (i32.const 1) + ) + ;;@ assembly/index.ts:202:42 + (call $assembly/index/readVaruint) + (i32.const -1) + ) + ) + (get_local $10) + ) + ;;@ assembly/index.ts:210:16 + (br $break|6) ) + ;;@ assembly/index.ts:213:16 + (set_local $8 + ;;@ assembly/index.ts:213:28 + (call $assembly/index/readVaruint) + ) + (set_local $13 + (i32.add + (tee_local $6 + (get_local $13) + ) + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:216:20 + (call $assembly/options/onMemoryImport + (get_local $6) + (tee_local $0 + ;;@ assembly/index.ts:214:30 + (call $assembly/index/readVaruint) + ) + (tee_local $10 + ;;@ assembly/index.ts:215:30 + (if (result i32) + (i32.and + (get_local $8) + ;;@ assembly/index.ts:215:38 + (i32.const 1) + ) + ;;@ assembly/index.ts:215:42 + (call $assembly/index/readVaruint) + (i32.const 65535) + ) + ) + (get_local $8) + ) + ;;@ assembly/index.ts:222:16 + (br $break|6) ) - ;;@ assembly/index.ts:160:70 - (set_local $5 + (set_local $14 (i32.add - (get_local $5) + (tee_local $8 + (get_local $14) + ) (i32.const 1) ) ) - (br $repeat|4) + ;;@ assembly/index.ts:227:20 + (call $assembly/options/onGlobalImport + (get_local $8) + ;;@ assembly/index.ts:225:27 + (i32.and + (call $assembly/index/readVarint + ;;@ assembly/index.ts:225:38 + (i32.const 7) + ) + ;;@ assembly/index.ts:225:43 + (i32.const 127) + ) + ;;@ assembly/index.ts:226:33 + (call $assembly/index/readVaruint) + ) + ;;@ assembly/index.ts:232:16 + (br $break|6) ) + ;;@ assembly/index.ts:234:23 + (unreachable) ) - ;;@ assembly/index.ts:144:50 + ;;@ assembly/index.ts:173:50 (set_local $3 (i32.add (get_local $3) (i32.const 1) ) ) - (br $repeat|2) + (br $repeat|5) ) ) - ;;@ assembly/index.ts:169:10 + ;;@ assembly/index.ts:237:10 (br $break|1) ) - ;;@ assembly/index.ts:172:10 - (set_local $4 - ;;@ assembly/index.ts:172:22 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:172:34 - (i32.const 32) - ) + ;;@ assembly/index.ts:240:10 + (set_local $2 + ;;@ assembly/index.ts:240:22 + (call $assembly/index/readVaruint) ) - ;;@ assembly/index.ts:173:10 - (block $break|5 - ;;@ assembly/index.ts:173:15 + ;;@ assembly/index.ts:241:10 + (block $break|7 + ;;@ assembly/index.ts:241:15 (set_local $3 - ;;@ assembly/index.ts:173:32 + ;;@ assembly/index.ts:241:28 (i32.const 0) ) - (loop $repeat|5 - (br_if $break|5 - ;;@ assembly/index.ts:173:35 + (loop $repeat|7 + (br_if $break|7 + ;;@ assembly/index.ts:241:31 (i32.ge_u (get_local $3) - (get_local $4) + (get_local $2) ) ) - ;;@ assembly/index.ts:174:12 - (set_local $7 - ;;@ assembly/index.ts:174:29 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:174:41 - (i32.const 32) - ) - ) - ;;@ assembly/index.ts:175:12 - (set_local $0 - ;;@ assembly/index.ts:175:29 - (get_global $assembly/index/off) - ) - ;;@ assembly/index.ts:176:12 - (set_global $assembly/index/off + (set_local $11 (i32.add - (get_global $assembly/index/off) - (get_local $7) - ) - ) - ;;@ assembly/index.ts:177:12 - (set_local $9 - ;;@ assembly/index.ts:177:28 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:177:40 - (i32.const 32) - ) - ) - ;;@ assembly/index.ts:178:12 - (set_local $5 - ;;@ assembly/index.ts:178:28 - (get_global $assembly/index/off) - ) - ;;@ assembly/index.ts:179:12 - (set_global $assembly/index/off - (i32.add - (get_global $assembly/index/off) - (get_local $9) - ) - ) - (set_local $2 - (i32.load8_u - (tee_local $6 - (get_global $assembly/index/off) + (tee_local $5 + (get_local $11) ) - ) - ) - (set_global $assembly/index/off - (i32.add - (get_local $6) (i32.const 1) ) ) - ;;@ assembly/index.ts:181:16 - (call $assembly/options/onImport - (get_local $3) - (get_local $2) - (get_local $0) - (get_local $7) + ;;@ assembly/index.ts:243:16 + (call $assembly/options/onFunction (get_local $5) - (get_local $9) + ;;@ assembly/index.ts:242:28 + (call $assembly/index/readVaruint) ) - ;;@ assembly/index.ts:189:12 - (block $break|6 - (block $case4|6 - (block $case3|6 - (block $case2|6 - (block $case1|6 - (if - (tee_local $6 - (get_local $2) - ) - (block - (block $tablify|01 - (br_table $case1|6 $case2|6 $case3|6 $tablify|01 - (i32.sub - (get_local $6) - (i32.const 1) - ) - ) - ) - (br $case4|6) - ) - ) - (set_local $11 - (i32.add - (tee_local $8 - (get_local $11) - ) - (i32.const 1) - ) - ) - ;;@ assembly/index.ts:192:20 - (call $assembly/options/onFunctionImport - (get_local $8) - ;;@ assembly/index.ts:191:27 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:191:39 - (i32.const 32) - ) - ) - ;;@ assembly/index.ts:196:16 - (br $break|6) - ) - ;;@ assembly/index.ts:199:16 - (set_local $6 - ;;@ assembly/index.ts:199:27 - (i32.and - (call $assembly/index/readVarint - ;;@ assembly/index.ts:199:38 - (i32.const 7) - ) - ;;@ assembly/index.ts:199:43 - (i32.const 127) - ) - ) - ;;@ assembly/index.ts:200:16 - (set_local $8 - ;;@ assembly/index.ts:200:28 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:200:40 - (i32.const 1) - ) - ) - (set_local $14 - (i32.add - (tee_local $0 - (get_local $14) - ) - (i32.const 1) - ) - ) - ;;@ assembly/index.ts:203:20 - (call $assembly/options/onTableImport - (get_local $0) - (get_local $6) - (tee_local $2 - ;;@ assembly/index.ts:201:30 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:201:42 - (i32.const 32) - ) - ) - (tee_local $10 - ;;@ assembly/index.ts:202:35 - (if (result i32) - (i32.and - (get_local $8) - ;;@ assembly/index.ts:202:43 - (i32.const 1) - ) - ;;@ assembly/index.ts:202:47 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:202:59 - (i32.const 32) - ) - ;;@ assembly/index.ts:202:65 - (i32.const 1) - ) - ) - (get_local $8) - ) - ;;@ assembly/index.ts:210:16 - (br $break|6) - ) - ;;@ assembly/index.ts:213:16 - (set_local $10 - ;;@ assembly/index.ts:213:28 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:213:40 - (i32.const 1) - ) - ) - (set_local $12 - (i32.add - (tee_local $6 - (get_local $12) - ) - (i32.const 1) - ) - ) - ;;@ assembly/index.ts:216:20 - (call $assembly/options/onMemoryImport - (get_local $6) - (tee_local $0 - ;;@ assembly/index.ts:214:30 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:214:42 - (i32.const 32) - ) - ) - (tee_local $8 - ;;@ assembly/index.ts:215:35 - (if (result i32) - (i32.and - (get_local $10) - ;;@ assembly/index.ts:215:43 - (i32.const 1) - ) - ;;@ assembly/index.ts:215:47 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:215:59 - (i32.const 32) - ) - ;;@ assembly/index.ts:215:65 - (i32.const 65535) - ) - ) - (get_local $10) - ) - ;;@ assembly/index.ts:222:16 - (br $break|6) - ) - (set_local $13 - (i32.add - (tee_local $10 - (get_local $13) - ) - (i32.const 1) - ) - ) - ;;@ assembly/index.ts:227:20 - (call $assembly/options/onGlobalImport - (get_local $10) - ;;@ assembly/index.ts:225:27 - (i32.and - (call $assembly/index/readVarint - ;;@ assembly/index.ts:225:38 - (i32.const 7) - ) - ;;@ assembly/index.ts:225:43 - (i32.const 127) - ) - ;;@ assembly/index.ts:226:33 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:226:45 - (i32.const 1) - ) - ) - ;;@ assembly/index.ts:232:16 - (br $break|6) - ) - ;;@ assembly/index.ts:234:23 - (unreachable) - ) - ;;@ assembly/index.ts:173:50 + ;;@ assembly/index.ts:241:42 (set_local $3 (i32.add (get_local $3) (i32.const 1) ) ) - (br $repeat|5) + (br $repeat|7) ) ) - ;;@ assembly/index.ts:237:10 + ;;@ assembly/index.ts:248:10 (br $break|1) ) - ;;@ assembly/index.ts:240:10 - (set_local $4 - ;;@ assembly/index.ts:240:22 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:240:34 - (i32.const 32) - ) + ;;@ assembly/index.ts:251:10 + (set_local $2 + ;;@ assembly/index.ts:251:22 + (call $assembly/index/readVaruint) ) - ;;@ assembly/index.ts:241:10 - (block $break|7 - ;;@ assembly/index.ts:241:15 + ;;@ assembly/index.ts:252:10 + (block $break|8 + ;;@ assembly/index.ts:252:15 (set_local $3 - ;;@ assembly/index.ts:241:28 + ;;@ assembly/index.ts:252:32 (i32.const 0) ) - (loop $repeat|7 - (br_if $break|7 - ;;@ assembly/index.ts:241:31 + (loop $repeat|8 + (br_if $break|8 + ;;@ assembly/index.ts:252:35 (i32.ge_u (get_local $3) - (get_local $4) + (get_local $2) ) ) - (set_local $11 + ;;@ assembly/index.ts:253:12 + (set_local $0 + ;;@ assembly/index.ts:253:23 + (i32.and + (call $assembly/index/readVaruint) + ;;@ assembly/index.ts:253:40 + (i32.const 127) + ) + ) + ;;@ assembly/index.ts:254:12 + (set_local $5 + ;;@ assembly/index.ts:254:24 + (call $assembly/index/readVaruint) + ) + (set_local $12 (i32.add - (tee_local $5 - (get_local $11) + (tee_local $7 + (get_local $12) ) (i32.const 1) ) ) - ;;@ assembly/index.ts:243:16 - (call $assembly/options/onFunction - (get_local $5) - ;;@ assembly/index.ts:242:28 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:242:40 - (i32.const 32) + ;;@ assembly/index.ts:257:16 + (call $assembly/options/onTable + (get_local $7) + (get_local $0) + (tee_local $6 + ;;@ assembly/index.ts:255:26 + (call $assembly/index/readVaruint) ) + (tee_local $4 + ;;@ assembly/index.ts:256:26 + (if (result i32) + (i32.and + (get_local $5) + ;;@ assembly/index.ts:256:34 + (i32.const 1) + ) + ;;@ assembly/index.ts:256:38 + (call $assembly/index/readVaruint) + (i32.const -1) + ) + ) + (get_local $5) ) - ;;@ assembly/index.ts:241:42 + ;;@ assembly/index.ts:252:50 (set_local $3 (i32.add (get_local $3) (i32.const 1) ) ) - (br $repeat|7) + (br $repeat|8) ) ) - ;;@ assembly/index.ts:248:10 + ;;@ assembly/index.ts:265:10 (br $break|1) ) - ;;@ assembly/index.ts:251:10 - (set_local $4 - ;;@ assembly/index.ts:251:22 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:251:34 - (i32.const 32) - ) + ;;@ assembly/index.ts:268:10 + (set_local $2 + ;;@ assembly/index.ts:268:22 + (call $assembly/index/readVaruint) ) - ;;@ assembly/index.ts:252:10 - (block $break|8 - ;;@ assembly/index.ts:252:15 + ;;@ assembly/index.ts:269:10 + (block $break|9 + ;;@ assembly/index.ts:269:15 (set_local $3 - ;;@ assembly/index.ts:252:32 + ;;@ assembly/index.ts:269:32 (i32.const 0) ) - (loop $repeat|8 - (br_if $break|8 - ;;@ assembly/index.ts:252:35 + (loop $repeat|9 + (br_if $break|9 + ;;@ assembly/index.ts:269:35 (i32.ge_u (get_local $3) - (get_local $4) + (get_local $2) ) ) - ;;@ assembly/index.ts:253:12 - (set_local $2 - ;;@ assembly/index.ts:253:24 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:253:36 - (i32.const 1) - ) + ;;@ assembly/index.ts:270:12 + (set_local $4 + ;;@ assembly/index.ts:270:24 + (call $assembly/index/readVaruint) ) - (set_local $12 + (set_local $13 (i32.add (tee_local $0 - (get_local $12) + (get_local $13) ) (i32.const 1) ) ) - ;;@ assembly/index.ts:256:16 + ;;@ assembly/index.ts:273:16 (call $assembly/options/onMemory (get_local $0) (tee_local $6 - ;;@ assembly/index.ts:254:26 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:254:38 - (i32.const 32) - ) + ;;@ assembly/index.ts:271:26 + (call $assembly/index/readVaruint) ) - (tee_local $9 - ;;@ assembly/index.ts:255:31 + (tee_local $5 + ;;@ assembly/index.ts:272:26 (if (result i32) - (get_local $2) - ;;@ assembly/index.ts:255:39 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:255:51 - (i32.const 32) + (i32.and + (get_local $4) + ;;@ assembly/index.ts:272:34 + (i32.const 1) ) - ;;@ assembly/index.ts:255:57 + ;;@ assembly/index.ts:272:38 + (call $assembly/index/readVaruint) (i32.const 65535) ) ) - (get_local $2) + (get_local $4) ) - ;;@ assembly/index.ts:252:50 + ;;@ assembly/index.ts:269:50 (set_local $3 (i32.add (get_local $3) (i32.const 1) ) ) - (br $repeat|8) + (br $repeat|9) ) ) - ;;@ assembly/index.ts:263:10 + ;;@ assembly/index.ts:280:10 (br $break|1) ) - ;;@ assembly/index.ts:266:10 - (set_local $4 - ;;@ assembly/index.ts:266:22 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:266:34 - (i32.const 32) - ) + ;;@ assembly/index.ts:283:10 + (set_local $2 + ;;@ assembly/index.ts:283:22 + (call $assembly/index/readVaruint) ) - ;;@ assembly/index.ts:267:10 - (block $break|9 - ;;@ assembly/index.ts:267:15 + ;;@ assembly/index.ts:284:10 + (block $break|10 + ;;@ assembly/index.ts:284:15 (set_local $3 - ;;@ assembly/index.ts:267:28 + ;;@ assembly/index.ts:284:28 (i32.const 0) ) - (loop $repeat|9 - (br_if $break|9 - ;;@ assembly/index.ts:267:31 + (loop $repeat|10 + (br_if $break|10 + ;;@ assembly/index.ts:284:31 (i32.ge_u (get_local $3) - (get_local $4) + (get_local $2) ) ) - ;;@ assembly/index.ts:268:12 - (set_local $9 - ;;@ assembly/index.ts:268:23 + ;;@ assembly/index.ts:285:12 + (set_local $5 + ;;@ assembly/index.ts:285:23 (i32.and (call $assembly/index/readVarint - ;;@ assembly/index.ts:268:34 + ;;@ assembly/index.ts:285:34 (i32.const 7) ) - ;;@ assembly/index.ts:268:39 + ;;@ assembly/index.ts:285:39 (i32.const 127) ) ) - ;;@ assembly/index.ts:269:12 - (set_local $5 - ;;@ assembly/index.ts:269:29 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:269:41 - (i32.const 1) - ) + ;;@ assembly/index.ts:286:12 + (set_local $9 + ;;@ assembly/index.ts:286:29 + (call $assembly/index/readVaruint) ) - ;;@ assembly/index.ts:270:12 + ;;@ assembly/index.ts:287:12 (call $assembly/index/skipInitExpr) - (set_local $13 + (set_local $14 (i32.add - (tee_local $2 - (get_local $13) + (tee_local $4 + (get_local $14) ) (i32.const 1) ) ) - ;;@ assembly/index.ts:271:16 + ;;@ assembly/index.ts:288:16 (call $assembly/options/onGlobal - (get_local $2) - (get_local $9) + (get_local $4) (get_local $5) + (get_local $9) ) - ;;@ assembly/index.ts:267:42 + ;;@ assembly/index.ts:284:42 (set_local $3 (i32.add (get_local $3) (i32.const 1) ) ) - (br $repeat|9) + (br $repeat|10) ) ) - ;;@ assembly/index.ts:277:10 + ;;@ assembly/index.ts:294:10 (br $break|1) ) - ;;@ assembly/index.ts:280:10 - (set_local $4 - ;;@ assembly/index.ts:280:22 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:280:34 - (i32.const 32) - ) + ;;@ assembly/index.ts:297:10 + (set_local $2 + ;;@ assembly/index.ts:297:22 + (call $assembly/index/readVaruint) ) - ;;@ assembly/index.ts:281:10 - (block $break|10 - ;;@ assembly/index.ts:281:15 + ;;@ assembly/index.ts:298:10 + (block $break|11 + ;;@ assembly/index.ts:298:15 (set_local $3 - ;;@ assembly/index.ts:281:32 + ;;@ assembly/index.ts:298:32 (i32.const 0) ) - (loop $repeat|10 - (br_if $break|10 - ;;@ assembly/index.ts:281:35 + (loop $repeat|11 + (br_if $break|11 + ;;@ assembly/index.ts:298:35 (i32.ge_u (get_local $3) - (get_local $4) + (get_local $2) ) ) - ;;@ assembly/index.ts:282:12 - (set_local $5 - ;;@ assembly/index.ts:282:28 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:282:40 - (i32.const 32) - ) - ) - ;;@ assembly/index.ts:283:12 + ;;@ assembly/index.ts:299:12 (set_local $9 - ;;@ assembly/index.ts:283:28 + ;;@ assembly/index.ts:299:28 + (call $assembly/index/readVaruint) + ) + ;;@ assembly/index.ts:300:12 + (set_local $5 + ;;@ assembly/index.ts:300:28 (get_global $assembly/index/off) ) - ;;@ assembly/index.ts:284:12 + ;;@ assembly/index.ts:301:12 (set_global $assembly/index/off (i32.add (get_global $assembly/index/off) - (get_local $5) + (get_local $9) ) ) - (set_local $2 + (set_local $0 (i32.load8_u - (tee_local $0 + (tee_local $6 (get_global $assembly/index/off) ) ) ) (set_global $assembly/index/off (i32.add - (get_local $0) + (get_local $6) (i32.const 1) ) ) - ;;@ assembly/index.ts:287:16 + ;;@ assembly/index.ts:304:16 (call $assembly/options/onExport (get_local $3) - (get_local $2) - ;;@ assembly/index.ts:286:29 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:286:41 - (i32.const 32) - ) - (get_local $9) + (get_local $0) + ;;@ assembly/index.ts:303:29 + (call $assembly/index/readVaruint) (get_local $5) + (get_local $9) ) - ;;@ assembly/index.ts:281:50 + ;;@ assembly/index.ts:298:50 (set_local $3 (i32.add (get_local $3) (i32.const 1) ) ) - (br $repeat|10) + (br $repeat|11) ) ) - ;;@ assembly/index.ts:295:10 + ;;@ assembly/index.ts:312:10 (br $break|1) ) - ;;@ assembly/index.ts:299:14 + ;;@ assembly/index.ts:316:14 (call $assembly/options/onStart - ;;@ assembly/index.ts:298:22 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:298:34 - (i32.const 32) - ) + ;;@ assembly/index.ts:315:22 + (call $assembly/index/readVaruint) ) - ;;@ assembly/index.ts:302:10 + ;;@ assembly/index.ts:319:10 (br $break|1) ) - ;;@ assembly/index.ts:306:12 + ;;@ assembly/index.ts:323:12 (if - (tee_local $4 + (tee_local $2 (i32.eq (get_local $0) - ;;@ assembly/index.ts:306:24 + ;;@ assembly/index.ts:323:24 (i32.const 4) ) ) - (set_local $4 - ;;@ assembly/index.ts:307:12 + (set_local $2 + ;;@ assembly/index.ts:324:12 (i32.eq (i32.load - (get_local $6) + (get_local $5) ) - ;;@ assembly/index.ts:307:35 + ;;@ assembly/index.ts:324:35 (i32.const 1701667182) ) ) ) - ;;@ assembly/index.ts:305:10 + ;;@ assembly/index.ts:322:10 (if - (get_local $4) - ;;@ assembly/index.ts:308:12 + (get_local $2) + ;;@ assembly/index.ts:325:12 (block - ;;@ assembly/index.ts:309:12 - (set_local $4 - ;;@ assembly/index.ts:309:28 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:309:40 - (i32.const 7) - ) + ;;@ assembly/index.ts:326:12 + (set_local $2 + ;;@ assembly/index.ts:326:28 + (call $assembly/index/readVaruint) ) - ;;@ assembly/index.ts:310:12 + ;;@ assembly/index.ts:327:12 (set_local $3 - ;;@ assembly/index.ts:310:35 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:310:47 - (i32.const 32) - ) + ;;@ assembly/index.ts:327:35 + (call $assembly/index/readVaruint) ) - ;;@ assembly/index.ts:311:12 + ;;@ assembly/index.ts:328:12 (set_local $0 - ;;@ assembly/index.ts:311:35 + ;;@ assembly/index.ts:328:35 (get_global $assembly/index/off) ) - ;;@ assembly/index.ts:312:12 - (block $break|11 - (block $case3|11 - (block $case2|11 - (block $case1|11 + ;;@ assembly/index.ts:329:12 + (block $break|12 + (block $case3|12 + (block $case2|12 + (block $case1|12 (if - (tee_local $2 - (get_local $4) + (i32.ne + (tee_local $4 + (get_local $2) + ) + ;;@ assembly/index.ts:330:19 + (get_global $src/common/NameType.Module) ) (block - (br_if $case1|11 + (br_if $case1|12 (i32.eq - (get_local $2) - ;;@ assembly/index.ts:322:19 - (i32.const 1) + (get_local $4) + ;;@ assembly/index.ts:339:19 + (get_global $src/common/NameType.Function) ) ) - (br_if $case2|11 + (br_if $case2|12 (i32.eq - (get_local $2) - ;;@ assembly/index.ts:337:19 - (i32.const 2) + (get_local $4) + ;;@ assembly/index.ts:354:19 + (get_global $src/common/NameType.Local) ) ) - (br $case3|11) + (br $case3|12) ) ) - ;;@ assembly/index.ts:314:16 - (set_local $2 - ;;@ assembly/index.ts:314:38 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:314:50 - (i32.const 32) - ) + ;;@ assembly/index.ts:331:16 + (set_local $4 + ;;@ assembly/index.ts:331:38 + (call $assembly/index/readVaruint) ) - ;;@ assembly/index.ts:316:20 + ;;@ assembly/index.ts:333:20 (call $assembly/options/onModuleName - ;;@ assembly/index.ts:315:38 + ;;@ assembly/index.ts:332:38 (get_global $assembly/index/off) - (get_local $2) + (get_local $4) ) - ;;@ assembly/index.ts:320:16 - (br $break|11) + ;;@ assembly/index.ts:337:16 + (br $break|12) ) - ;;@ assembly/index.ts:323:16 - (set_local $9 - ;;@ assembly/index.ts:323:28 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:323:40 - (i32.const 32) - ) + ;;@ assembly/index.ts:340:16 + (set_local $5 + ;;@ assembly/index.ts:340:28 + (call $assembly/index/readVaruint) ) - ;;@ assembly/index.ts:324:16 - (block $break|12 - ;;@ assembly/index.ts:324:21 - (set_local $2 - ;;@ assembly/index.ts:324:34 + ;;@ assembly/index.ts:341:16 + (block $break|13 + ;;@ assembly/index.ts:341:21 + (set_local $4 + ;;@ assembly/index.ts:341:34 (i32.const 0) ) - (loop $repeat|12 - (br_if $break|12 - ;;@ assembly/index.ts:324:37 + (loop $repeat|13 + (br_if $break|13 + ;;@ assembly/index.ts:341:37 (i32.ge_u - (get_local $2) - (get_local $9) + (get_local $4) + (get_local $5) ) ) - ;;@ assembly/index.ts:325:18 - (set_local $5 - ;;@ assembly/index.ts:325:33 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:325:45 - (i32.const 32) - ) + ;;@ assembly/index.ts:342:18 + (set_local $9 + ;;@ assembly/index.ts:342:33 + (call $assembly/index/readVaruint) ) - ;;@ assembly/index.ts:326:18 + ;;@ assembly/index.ts:343:18 (set_local $7 - ;;@ assembly/index.ts:326:36 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:326:48 - (i32.const 32) - ) + ;;@ assembly/index.ts:343:36 + (call $assembly/index/readVaruint) ) - ;;@ assembly/index.ts:327:18 - (set_local $4 - ;;@ assembly/index.ts:327:36 + ;;@ assembly/index.ts:344:18 + (set_local $2 + ;;@ assembly/index.ts:344:36 (get_global $assembly/index/off) ) - ;;@ assembly/index.ts:328:18 + ;;@ assembly/index.ts:345:18 (set_global $assembly/index/off (i32.add (get_global $assembly/index/off) (get_local $7) ) ) - ;;@ assembly/index.ts:329:22 + ;;@ assembly/index.ts:346:22 (call $assembly/options/onFunctionName - (get_local $5) - (get_local $4) + (get_local $9) + (get_local $2) (get_local $7) ) - ;;@ assembly/index.ts:324:48 - (set_local $2 + ;;@ assembly/index.ts:341:48 + (set_local $4 (i32.add - (get_local $2) + (get_local $4) (i32.const 1) ) ) - (br $repeat|12) + (br $repeat|13) ) ) - ;;@ assembly/index.ts:335:16 - (br $break|11) + ;;@ assembly/index.ts:352:16 + (br $break|12) ) - ;;@ assembly/index.ts:338:16 - (set_local $9 - ;;@ assembly/index.ts:338:28 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:338:40 - (i32.const 32) - ) + ;;@ assembly/index.ts:355:16 + (set_local $5 + ;;@ assembly/index.ts:355:28 + (call $assembly/index/readVaruint) ) - ;;@ assembly/index.ts:339:16 - (block $break|13 - ;;@ assembly/index.ts:339:21 - (set_local $2 - ;;@ assembly/index.ts:339:34 + ;;@ assembly/index.ts:356:16 + (block $break|14 + ;;@ assembly/index.ts:356:21 + (set_local $4 + ;;@ assembly/index.ts:356:34 (i32.const 0) ) - (loop $repeat|13 - (br_if $break|13 - ;;@ assembly/index.ts:339:37 + (loop $repeat|14 + (br_if $break|14 + ;;@ assembly/index.ts:356:37 (i32.ge_u - (get_local $2) - (get_local $9) + (get_local $4) + (get_local $5) ) ) - ;;@ assembly/index.ts:340:18 - (set_local $4 - ;;@ assembly/index.ts:340:33 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:340:45 - (i32.const 32) - ) + ;;@ assembly/index.ts:357:18 + (set_local $2 + ;;@ assembly/index.ts:357:33 + (call $assembly/index/readVaruint) ) - ;;@ assembly/index.ts:341:18 + ;;@ assembly/index.ts:358:18 (set_local $7 - ;;@ assembly/index.ts:341:33 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:341:45 - (i32.const 32) - ) + ;;@ assembly/index.ts:358:33 + (call $assembly/index/readVaruint) ) - ;;@ assembly/index.ts:342:18 - (block $break|14 - ;;@ assembly/index.ts:342:23 - (set_local $5 - ;;@ assembly/index.ts:342:36 + ;;@ assembly/index.ts:359:18 + (block $break|15 + ;;@ assembly/index.ts:359:23 + (set_local $9 + ;;@ assembly/index.ts:359:36 (i32.const 0) ) - (loop $repeat|14 - (br_if $break|14 - ;;@ assembly/index.ts:342:39 + (loop $repeat|15 + (br_if $break|15 + ;;@ assembly/index.ts:359:39 (i32.ge_u - (get_local $5) + (get_local $9) (get_local $7) ) ) - ;;@ assembly/index.ts:343:20 - (set_local $8 - ;;@ assembly/index.ts:343:35 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:343:47 - (i32.const 32) - ) - ) - ;;@ assembly/index.ts:344:20 + ;;@ assembly/index.ts:360:20 (set_local $10 - ;;@ assembly/index.ts:344:38 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:344:50 - (i32.const 32) - ) + ;;@ assembly/index.ts:360:35 + (call $assembly/index/readVaruint) ) - ;;@ assembly/index.ts:345:20 + ;;@ assembly/index.ts:361:20 + (set_local $8 + ;;@ assembly/index.ts:361:38 + (call $assembly/index/readVaruint) + ) + ;;@ assembly/index.ts:362:20 (set_local $6 - ;;@ assembly/index.ts:345:38 + ;;@ assembly/index.ts:362:38 (get_global $assembly/index/off) ) - ;;@ assembly/index.ts:346:20 + ;;@ assembly/index.ts:363:20 (set_global $assembly/index/off (i32.add (get_global $assembly/index/off) - (get_local $10) + (get_local $8) ) ) - ;;@ assembly/index.ts:347:24 + ;;@ assembly/index.ts:364:24 (call $assembly/options/onLocalName - (get_local $4) - (get_local $8) - (get_local $6) + (get_local $2) (get_local $10) + (get_local $6) + (get_local $8) ) - ;;@ assembly/index.ts:342:53 - (set_local $5 + ;;@ assembly/index.ts:359:53 + (set_local $9 (i32.add - (get_local $5) + (get_local $9) (i32.const 1) ) ) - (br $repeat|14) + (br $repeat|15) ) ) - ;;@ assembly/index.ts:339:48 - (set_local $2 + ;;@ assembly/index.ts:356:48 + (set_local $4 (i32.add - (get_local $2) + (get_local $4) (i32.const 1) ) ) - (br $repeat|13) + (br $repeat|14) ) ) - ;;@ assembly/index.ts:355:16 - (br $break|11) + ;;@ assembly/index.ts:372:16 + (br $break|12) ) - ;;@ assembly/index.ts:357:23 + ;;@ assembly/index.ts:374:23 (unreachable) ) - ;;@ assembly/index.ts:359:12 + ;;@ assembly/index.ts:376:12 (set_global $assembly/index/off - ;;@ assembly/index.ts:359:18 + ;;@ assembly/index.ts:376:18 (i32.add (get_local $0) (get_local $3) ) ) - ;;@ assembly/index.ts:360:12 + ;;@ assembly/index.ts:377:12 (br $break|1) ) (block - ;;@ assembly/index.ts:362:12 + ;;@ assembly/index.ts:379:12 (if (tee_local $0 (i32.eq (get_local $0) - ;;@ assembly/index.ts:362:24 + ;;@ assembly/index.ts:379:24 (i32.const 16) ) ) (set_local $0 - ;;@ assembly/index.ts:363:12 + ;;@ assembly/index.ts:380:12 (i64.eq (i64.load - (get_local $6) + (get_local $5) ) - ;;@ assembly/index.ts:363:39 + ;;@ assembly/index.ts:380:39 (i64.const 7011371672682196851) ) ) ) - ;;@ assembly/index.ts:362:12 + ;;@ assembly/index.ts:379:12 (if (get_local $0) (set_local $0 - ;;@ assembly/index.ts:364:12 + ;;@ assembly/index.ts:381:12 (i64.eq (i64.load - ;;@ assembly/index.ts:364:22 + ;;@ assembly/index.ts:381:22 (i32.add - (get_local $6) - ;;@ assembly/index.ts:364:33 + (get_local $5) + ;;@ assembly/index.ts:381:33 (i32.const 8) ) ) - ;;@ assembly/index.ts:364:39 + ;;@ assembly/index.ts:381:39 (i64.const 5499551997695193200) ) ) ) - ;;@ assembly/index.ts:361:17 + ;;@ assembly/index.ts:378:17 (if (get_local $0) - ;;@ assembly/index.ts:365:12 + ;;@ assembly/index.ts:382:12 (block - ;;@ assembly/index.ts:366:12 + ;;@ assembly/index.ts:383:12 (set_local $0 - ;;@ assembly/index.ts:366:26 - (call $assembly/index/readVaruint - ;;@ assembly/index.ts:366:38 - (i32.const 32) - ) + ;;@ assembly/index.ts:383:26 + (call $assembly/index/readVaruint) ) - ;;@ assembly/index.ts:367:12 + ;;@ assembly/index.ts:384:12 (set_local $3 - ;;@ assembly/index.ts:367:26 + ;;@ assembly/index.ts:384:26 (get_global $assembly/index/off) ) - ;;@ assembly/index.ts:368:12 + ;;@ assembly/index.ts:385:12 (set_global $assembly/index/off (i32.add (get_global $assembly/index/off) (get_local $0) ) ) - ;;@ assembly/index.ts:369:16 + ;;@ assembly/index.ts:386:16 (call $assembly/options/onSourceMappingURL (get_local $3) (get_local $0) @@ -1747,36 +1806,36 @@ ) ) ) - ;;@ assembly/index.ts:374:10 + ;;@ assembly/index.ts:391:10 (set_global $assembly/index/off - ;;@ assembly/index.ts:374:16 + ;;@ assembly/index.ts:391:16 (i32.add + (get_local $4) (get_local $8) - (get_local $2) ) ) - ;;@ assembly/index.ts:375:10 + ;;@ assembly/index.ts:392:10 (br $break|1) ) - ;;@ assembly/index.ts:380:10 + ;;@ assembly/index.ts:397:10 (set_global $assembly/index/off (i32.add (get_global $assembly/index/off) - (get_local $2) + (get_local $8) ) ) - ;;@ assembly/index.ts:381:10 + ;;@ assembly/index.ts:398:10 (br $break|1) ) - ;;@ assembly/index.ts:383:17 + ;;@ assembly/index.ts:400:17 (unreachable) ) - ;;@ assembly/index.ts:385:11 + ;;@ assembly/index.ts:402:11 (set_global $assembly/index/off (i32.add - ;;@ assembly/index.ts:386:6 + ;;@ assembly/index.ts:403:6 (get_global $assembly/index/off) - (get_local $2) + (get_local $8) ) ) ) @@ -1784,15 +1843,18 @@ ) ) ) - ;;@ assembly/index.ts:389:2 + ;;@ assembly/index.ts:406:2 (if - ;;@ assembly/index.ts:389:6 + ;;@ assembly/index.ts:406:6 (i32.ne (get_global $assembly/index/off) (get_local $1) ) - ;;@ assembly/index.ts:389:18 + ;;@ assembly/index.ts:406:18 (unreachable) ) ) + (func $null (; 24 ;) (; has Stack IR ;) (type $v) + (nop) + ) ) diff --git a/lib/parse/index.js b/lib/parse/index.js index a1d800cc..51d2913e 100644 --- a/lib/parse/index.js +++ b/lib/parse/index.js @@ -1,2 +1,2 @@ -!function(A,E){"object"==typeof exports&&"object"==typeof module?module.exports=E():"function"==typeof define&&define.amd?define([],E):"object"==typeof exports?exports.asparse=E():A.asparse=E()}("undefined"!=typeof self?self:this,function(){return function(A){var E={};function B(Q){if(E[Q])return E[Q].exports;var n=E[Q]={i:Q,l:!1,exports:{}};return A[Q].call(n.exports,n,n.exports,B),n.l=!0,n.exports}return B.m=A,B.c=E,B.d=function(A,E,Q){B.o(A,E)||Object.defineProperty(A,E,{configurable:!1,enumerable:!0,get:Q})},B.r=function(A){Object.defineProperty(A,"__esModule",{value:!0})},B.n=function(A){var E=A&&A.__esModule?function(){return A.default}:function(){return A};return B.d(E,"a",E),E},B.o=function(A,E){return Object.prototype.hasOwnProperty.call(A,E)},B.p="",B(B.s=2)}([function(A,E,B){"use strict";E.__esModule=!0,function(A){A[A.i32=127]="i32",A[A.i64=126]="i64",A[A.f32=125]="f32",A[A.f64=124]="f64",A[A.anyfunc=112]="anyfunc",A[A.func=96]="func",A[A.none=64]="none"}(E.Type||(E.Type={})),function(A){A[A.Custom=0]="Custom",A[A.Type=1]="Type",A[A.Import=2]="Import",A[A.Function=3]="Function",A[A.Table=4]="Table",A[A.Memory=5]="Memory",A[A.Global=6]="Global",A[A.Export=7]="Export",A[A.Start=8]="Start",A[A.Element=9]="Element",A[A.Code=10]="Code",A[A.Data=11]="Data"}(E.SectionId||(E.SectionId={})),function(A){A[A.Function=0]="Function",A[A.Table=1]="Table",A[A.Memory=2]="Memory",A[A.Global=3]="Global"}(E.ExternalKind||(E.ExternalKind={})),function(A){A[A.Module=0]="Module",A[A.Function=1]="Function",A[A.Local=2]="Local"}(E.NameType||(E.NameType={})),E.MAX_PAGES=65535,E.MAX_TABLES=1,function(A){A[A.end=11]="end",A[A.get_global=35]="get_global",A[A.i32_const=65]="i32_const",A[A.i64_const=66]="i64_const",A[A.f32_const=67]="f32_const",A[A.f64_const=68]="f64_const"}(E.Opcode||(E.Opcode={}))},function(A,E,B){"use strict";E.__esModule=!0;var Q=B(0);E.Type=Q.Type,E.SectionId=Q.SectionId,E.ExternalKind=Q.ExternalKind;var n=null;E.parse=function A(E,B){B||(B={}),n||(n=new WebAssembly.Module(function(A){var E=A.length;if(E){for(var B=0,Q=E;--Q%4>1&&61===A.charCodeAt(Q);)++B;E=Math.ceil(3*E)/4-B}for(var n=new Uint8Array(E),I=0,e=0,t=0,C=0,i=A.length;C1)break;if(void 0===(r=o[r]))throw Error();switch(I){case 0:t=r,I=1;break;case 1:n[e++]=t<<2|(48&r)>>4,t=r,I=2;break;case 2:n[e++]=(15&t)<<4|(60&r)>>2,t=r,I=3;break;case 3:n[e++]=(3&t)<<6|r,I=0}}if(1===I)throw Error();return n}("AGFzbQEAAAABPQpgAn9/AGABfwF/YAV/f39/fwF/YAN/f38AYAZ/f39/f38AYAV/f39/fwBgBH9/f38AYAAAYAABfmABfwACnAMTB29wdGlvbnMJb25TZWN0aW9uAAIHb3B0aW9ucwZvblR5cGUAAAdvcHRpb25zC29uVHlwZVBhcmFtAAMHb3B0aW9ucwxvblR5cGVSZXR1cm4AAwdvcHRpb25zCG9uSW1wb3J0AAQHb3B0aW9ucxBvbkZ1bmN0aW9uSW1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ACIALQAAIQIgAEEBaiQAIAMgAkEgEBIgCSAFEAwgA0EBaiEDDAALAAsMBAtBIBASEA0MAwsgAEEERiIEBEAgBigCAEHuwrWrBkYhBAsgBARAQQcQEiEEQSAQEiEDIwAhAAJAAkACQAJAIAQiAgRAIAJBAUYNASACQQJGDQIMAwtBIBASIQIjACACEA4MAwtBIBASIQkCQEEAIQIDQCACIAlPDQFBIBASIQVBIBASIQcjACEEIwAgB2okACAFIAQgBxAPIAJBAWohAgwACwALDAILQSAQEiEJAkBBACECA0AgAiAJTw0BQSAQEiEEQSAQEiEHAkBBACEFA0AgBSAHTw0BQSAQEiEIQSAQEiEKIwAhBiMAIApqJAAgBCAIIAYgChAQIAVBAWohBQwACwALIAJBAWohAgwACwALDAELAAsgACADaiQADAMFIABBEEYiAARAIAYpAwBC897Vk7es2abhAFEhAAsgAARAIAZBCGopAwBC8OCl8/aslanMAFEhAAsgAARAQSAQEiEAIwAhAyMAIABqJAAgAyAAEBELCyAIIAJqJAAMAgsjACACaiQADAELAAsFIwAgAmokAAsMAQsLIwAgAUcEQAALCwAgEHNvdXJjZU1hcHBpbmdVUkwOaW5kZXgud2FzbS5tYXA=")));var Q=E.length,I=(Q+65535&-65536)>>16,e=new WebAssembly.Memory({initial:I}),t=new Uint8Array(e.buffer);t.set(E),A.readString=function(A,E){return function(A,E,B){if(B-E<1)return"";for(var Q=null,n=[],o=0,I=0;E191&&I<224?n[o++]=(31&I)<<6|63&A[E++]:I>239&&I<365?(I=((7&I)<<18|(63&A[E++])<<12|(63&A[E++])<<6|63&A[E++])-65536,n[o++]=55296+(I>>10),n[o++]=56320+(1023&I)):n[o++]=(15&I)<<12|(63&A[E++])<<6|63&A[E++],o>8191&&((Q||(Q=[])).push(String.fromCharCode.apply(String,n)),o=0);return Q?(o&&Q.push(String.fromCharCode.apply(String,n.slice(0,o))),Q.join("")):String.fromCharCode.apply(String,n.slice(0,o))}(t,A,A+E)};var C={env:{memory:e},options:{}};["onSection","onType","onTypeParam","onTypeReturn","onImport","onFunctionImport","onTableImport","onMemoryImport","onGlobalImport","onMemory","onFunction","onGlobal","onExport","onStart","onSourceMappingURL","onModuleName","onFunctionName","onLocalName"].forEach(function(A){return C.options[A]=B[A]||function(){}}),new WebAssembly.Instance(n,C).exports.parse(0,Q)};for(var o=new Array(123),I=0;I<64;)o[I<26?I+65:I<52?I+71:I<62?I-4:I-59|43]=I++},function(A,E,B){A.exports=B(1)}])}); +!function(A,B){"object"==typeof exports&&"object"==typeof module?module.exports=B():"function"==typeof define&&define.amd?define([],B):"object"==typeof exports?exports.asparse=B():A.asparse=B()}("undefined"!=typeof self?self:this,function(){return function(A){var B={};function E(Q){if(B[Q])return B[Q].exports;var C=B[Q]={i:Q,l:!1,exports:{}};return A[Q].call(C.exports,C,C.exports,E),C.l=!0,C.exports}return E.m=A,E.c=B,E.d=function(A,B,Q){E.o(A,B)||Object.defineProperty(A,B,{configurable:!1,enumerable:!0,get:Q})},E.r=function(A){Object.defineProperty(A,"__esModule",{value:!0})},E.n=function(A){var B=A&&A.__esModule?function(){return A.default}:function(){return A};return E.d(B,"a",B),B},E.o=function(A,B){return Object.prototype.hasOwnProperty.call(A,B)},E.p="",E(E.s=2)}([function(A,B,E){"use strict";B.__esModule=!0,function(A){A[A.i32=127]="i32",A[A.i64=126]="i64",A[A.f32=125]="f32",A[A.f64=124]="f64",A[A.anyfunc=112]="anyfunc",A[A.func=96]="func",A[A.none=64]="none"}(B.Type||(B.Type={})),function(A){A[A.Custom=0]="Custom",A[A.Type=1]="Type",A[A.Import=2]="Import",A[A.Function=3]="Function",A[A.Table=4]="Table",A[A.Memory=5]="Memory",A[A.Global=6]="Global",A[A.Export=7]="Export",A[A.Start=8]="Start",A[A.Element=9]="Element",A[A.Code=10]="Code",A[A.Data=11]="Data"}(B.SectionId||(B.SectionId={})),function(A){A[A.Function=0]="Function",A[A.Table=1]="Table",A[A.Memory=2]="Memory",A[A.Global=3]="Global"}(B.ExternalKind||(B.ExternalKind={})),function(A){A[A.Module=0]="Module",A[A.Function=1]="Function",A[A.Local=2]="Local"}(B.NameType||(B.NameType={})),B.MAX_PAGES=65535,B.MAX_ELEMS=4294967295,function(A){A[A.end=11]="end",A[A.get_global=35]="get_global",A[A.i32_const=65]="i32_const",A[A.i64_const=66]="i64_const",A[A.f32_const=67]="f32_const",A[A.f64_const=68]="f64_const"}(B.Opcode||(B.Opcode={}))},function(A,B,E){"use strict";B.__esModule=!0;var Q=E(0);B.Type=Q.Type,B.SectionId=Q.SectionId,B.ExternalKind=Q.ExternalKind;var C=null;B.parse=function A(B,E){E||(E={}),C||(C=new WebAssembly.Module(function(A){var B=A.length;if(B){for(var E=0,Q=B;--Q%4>1&&61===A.charCodeAt(Q);)++E;B=Math.ceil(3*B)/4-E}for(var C=new Uint8Array(B),o=0,I=0,e=0,t=0,r=A.length;t1)break;if(void 0===(g=n[g]))throw Error();switch(o){case 0:e=g,o=1;break;case 1:C[I++]=e<<2|(48&g)>>4,e=g,o=2;break;case 2:C[I++]=(15&e)<<4|(60&g)>>2,e=g,o=3;break;case 3:C[I++]=(3&e)<<6|g,o=0}}if(1===o)throw Error();return C}("AGFzbQEAAAABQQtgAn9/AGABfwF/YAV/f39/fwF/YAN/f38AYAZ/f39/f38AYAV/f39/fwBgBH9/f38AYAAAYAABfmABfwBgAAF/Aq4DFAdvcHRpb25zCW9uU2VjdGlvbgACB29wdGlvbnMGb25UeXBlAAAHb3B0aW9ucwtvblR5cGVQYXJhbQADB29wdGlvbnMMb25UeXBlUmV0dXJuAAMHb3B0aW9ucwhvbkltcG9ydAAEB29wdGlvbnMQb25GdW5jdGlvbkltcG9ydAAAB29wdGlvbnMNb25UYWJsZUltcG9ydAAFB29wdGlvbnMOb25NZW1vcnlJbXBvcnQABgdvcHRpb25zDm9uR2xvYmFsSW1wb3J0AAMHb3B0aW9ucwpvbkZ1bmN0aW9uAAAHb3B0aW9ucwdvblRhYmxlAAUHb3B0aW9ucwhvbk1lbW9yeQAGB29wdGlvbnMIb25H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IAJPDQFBBxAUQf8AcSEFEBMhCRAWIA4iBEEBaiEOIAQgBSAJEAwgA0EBaiEDDAAACwALDAULEBMhAgJAQQAhAwNAIAMgAk8NARATIQkjACEFIwAgCWokACMAIgYtAAAhACAGQQFqJAAgAyAAEBMgBSAJEA0gA0EBaiEDDAAACwALDAQLEBMQDgwDCyAAQQRGIgIEQCAFKAIAQe7CtasGRiECCyACBEAQEyECEBMhAyMAIQACQAJAAkACQCACIgQjF0cEQCAEIxhGDQEgBCMZRg0CDAMLEBMhBCMAIAQQDwwDCxATIQUCQEEAIQQDQCAEIAVPDQEQEyEJEBMhByMAIQIjACAHaiQAIAkgAiAHEBAgBEEBaiEEDAAACwALDAILEBMhBQJAQQAhBANAIAQgBU8NARATIQIQEyEHAkBBACEJA0AgCSAHTw0BEBMhChATIQgjACEGIwAgCGokACACIAogBiAIEBEgCUEBaiEJDAAACwALIARBAWohBAwAAAsACwwBCwALIAAgA2okAAwDBSAAQRBGIgAEQCAFKQMAQvPe1ZO3rNmm4QBRIQALIAAEQCAFQQhqKQMAQvDgpfP2rJWpzABRIQALIAAEQBATIQAjACEDIwAgAGokACADIAAQEgsLIAQgCGokAAwCCyMAIAhqJAAMAQsACwUjACAIaiQACwwBCwsjACABRwRAAAsLAwABCwAgEHNvdXJjZU1hcHBpbmdVUkwOaW5kZXgud2FzbS5tYXA=")));var Q=B.length,o=(Q+65535&-65536)>>16,I=new WebAssembly.Memory({initial:o}),e=new Uint8Array(I.buffer);e.set(B),A.readString=function(A,B){return function(A,B,E){if(E-B<1)return"";for(var Q=null,C=[],n=0,o=0;B191&&o<224?C[n++]=(31&o)<<6|63&A[B++]:o>239&&o<365?(o=((7&o)<<18|(63&A[B++])<<12|(63&A[B++])<<6|63&A[B++])-65536,C[n++]=55296+(o>>10),C[n++]=56320+(1023&o)):C[n++]=(15&o)<<12|(63&A[B++])<<6|63&A[B++],n>8191&&((Q||(Q=[])).push(String.fromCharCode.apply(String,C)),n=0);return Q?(n&&Q.push(String.fromCharCode.apply(String,C.slice(0,n))),Q.join("")):String.fromCharCode.apply(String,C.slice(0,n))}(e,A,A+B)};var t={env:{memory:I},options:{}};["onSection","onType","onTypeParam","onTypeReturn","onImport","onFunctionImport","onTableImport","onMemoryImport","onGlobalImport","onMemory","onFunction","onTable","onGlobal","onExport","onStart","onSourceMappingURL","onModuleName","onFunctionName","onLocalName"].forEach(function(A){return t.options[A]=E[A]||function(){}}),new WebAssembly.Instance(C,t).exports.parse(0,Q)};for(var n=new Array(123),o=0;o<64;)n[o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++},function(A,B,E){A.exports=E(1)}])}); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/parse/index.js.map b/lib/parse/index.js.map index 002990dd..37de0bea 100644 --- a/lib/parse/index.js.map +++ b/lib/parse/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://asparse/webpack/universalModuleDefinition","webpack://asparse/webpack/bootstrap","webpack://asparse/./src/common.ts","webpack://asparse/./src/index.ts"],"names":["root","factory","exports","module","define","amd","self","this","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","r","value","n","__esModule","object","property","prototype","hasOwnProperty","p","s","Type","SectionId","ExternalKind","NameType","MAX_PAGES","MAX_TABLES","Opcode","common_1","compiled","parse","binary","options","WebAssembly","Module","string","length","charCodeAt","Math","ceil","buffer","Uint8Array","j","t","k","undefined","s64","Error","base64_decode","nBytes","nPages","memory","Memory","initial","set","readString","offset","start","end","parts","chunk","push","String","fromCharCode","apply","slice","join","utf8_read","imports","env","forEach","Instance","Array"],"mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,UAAAH,GACA,iBAAAC,QACAA,QAAA,QAAAD,IAEAD,EAAA,QAAAC,IARA,CASC,oBAAAK,UAAAC,KAAA,WACD,mBCTA,IAAAC,KAGA,S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,eACA,iBACA,eACAsC,QAAA,SAAAnE,GAA+B,OAAAiE,EAAApC,QAAA7B,GAAA6B,EAAA7B,IAAA,eAC/B,IAAA8B,YAAAsC,SAAA1C,EAAAuC,GACAjF,QAAA2C,MAAA,EAAAmB,IAqFA,IADA,IAAAH,EAAA,IAAA0B,MAAA,KACA5E,EAAA,EAAeA,EAAA,IACfkD,EAAAlD,EAAA,GAAAA,EAAA,GAAAA,EAAA,GAAAA,EAAA,GAAAA,EAAA,GAAAA,EAAA,EAAAA,EAAA,OAAAA","file":"index.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"asparse\"] = factory();\n\telse\n\t\troot[\"asparse\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n","\"use strict\";\r\n/** Common constants shared between AssemblyScript and TypeScript. */\r\nexports.__esModule = true;\r\n/** WebAssembly types. */\r\nvar Type;\r\n(function (Type) {\r\n Type[Type[\"i32\"] = 127] = \"i32\";\r\n Type[Type[\"i64\"] = 126] = \"i64\";\r\n Type[Type[\"f32\"] = 125] = \"f32\";\r\n Type[Type[\"f64\"] = 124] = \"f64\";\r\n Type[Type[\"anyfunc\"] = 112] = \"anyfunc\";\r\n Type[Type[\"func\"] = 96] = \"func\";\r\n Type[Type[\"none\"] = 64] = \"none\";\r\n})(Type = exports.Type || (exports.Type = {}));\r\n/** WebAssembly section ids. */\r\nvar SectionId;\r\n(function (SectionId) {\r\n SectionId[SectionId[\"Custom\"] = 0] = \"Custom\";\r\n SectionId[SectionId[\"Type\"] = 1] = \"Type\";\r\n SectionId[SectionId[\"Import\"] = 2] = \"Import\";\r\n SectionId[SectionId[\"Function\"] = 3] = \"Function\";\r\n SectionId[SectionId[\"Table\"] = 4] = \"Table\";\r\n SectionId[SectionId[\"Memory\"] = 5] = \"Memory\";\r\n SectionId[SectionId[\"Global\"] = 6] = \"Global\";\r\n SectionId[SectionId[\"Export\"] = 7] = \"Export\";\r\n SectionId[SectionId[\"Start\"] = 8] = \"Start\";\r\n SectionId[SectionId[\"Element\"] = 9] = \"Element\";\r\n SectionId[SectionId[\"Code\"] = 10] = \"Code\";\r\n SectionId[SectionId[\"Data\"] = 11] = \"Data\";\r\n})(SectionId = exports.SectionId || (exports.SectionId = {}));\r\n/** WebAssembly external kinds. */\r\nvar ExternalKind;\r\n(function (ExternalKind) {\r\n ExternalKind[ExternalKind[\"Function\"] = 0] = \"Function\";\r\n ExternalKind[ExternalKind[\"Table\"] = 1] = \"Table\";\r\n ExternalKind[ExternalKind[\"Memory\"] = 2] = \"Memory\";\r\n ExternalKind[ExternalKind[\"Global\"] = 3] = \"Global\";\r\n})(ExternalKind = exports.ExternalKind || (exports.ExternalKind = {}));\r\n/** Name section types. */\r\nvar NameType;\r\n(function (NameType) {\r\n NameType[NameType[\"Module\"] = 0] = \"Module\";\r\n NameType[NameType[\"Function\"] = 1] = \"Function\";\r\n NameType[NameType[\"Local\"] = 2] = \"Local\";\r\n})(NameType = exports.NameType || (exports.NameType = {}));\r\n/** Maximum number of pages. */\r\nexports.MAX_PAGES = 0xffff;\r\n/** Maximum number of tables. */\r\nexports.MAX_TABLES = 1; // MVP\r\n/** WebAssembly opcodes. */\r\nvar Opcode;\r\n(function (Opcode) {\r\n // unreachable = 0x00,\r\n // nop = 0x01,\r\n // block = 0x02,\r\n // loop = 0x03,\r\n // if_ = 0x04,\r\n // else_ = 0x05,\r\n Opcode[Opcode[\"end\"] = 11] = \"end\";\r\n // br = 0x0c,\r\n // br_if = 0x0d,\r\n // br_table = 0x0e,\r\n // return_ = 0x0f,\r\n // call = 0x10,\r\n // call_indirect = 0x11,\r\n // drop = 0x1a,\r\n // select = 0x1b,\r\n // get_local = 0x20,\r\n // set_local = 0x21,\r\n // tee_local = 0x22,\r\n Opcode[Opcode[\"get_global\"] = 35] = \"get_global\";\r\n // set_global = 0x24,\r\n // i32_load = 0x28,\r\n // i64_load = 0x29,\r\n // f32_load = 0x2a,\r\n // f64_load = 0x2b,\r\n // i32_load8_s = 0x2c,\r\n // i32_load8_u = 0x2d,\r\n // i32_load16_s = 0x2e,\r\n // i32_load16_u = 0x2f,\r\n // i64_load8_s = 0x30,\r\n // i64_load8_u = 0x31,\r\n // i64_load16_s = 0x32,\r\n // i64_load16_u = 0x33,\r\n // i64_load32_s = 0x34,\r\n // i64_load32_u = 0x35,\r\n // i32_store = 0x36,\r\n // i64_store = 0x37,\r\n // f32_store = 0x38,\r\n // f64_store = 0x39,\r\n // i32_store8 = 0x3a,\r\n // i32_store16 = 0x3b,\r\n // i64_store8 = 0x3c,\r\n // i64_store16 = 0x3d,\r\n // i64_store32 = 0x3e,\r\n // current_memory = 0x3f,\r\n // grow_memory = 0x40,\r\n Opcode[Opcode[\"i32_const\"] = 65] = \"i32_const\";\r\n Opcode[Opcode[\"i64_const\"] = 66] = \"i64_const\";\r\n Opcode[Opcode[\"f32_const\"] = 67] = \"f32_const\";\r\n Opcode[Opcode[\"f64_const\"] = 68] = \"f64_const\";\r\n // i32_eqz = 0x45,\r\n // i32_eq = 0x46,\r\n // i32_ne = 0x47,\r\n // i32_lt_s = 0x48,\r\n // i32_lt_u = 0x49,\r\n // i32_gt_s = 0x4a,\r\n // i32_gt_u = 0x4b,\r\n // i32_le_s = 0x4c,\r\n // i32_le_u = 0x4d,\r\n // i32_ge_s = 0x4e,\r\n // i32_ge_u = 0x4f,\r\n // i64_eqz = 0x50,\r\n // i64_eq = 0x51,\r\n // i64_ne = 0x52,\r\n // i64_lt_s = 0x53,\r\n // i64_lt_u = 0x54,\r\n // i64_gt_s = 0x55,\r\n // i64_gt_u = 0x56,\r\n // i64_le_s = 0x57,\r\n // i64_le_u = 0x58,\r\n // i64_ge_s = 0x59,\r\n // i64_ge_u = 0x5a,\r\n // f32_eq = 0x5b,\r\n // f32_ne = 0x5c,\r\n // f32_lt = 0x5d,\r\n // f32_gt = 0x5e,\r\n // f32_le = 0x5f,\r\n // f32_ge = 0x60,\r\n // f64_eq = 0x61,\r\n // f64_ne = 0x62,\r\n // f64_lt = 0x63,\r\n // f64_gt = 0x64,\r\n // f64_le = 0x65,\r\n // f64_ge = 0x66,\r\n // i32_clz = 0x67,\r\n // i32_ctz = 0x68,\r\n // i32_popcnt = 0x69,\r\n // i32_add = 0x6a,\r\n // i32_sub = 0x6b,\r\n // i32_mul = 0x6c,\r\n // i32_div_s = 0x6d,\r\n // i32_div_u = 0x6e,\r\n // i32_rem_s = 0x6f,\r\n // i32_rem_u = 0x70,\r\n // i32_and = 0x71,\r\n // i32_or = 0x72,\r\n // i32_xor = 0x73,\r\n // i32_shl = 0x74,\r\n // i32_shr_s = 0x75,\r\n // i32_shr_u = 0x76,\r\n // i32_rotl = 0x77,\r\n // i32_rotr = 0x78,\r\n // i64_clz = 0x79,\r\n // i64_ctz = 0x7a,\r\n // i64_popcnt = 0x7b,\r\n // i64_add = 0x7c,\r\n // i64_sub = 0x7d,\r\n // i64_mul = 0x7e,\r\n // i64_div_s = 0x7f,\r\n // i64_div_u = 0x80,\r\n // i64_rem_s = 0x81,\r\n // i64_rem_u = 0x82,\r\n // i64_and = 0x83,\r\n // i64_or = 0x84,\r\n // i64_xor = 0x85,\r\n // i64_shl = 0x86,\r\n // i64_shr_s = 0x87,\r\n // i64_shr_u = 0x88,\r\n // i64_rotl = 0x89,\r\n // i64_rotr = 0x8a,\r\n // f32_abs = 0x8b,\r\n // f32_neg = 0x8c,\r\n // f32_ceil = 0x8d,\r\n // f32_floor = 0x8e,\r\n // f32_trunc = 0x8f,\r\n // f32_nearest = 0x90,\r\n // f32_sqrt = 0x91,\r\n // f32_add = 0x92,\r\n // f32_sub = 0x93,\r\n // f32_mul = 0x94,\r\n // f32_div = 0x95,\r\n // f32_min = 0x96,\r\n // f32_max = 0x97,\r\n // f32_copysign = 0x98,\r\n // f64_abs = 0x99,\r\n // f64_neg = 0x9a,\r\n // f64_ceil = 0x9b,\r\n // f64_floor = 0x9c,\r\n // f64_trunc = 0x9d,\r\n // f64_nearest = 0x9e,\r\n // f64_sqrt = 0x9f,\r\n // f64_add = 0xa0,\r\n // f64_sub = 0xa1,\r\n // f64_mul = 0xa2,\r\n // f64_div = 0xa3,\r\n // f64_min = 0xa4,\r\n // f64_max = 0xa5,\r\n // f64_copysign = 0xa6,\r\n // i32_wrap_i64 = 0xa7,\r\n // i32_trunc_s_f32 = 0xa8,\r\n // i32_trunc_u_f32 = 0xa9,\r\n // i32_trunc_s_f64 = 0xaa,\r\n // i32_trunc_u_f64 = 0xab,\r\n // i64_extend_s_i32 = 0xac,\r\n // i64_extend_u_i32 = 0xad,\r\n // i64_trunc_s_f32 = 0xae,\r\n // i64_trunc_u_f32 = 0xaf,\r\n // i64_trunc_s_f64 = 0xb0,\r\n // i64_trunc_u_f64 = 0xb1,\r\n // f32_convert_s_i32 = 0xb2,\r\n // f32_convert_u_i32 = 0xb3,\r\n // f32_convert_s_i64 = 0xb4,\r\n // f32_convert_u_i64 = 0xb5,\r\n // f32_demote_f64 = 0xb6,\r\n // f64_convert_s_i32 = 0xb7,\r\n // f64_convert_u_i32 = 0xb8,\r\n // f64_convert_s_i64 = 0xb9,\r\n // f64_convert_u_i64 = 0xba,\r\n // f64_promote_f32 = 0xbb,\r\n // i32_reinterpret_f32 = 0xbc,\r\n // i64_reinterpret_f64 = 0xbd,\r\n // f32_reinterpret_i32 = 0xbe,\r\n // f64_reinterpret_i64 = 0xbf\r\n})(Opcode = exports.Opcode || (exports.Opcode = {}));\r\n","\"use strict\";\r\nexports.__esModule = true;\r\nvar common_1 = require(\"./common\");\r\nexports.Type = common_1.Type;\r\nexports.SectionId = common_1.SectionId;\r\nexports.ExternalKind = common_1.ExternalKind;\r\n/** Cached compiled parser. */\r\nvar compiled = null;\r\nif (typeof WASM_DATA !== \"string\")\r\n WASM_DATA = require(\"fs\").readFileSync(__dirname + \"/../build/index.wasm\", \"base64\");\r\n/** Parses the contents of a WebAssembly binary according to the specified options. */\r\nfunction parse(binary, options) {\r\n if (!options)\r\n options = {};\r\n // compile the parser if not yet compiled\r\n if (!compiled)\r\n compiled = new WebAssembly.Module(base64_decode(WASM_DATA));\r\n // use the binary as the parser's memory\r\n var nBytes = binary.length;\r\n var nPages = ((nBytes + 0xffff) & ~0xffff) >> 16;\r\n var memory = new WebAssembly.Memory({ initial: nPages });\r\n var buffer = new Uint8Array(memory.buffer);\r\n buffer.set(binary);\r\n // provide a way to read strings from memory\r\n parse.readString = function (offset, length) { return utf8_read(buffer, offset, offset + length); };\r\n // instantiate the parser and return its exports\r\n var imports = {\r\n env: {\r\n memory: memory\r\n },\r\n options: {}\r\n };\r\n [\"onSection\",\r\n \"onType\",\r\n \"onTypeParam\",\r\n \"onTypeReturn\",\r\n \"onImport\",\r\n \"onFunctionImport\",\r\n \"onTableImport\",\r\n \"onMemoryImport\",\r\n \"onGlobalImport\",\r\n \"onMemory\",\r\n \"onFunction\",\r\n \"onGlobal\",\r\n \"onExport\",\r\n \"onStart\",\r\n \"onSourceMappingURL\",\r\n \"onModuleName\",\r\n \"onFunctionName\",\r\n \"onLocalName\"\r\n ].forEach(function (name) { return imports.options[name] = options[name] || function () { }; });\r\n var instance = new WebAssembly.Instance(compiled, imports);\r\n instance.exports.parse(0, nBytes);\r\n}\r\nexports.parse = parse;\r\n// see: https://github.com/dcodeIO/protobuf.js/tree/master/lib/utf8\r\nfunction utf8_read(buffer, start, end) {\r\n var len = end - start;\r\n if (len < 1)\r\n return \"\";\r\n var parts = null, chunk = [], i = 0, // char offset\r\n t = 0; // temporary\r\n while (start < end) {\r\n t = buffer[start++];\r\n if (t < 128) {\r\n chunk[i++] = t;\r\n }\r\n else if (t > 191 && t < 224) {\r\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\r\n }\r\n else if (t > 239 && t < 365) {\r\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\r\n chunk[i++] = 0xD800 + (t >> 10);\r\n chunk[i++] = 0xDC00 + (t & 1023);\r\n }\r\n else {\r\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\r\n }\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n}\r\n// see: https://github.com/dcodeIO/protobuf.js/tree/master/lib/base64\r\nfunction base64_decode(string) {\r\n var length = string.length;\r\n if (length) {\r\n var n = 0, p = length;\r\n while (--p % 4 > 1 && string.charCodeAt(p) === 61)\r\n ++n;\r\n length = Math.ceil(length * 3) / 4 - n;\r\n }\r\n var buffer = new Uint8Array(length);\r\n var j = 0, o = 0, t = 0;\r\n for (var i = 0, k = string.length; i < k;) {\r\n var c = string.charCodeAt(i++);\r\n if (c === 61 && j > 1)\r\n break;\r\n if ((c = s64[c]) === undefined)\r\n throw Error();\r\n switch (j) {\r\n case 0: {\r\n t = c;\r\n j = 1;\r\n break;\r\n }\r\n case 1: {\r\n buffer[o++] = t << 2 | (c & 48) >> 4;\r\n t = c;\r\n j = 2;\r\n break;\r\n }\r\n case 2: {\r\n buffer[o++] = (t & 15) << 4 | (c & 60) >> 2;\r\n t = c;\r\n j = 3;\r\n break;\r\n }\r\n case 3: {\r\n buffer[o++] = (t & 3) << 6 | c;\r\n j = 0;\r\n break;\r\n }\r\n }\r\n }\r\n if (j === 1)\r\n throw Error();\r\n return buffer;\r\n}\r\nvar s64 = new Array(123);\r\nfor (var i = 0; i < 64;)\r\n s64[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\r\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://asparse/webpack/universalModuleDefinition","webpack://asparse/webpack/bootstrap","webpack://asparse/./src/common.ts","webpack://asparse/./src/index.ts"],"names":["root","factory","exports","module","define","amd","self","this","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","r","value","n","__esModule","object","property","prototype","hasOwnProperty","p","s","Type","SectionId","ExternalKind","NameType","MAX_PAGES","MAX_ELEMS","Opcode","common_1","compiled","parse","binary","options","WebAssembly","Module","string","length","charCodeAt","Math","ceil","buffer","Uint8Array","j","t","k","undefined","s64","Error","base64_decode","nBytes","nPages","memory","Memory","initial","set","readString","offset","start","end","parts","chunk","push","String","fromCharCode","apply","slice","join","utf8_read","imports","env","forEach","Instance","Array"],"mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,UAAAH,GACA,iBAAAC,QACAA,QAAA,QAAAD,IAEAD,EAAA,QAAAC,IARA,CASC,oBAAAK,UAAAC,KAAA,WACD,mBCTA,IAAAC,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAR,QAGA,IAAAC,EAAAK,EAAAE,IACAC,EAAAD,EACAE,GAAA,EACAV,YAUA,OANAW,EAAAH,GAAAI,KAAAX,EAAAD,QAAAC,IAAAD,QAAAO,GAGAN,EAAAS,GAAA,EAGAT,EAAAD,QA2CA,OAtCAO,EAAAM,EAAAF,EAGAJ,EAAAO,EAAAR,EAGAC,EAAAQ,EAAA,SAAAf,EAAAgB,EAAAC,GACAV,EAAAW,EAAAlB,EAAAgB,IACAG,OAAAC,eAAApB,EAAAgB,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAV,EAAAiB,EAAA,SAAAxB,GACAmB,OAAAC,eAAApB,EAAA,cAAiDyB,OAAA,KAIjDlB,EAAAmB,EAAA,SAAAzB,GACA,IAAAgB,EAAAhB,KAAA0B,WACA,WAA2B,OAAA1B,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAM,EAAAQ,EAAAE,EAAA,IAAAA,GACAA,GAIAV,EAAAW,EA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AAA,KAAAjB,EAAAiB,MAAA,MACAG,EAAAhE,KAAA,OAAA+C,GAAA,IACAiB,EAAAhE,KAAA,YAAA+C,IAGAiB,EAAAhE,MAAA,GAAA+C,IAAA,OAAAH,EAAAiB,OAAA,KAAAjB,EAAAiB,KAEA7D,EAAA,QACA+D,WAAAE,KAAAC,OAAAC,aAAAC,MAAAF,OAAAF,IACAhE,EAAA,GAGA,OAAA+D,GACA/D,GACA+D,EAAAE,KAAAC,OAAAC,aAAAC,MAAAF,OAAAF,EAAAK,MAAA,EAAArE,KACA+D,EAAAO,KAAA,KAEAJ,OAAAC,aAAAC,MAAAF,OAAAF,EAAAK,MAAA,EAAArE,IAjEkDuE,CAAA3B,EAAAgB,IAAApB,IAElD,IAAAgC,GACAC,KACAlB,UAEAnB,aAEA,YACA,SACA,cACA,eACA,WACA,mBACA,gBACA,iBACA,iBACA,WACA,aACA,UACA,WACA,WACA,UACA,qBACA,eACA,iBACA,eACAsC,QAAA,SAAAnE,GAA+B,OAAAiE,EAAApC,QAAA7B,GAAA6B,EAAA7B,IAAA,eAC/B,IAAA8B,YAAAsC,SAAA1C,EAAAuC,GACAjF,QAAA2C,MAAA,EAAAmB,IAqFA,IADA,IAAAH,EAAA,IAAA0B,MAAA,KACA5E,EAAA,EAAeA,EAAA,IACfkD,EAAAlD,EAAA,GAAAA,EAAA,GAAAA,EAAA,GAAAA,EAAA,GAAAA,EAAA,GAAAA,EAAA,EAAAA,EAAA,OAAAA","file":"index.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"asparse\"] = factory();\n\telse\n\t\troot[\"asparse\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n","\"use strict\";\r\n/** Common constants shared between AssemblyScript and TypeScript. */\r\nexports.__esModule = true;\r\n/** WebAssembly types. */\r\nvar Type;\r\n(function (Type) {\r\n Type[Type[\"i32\"] = 127] = \"i32\";\r\n Type[Type[\"i64\"] = 126] = \"i64\";\r\n Type[Type[\"f32\"] = 125] = \"f32\";\r\n Type[Type[\"f64\"] = 124] = \"f64\";\r\n Type[Type[\"anyfunc\"] = 112] = \"anyfunc\";\r\n Type[Type[\"func\"] = 96] = \"func\";\r\n Type[Type[\"none\"] = 64] = \"none\";\r\n})(Type = exports.Type || (exports.Type = {}));\r\n/** WebAssembly section ids. */\r\nvar SectionId;\r\n(function (SectionId) {\r\n SectionId[SectionId[\"Custom\"] = 0] = \"Custom\";\r\n SectionId[SectionId[\"Type\"] = 1] = \"Type\";\r\n SectionId[SectionId[\"Import\"] = 2] = \"Import\";\r\n SectionId[SectionId[\"Function\"] = 3] = \"Function\";\r\n SectionId[SectionId[\"Table\"] = 4] = \"Table\";\r\n SectionId[SectionId[\"Memory\"] = 5] = \"Memory\";\r\n SectionId[SectionId[\"Global\"] = 6] = \"Global\";\r\n SectionId[SectionId[\"Export\"] = 7] = \"Export\";\r\n SectionId[SectionId[\"Start\"] = 8] = \"Start\";\r\n SectionId[SectionId[\"Element\"] = 9] = \"Element\";\r\n SectionId[SectionId[\"Code\"] = 10] = \"Code\";\r\n SectionId[SectionId[\"Data\"] = 11] = \"Data\";\r\n})(SectionId = exports.SectionId || (exports.SectionId = {}));\r\n/** WebAssembly external kinds. */\r\nvar ExternalKind;\r\n(function (ExternalKind) {\r\n ExternalKind[ExternalKind[\"Function\"] = 0] = \"Function\";\r\n ExternalKind[ExternalKind[\"Table\"] = 1] = \"Table\";\r\n ExternalKind[ExternalKind[\"Memory\"] = 2] = \"Memory\";\r\n ExternalKind[ExternalKind[\"Global\"] = 3] = \"Global\";\r\n})(ExternalKind = exports.ExternalKind || (exports.ExternalKind = {}));\r\n/** Name section types. */\r\nvar NameType;\r\n(function (NameType) {\r\n NameType[NameType[\"Module\"] = 0] = \"Module\";\r\n NameType[NameType[\"Function\"] = 1] = \"Function\";\r\n NameType[NameType[\"Local\"] = 2] = \"Local\";\r\n})(NameType = exports.NameType || (exports.NameType = {}));\r\n/** Maximum number of memory pages. */\r\nexports.MAX_PAGES = 0xffff;\r\n/** Maximum number of table elements. */\r\nexports.MAX_ELEMS = 0xffffffff;\r\n/** WebAssembly opcodes. */\r\nvar Opcode;\r\n(function (Opcode) {\r\n // unreachable = 0x00,\r\n // nop = 0x01,\r\n // block = 0x02,\r\n // loop = 0x03,\r\n // if_ = 0x04,\r\n // else_ = 0x05,\r\n Opcode[Opcode[\"end\"] = 11] = \"end\";\r\n // br = 0x0c,\r\n // br_if = 0x0d,\r\n // br_table = 0x0e,\r\n // return_ = 0x0f,\r\n // call = 0x10,\r\n // call_indirect = 0x11,\r\n // drop = 0x1a,\r\n // select = 0x1b,\r\n // get_local = 0x20,\r\n // set_local = 0x21,\r\n // tee_local = 0x22,\r\n Opcode[Opcode[\"get_global\"] = 35] = \"get_global\";\r\n // set_global = 0x24,\r\n // i32_load = 0x28,\r\n // i64_load = 0x29,\r\n // f32_load = 0x2a,\r\n // f64_load = 0x2b,\r\n // i32_load8_s = 0x2c,\r\n // i32_load8_u = 0x2d,\r\n // i32_load16_s = 0x2e,\r\n // i32_load16_u = 0x2f,\r\n // i64_load8_s = 0x30,\r\n // i64_load8_u = 0x31,\r\n // i64_load16_s = 0x32,\r\n // i64_load16_u = 0x33,\r\n // i64_load32_s = 0x34,\r\n // i64_load32_u = 0x35,\r\n // i32_store = 0x36,\r\n // i64_store = 0x37,\r\n // f32_store = 0x38,\r\n // f64_store = 0x39,\r\n // i32_store8 = 0x3a,\r\n // i32_store16 = 0x3b,\r\n // i64_store8 = 0x3c,\r\n // i64_store16 = 0x3d,\r\n // i64_store32 = 0x3e,\r\n // current_memory = 0x3f,\r\n // grow_memory = 0x40,\r\n Opcode[Opcode[\"i32_const\"] = 65] = \"i32_const\";\r\n Opcode[Opcode[\"i64_const\"] = 66] = \"i64_const\";\r\n Opcode[Opcode[\"f32_const\"] = 67] = \"f32_const\";\r\n Opcode[Opcode[\"f64_const\"] = 68] = \"f64_const\";\r\n // i32_eqz = 0x45,\r\n // i32_eq = 0x46,\r\n // i32_ne = 0x47,\r\n // i32_lt_s = 0x48,\r\n // i32_lt_u = 0x49,\r\n // i32_gt_s = 0x4a,\r\n // i32_gt_u = 0x4b,\r\n // i32_le_s = 0x4c,\r\n // i32_le_u = 0x4d,\r\n // i32_ge_s = 0x4e,\r\n // i32_ge_u = 0x4f,\r\n // i64_eqz = 0x50,\r\n // i64_eq = 0x51,\r\n // i64_ne = 0x52,\r\n // i64_lt_s = 0x53,\r\n // i64_lt_u = 0x54,\r\n // i64_gt_s = 0x55,\r\n // i64_gt_u = 0x56,\r\n // i64_le_s = 0x57,\r\n // i64_le_u = 0x58,\r\n // i64_ge_s = 0x59,\r\n // i64_ge_u = 0x5a,\r\n // f32_eq = 0x5b,\r\n // f32_ne = 0x5c,\r\n // f32_lt = 0x5d,\r\n // f32_gt = 0x5e,\r\n // f32_le = 0x5f,\r\n // f32_ge = 0x60,\r\n // f64_eq = 0x61,\r\n // f64_ne = 0x62,\r\n // f64_lt = 0x63,\r\n // f64_gt = 0x64,\r\n // f64_le = 0x65,\r\n // f64_ge = 0x66,\r\n // i32_clz = 0x67,\r\n // i32_ctz = 0x68,\r\n // i32_popcnt = 0x69,\r\n // i32_add = 0x6a,\r\n // i32_sub = 0x6b,\r\n // i32_mul = 0x6c,\r\n // i32_div_s = 0x6d,\r\n // i32_div_u = 0x6e,\r\n // i32_rem_s = 0x6f,\r\n // i32_rem_u = 0x70,\r\n // i32_and = 0x71,\r\n // i32_or = 0x72,\r\n // i32_xor = 0x73,\r\n // i32_shl = 0x74,\r\n // i32_shr_s = 0x75,\r\n // i32_shr_u = 0x76,\r\n // i32_rotl = 0x77,\r\n // i32_rotr = 0x78,\r\n // i64_clz = 0x79,\r\n // i64_ctz = 0x7a,\r\n // i64_popcnt = 0x7b,\r\n // i64_add = 0x7c,\r\n // i64_sub = 0x7d,\r\n // i64_mul = 0x7e,\r\n // i64_div_s = 0x7f,\r\n // i64_div_u = 0x80,\r\n // i64_rem_s = 0x81,\r\n // i64_rem_u = 0x82,\r\n // i64_and = 0x83,\r\n // i64_or = 0x84,\r\n // i64_xor = 0x85,\r\n // i64_shl = 0x86,\r\n // i64_shr_s = 0x87,\r\n // i64_shr_u = 0x88,\r\n // i64_rotl = 0x89,\r\n // i64_rotr = 0x8a,\r\n // f32_abs = 0x8b,\r\n // f32_neg = 0x8c,\r\n // f32_ceil = 0x8d,\r\n // f32_floor = 0x8e,\r\n // f32_trunc = 0x8f,\r\n // f32_nearest = 0x90,\r\n // f32_sqrt = 0x91,\r\n // f32_add = 0x92,\r\n // f32_sub = 0x93,\r\n // f32_mul = 0x94,\r\n // f32_div = 0x95,\r\n // f32_min = 0x96,\r\n // f32_max = 0x97,\r\n // f32_copysign = 0x98,\r\n // f64_abs = 0x99,\r\n // f64_neg = 0x9a,\r\n // f64_ceil = 0x9b,\r\n // f64_floor = 0x9c,\r\n // f64_trunc = 0x9d,\r\n // f64_nearest = 0x9e,\r\n // f64_sqrt = 0x9f,\r\n // f64_add = 0xa0,\r\n // f64_sub = 0xa1,\r\n // f64_mul = 0xa2,\r\n // f64_div = 0xa3,\r\n // f64_min = 0xa4,\r\n // f64_max = 0xa5,\r\n // f64_copysign = 0xa6,\r\n // i32_wrap_i64 = 0xa7,\r\n // i32_trunc_s_f32 = 0xa8,\r\n // i32_trunc_u_f32 = 0xa9,\r\n // i32_trunc_s_f64 = 0xaa,\r\n // i32_trunc_u_f64 = 0xab,\r\n // i64_extend_s_i32 = 0xac,\r\n // i64_extend_u_i32 = 0xad,\r\n // i64_trunc_s_f32 = 0xae,\r\n // i64_trunc_u_f32 = 0xaf,\r\n // i64_trunc_s_f64 = 0xb0,\r\n // i64_trunc_u_f64 = 0xb1,\r\n // f32_convert_s_i32 = 0xb2,\r\n // f32_convert_u_i32 = 0xb3,\r\n // f32_convert_s_i64 = 0xb4,\r\n // f32_convert_u_i64 = 0xb5,\r\n // f32_demote_f64 = 0xb6,\r\n // f64_convert_s_i32 = 0xb7,\r\n // f64_convert_u_i32 = 0xb8,\r\n // f64_convert_s_i64 = 0xb9,\r\n // f64_convert_u_i64 = 0xba,\r\n // f64_promote_f32 = 0xbb,\r\n // i32_reinterpret_f32 = 0xbc,\r\n // i64_reinterpret_f64 = 0xbd,\r\n // f32_reinterpret_i32 = 0xbe,\r\n // f64_reinterpret_i64 = 0xbf\r\n})(Opcode = exports.Opcode || (exports.Opcode = {}));\r\n","\"use strict\";\r\nexports.__esModule = true;\r\nvar common_1 = require(\"./common\");\r\nexports.Type = common_1.Type;\r\nexports.SectionId = common_1.SectionId;\r\nexports.ExternalKind = common_1.ExternalKind;\r\n/** Cached compiled parser. */\r\nvar compiled = null;\r\nif (typeof WASM_DATA !== \"string\")\r\n WASM_DATA = require(\"fs\").readFileSync(__dirname + \"/../build/index.wasm\", \"base64\");\r\n/** Parses the contents of a WebAssembly binary according to the specified options. */\r\nfunction parse(binary, options) {\r\n if (!options)\r\n options = {};\r\n // compile the parser if not yet compiled\r\n if (!compiled)\r\n compiled = new WebAssembly.Module(base64_decode(WASM_DATA));\r\n // use the binary as the parser's memory\r\n var nBytes = binary.length;\r\n var nPages = ((nBytes + 0xffff) & ~0xffff) >> 16;\r\n var memory = new WebAssembly.Memory({ initial: nPages });\r\n var buffer = new Uint8Array(memory.buffer);\r\n buffer.set(binary);\r\n // provide a way to read strings from memory\r\n parse.readString = function (offset, length) { return utf8_read(buffer, offset, offset + length); };\r\n // instantiate the parser and return its exports\r\n var imports = {\r\n env: {\r\n memory: memory\r\n },\r\n options: {}\r\n };\r\n [\"onSection\",\r\n \"onType\",\r\n \"onTypeParam\",\r\n \"onTypeReturn\",\r\n \"onImport\",\r\n \"onFunctionImport\",\r\n \"onTableImport\",\r\n \"onMemoryImport\",\r\n \"onGlobalImport\",\r\n \"onMemory\",\r\n \"onFunction\",\r\n \"onTable\",\r\n \"onGlobal\",\r\n \"onExport\",\r\n \"onStart\",\r\n \"onSourceMappingURL\",\r\n \"onModuleName\",\r\n \"onFunctionName\",\r\n \"onLocalName\"\r\n ].forEach(function (name) { return imports.options[name] = options[name] || function () { }; });\r\n var instance = new WebAssembly.Instance(compiled, imports);\r\n instance.exports.parse(0, nBytes);\r\n}\r\nexports.parse = parse;\r\n// see: https://github.com/dcodeIO/protobuf.js/tree/master/lib/utf8\r\nfunction utf8_read(buffer, start, end) {\r\n var len = end - start;\r\n if (len < 1)\r\n return \"\";\r\n var parts = null, chunk = [], i = 0, // char offset\r\n t = 0; // temporary\r\n while (start < end) {\r\n t = buffer[start++];\r\n if (t < 128) {\r\n chunk[i++] = t;\r\n }\r\n else if (t > 191 && t < 224) {\r\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\r\n }\r\n else if (t > 239 && t < 365) {\r\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\r\n chunk[i++] = 0xD800 + (t >> 10);\r\n chunk[i++] = 0xDC00 + (t & 1023);\r\n }\r\n else {\r\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\r\n }\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n}\r\n// see: https://github.com/dcodeIO/protobuf.js/tree/master/lib/base64\r\nfunction base64_decode(string) {\r\n var length = string.length;\r\n if (length) {\r\n var n = 0, p = length;\r\n while (--p % 4 > 1 && string.charCodeAt(p) === 61)\r\n ++n;\r\n length = Math.ceil(length * 3) / 4 - n;\r\n }\r\n var buffer = new Uint8Array(length);\r\n var j = 0, o = 0, t = 0;\r\n for (var i = 0, k = string.length; i < k;) {\r\n var c = string.charCodeAt(i++);\r\n if (c === 61 && j > 1)\r\n break;\r\n if ((c = s64[c]) === undefined)\r\n throw Error();\r\n switch (j) {\r\n case 0: {\r\n t = c;\r\n j = 1;\r\n break;\r\n }\r\n case 1: {\r\n buffer[o++] = t << 2 | (c & 48) >> 4;\r\n t = c;\r\n j = 2;\r\n break;\r\n }\r\n case 2: {\r\n buffer[o++] = (t & 15) << 4 | (c & 60) >> 2;\r\n t = c;\r\n j = 3;\r\n break;\r\n }\r\n case 3: {\r\n buffer[o++] = (t & 3) << 6 | c;\r\n j = 0;\r\n break;\r\n }\r\n }\r\n }\r\n if (j === 1)\r\n throw Error();\r\n return buffer;\r\n}\r\nvar s64 = new Array(123);\r\nfor (var i = 0; i < 64;)\r\n s64[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/lib/parse/src/common.ts b/lib/parse/src/common.ts index c6c05dd4..e45100db 100644 --- a/lib/parse/src/common.ts +++ b/lib/parse/src/common.ts @@ -42,11 +42,11 @@ export enum NameType { Local = 2 } -/** Maximum number of pages. */ +/** Maximum number of memory pages. */ export const MAX_PAGES = 0xffff; -/** Maximum number of tables. */ -export const MAX_TABLES = 1; // MVP +/** Maximum number of table elements. */ +export const MAX_ELEMS = 0xffffffff; /** WebAssembly opcodes. */ export enum Opcode { // just a few of these are actually used diff --git a/lib/parse/src/index.ts b/lib/parse/src/index.ts index e2bc316d..69d5a2c8 100644 --- a/lib/parse/src/index.ts +++ b/lib/parse/src/index.ts @@ -31,6 +31,8 @@ export interface ParseOptions { onMemory?(index: number, initial: number, maximum: number, flags: number): void; /** Called with each function if the function section is evaluated. */ onFunction?(index: number, typeIndex: number): void; + /** Called with each table if the table section is evaluated.*/ + onTable?(index: number, type: Type, initial: number, maximum: number, flags: number): void; /** Called with each global if the global section is evaluated. */ onGlobal?(index: number, type: Type, mutability: number): void; /** Called with the start function index if the start section is evaluated. */ @@ -82,6 +84,7 @@ export function parse(binary: Uint8Array, options?: ParseOptions): void { "onGlobalImport", "onMemory", "onFunction", + "onTable", "onGlobal", "onExport", "onStart", diff --git a/lib/parse/tests/index.ts b/lib/parse/tests/index.ts index 86b1f28b..3ca12d4c 100644 --- a/lib/parse/tests/index.ts +++ b/lib/parse/tests/index.ts @@ -54,6 +54,10 @@ function onFunction(funIndex: number, typeIndex: number): void { console.log("- Function[" + funIndex + "] -> FunctionType[" + typeIndex + "]"); } +function onTable(tblIndex: number, type: number, initial: number, maximum: number, flags: number): void { + console.log("- Table[" + tblIndex + "] -> " + Type[type] + ": initial=" + initial + ", maximum=" + (maximum >>> 0)); +} + function onGlobal(gloIndex: number, type: Type, mutability: number): void { console.log("- Global[" + gloIndex + "]: " + (mutability & 1 ? "mutable " : "const ") + Type[type]); } @@ -104,6 +108,7 @@ function onLocalName(funcIndex: number, index: number, offset: number, length: n onGlobalImport, onMemory, onFunction, + onTable, onGlobal, onStart, onExport,