@thomasfosterau/effect-parse 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -13
- package/dist/Ascii.d.ts +11 -4
- package/dist/Ascii.d.ts.map +1 -1
- package/dist/Ascii.js +7 -1
- package/dist/Ascii.js.map +1 -1
- package/dist/Binary.d.ts.map +1 -1
- package/dist/Binary.js +64 -35
- package/dist/Binary.js.map +1 -1
- package/dist/Bits.d.ts.map +1 -1
- package/dist/Bits.js +7 -4
- package/dist/Bits.js.map +1 -1
- package/dist/Compiler.d.ts +74 -2
- package/dist/Compiler.d.ts.map +1 -1
- package/dist/Compiler.js +78 -1
- package/dist/Compiler.js.map +1 -1
- package/dist/Expression.d.ts.map +1 -1
- package/dist/Expression.js +86 -74
- package/dist/Expression.js.map +1 -1
- package/dist/Input.d.ts +37 -4
- package/dist/Input.d.ts.map +1 -1
- package/dist/Input.js +42 -0
- package/dist/Input.js.map +1 -1
- package/dist/Nom.d.ts +5 -15
- package/dist/Nom.d.ts.map +1 -1
- package/dist/Nom.js.map +1 -1
- package/dist/ParseError.d.ts.map +1 -1
- package/dist/ParseError.js.map +1 -1
- package/dist/Parser.d.ts +366 -26
- package/dist/Parser.d.ts.map +1 -1
- package/dist/Parser.js +390 -19
- package/dist/Parser.js.map +1 -1
- package/dist/ParserSchema.js +1 -1
- package/dist/ParserStream.d.ts +3 -2
- package/dist/ParserStream.d.ts.map +1 -1
- package/dist/ParserStream.js +13 -9
- package/dist/ParserStream.js.map +1 -1
- package/dist/Syntax.d.ts +23 -5
- package/dist/Syntax.d.ts.map +1 -1
- package/dist/Syntax.js.map +1 -1
- package/dist/Text.d.ts.map +1 -1
- package/dist/Text.js +9 -9
- package/dist/Text.js.map +1 -1
- package/dist/Token.d.ts +55 -10
- package/dist/Token.d.ts.map +1 -1
- package/dist/Token.js +59 -21
- package/dist/Token.js.map +1 -1
- package/dist/internal/compiler/closure.d.ts.map +1 -1
- package/dist/internal/compiler/closure.js +257 -97
- package/dist/internal/compiler/closure.js.map +1 -1
- package/dist/internal/compiler/entries.d.ts +3 -1
- package/dist/internal/compiler/entries.d.ts.map +1 -1
- package/dist/internal/compiler/entries.js +3 -2
- package/dist/internal/compiler/entries.js.map +1 -1
- package/dist/internal/compiler/first.d.ts.map +1 -1
- package/dist/internal/compiler/first.js +7 -1
- package/dist/internal/compiler/first.js.map +1 -1
- package/dist/internal/compiler/graph.d.ts +17 -0
- package/dist/internal/compiler/graph.d.ts.map +1 -0
- package/dist/internal/compiler/graph.js +56 -0
- package/dist/internal/compiler/graph.js.map +1 -0
- package/dist/internal/compiler/jit.d.ts +5 -0
- package/dist/internal/compiler/jit.d.ts.map +1 -1
- package/dist/internal/compiler/jit.js +185 -96
- package/dist/internal/compiler/jit.js.map +1 -1
- package/dist/internal/compiler/registry.d.ts +10 -2
- package/dist/internal/compiler/registry.d.ts.map +1 -1
- package/dist/internal/compiler/registry.js.map +1 -1
- package/dist/internal/compiler/search.d.ts +32 -0
- package/dist/internal/compiler/search.d.ts.map +1 -0
- package/dist/internal/compiler/search.js +68 -0
- package/dist/internal/compiler/search.js.map +1 -0
- package/dist/internal/compiler/sets.d.ts.map +1 -1
- package/dist/internal/compiler/sets.js +1 -1
- package/dist/internal/compiler/sets.js.map +1 -1
- package/dist/internal/compiler/wasm.d.ts +8 -0
- package/dist/internal/compiler/wasm.d.ts.map +1 -0
- package/dist/internal/compiler/wasm.js +2769 -0
- package/dist/internal/compiler/wasm.js.map +1 -0
- package/dist/internal/compiler/wasmAsm.d.ts +199 -0
- package/dist/internal/compiler/wasmAsm.d.ts.map +1 -0
- package/dist/internal/compiler/wasmAsm.js +427 -0
- package/dist/internal/compiler/wasmAsm.js.map +1 -0
- package/dist/internal/entries.d.ts +3 -1
- package/dist/internal/entries.d.ts.map +1 -1
- package/dist/internal/entries.js.map +1 -1
- package/dist/internal/node.d.ts +58 -2
- package/dist/internal/node.d.ts.map +1 -1
- package/dist/internal/node.js +13 -3
- package/dist/internal/node.js.map +1 -1
- package/dist/internal/numbers.d.ts.map +1 -1
- package/dist/internal/numbers.js.map +1 -1
- package/dist/internal/run.d.ts +12 -0
- package/dist/internal/run.d.ts.map +1 -1
- package/dist/internal/run.js +51 -11
- package/dist/internal/run.js.map +1 -1
- package/dist/internal/stack.d.ts +6 -0
- package/dist/internal/stack.d.ts.map +1 -1
- package/dist/internal/stack.js +8 -2
- package/dist/internal/stack.js.map +1 -1
- package/dist/internal/syntax.d.ts +4 -4
- package/dist/internal/syntax.d.ts.map +1 -1
- package/dist/internal/syntax.js +18 -10
- package/dist/internal/syntax.js.map +1 -1
- package/dist/internal/text.d.ts +32 -0
- package/dist/internal/text.d.ts.map +1 -1
- package/dist/internal/text.js +68 -14
- package/dist/internal/text.js.map +1 -1
- package/dist/internal/tokens.d.ts +13 -0
- package/dist/internal/tokens.d.ts.map +1 -1
- package/dist/internal/tokens.js +59 -39
- package/dist/internal/tokens.js.map +1 -1
- package/package.json +5 -4
- package/src/Ascii.ts +42 -9
- package/src/Binary.ts +151 -71
- package/src/Bits.ts +12 -6
- package/src/Compiler.ts +101 -10
- package/src/Expression.ts +94 -81
- package/src/Input.ts +65 -6
- package/src/Nom.ts +15 -5
- package/src/ParseError.ts +3 -0
- package/src/Parser.ts +678 -127
- package/src/ParserStream.ts +37 -18
- package/src/Syntax.ts +60 -36
- package/src/Text.ts +16 -15
- package/src/Token.ts +138 -29
- package/src/internal/compiler/closure.ts +362 -135
- package/src/internal/compiler/entries.ts +4 -2
- package/src/internal/compiler/first.ts +10 -0
- package/src/internal/compiler/graph.ts +68 -0
- package/src/internal/compiler/jit.ts +284 -154
- package/src/internal/compiler/registry.ts +10 -2
- package/src/internal/compiler/search.ts +68 -0
- package/src/internal/compiler/sets.ts +7 -3
- package/src/internal/compiler/wasm.ts +3203 -0
- package/src/internal/compiler/wasmAsm.ts +484 -0
- package/src/internal/entries.ts +8 -2
- package/src/internal/node.ts +54 -4
- package/src/internal/numbers.ts +3 -1
- package/src/internal/run.ts +71 -12
- package/src/internal/stack.ts +8 -1
- package/src/internal/syntax.ts +39 -18
- package/src/internal/text.ts +97 -9
- package/src/internal/tokens.ts +96 -14
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A small WebAssembly assembler for the WASM compiler: function bodies with
|
|
3
|
+
* structured labels, and the binary module around them. It writes only the
|
|
4
|
+
* instructions and sections that compiler uses.
|
|
5
|
+
*/
|
|
6
|
+
/** Value types. */
|
|
7
|
+
export declare const I32 = 127;
|
|
8
|
+
export declare const I64 = 126;
|
|
9
|
+
export declare const F64 = 124;
|
|
10
|
+
export declare const V128 = 123;
|
|
11
|
+
/** Opcodes used by the compiler. */
|
|
12
|
+
export declare const Op: {
|
|
13
|
+
readonly unreachable: 0;
|
|
14
|
+
readonly block: 2;
|
|
15
|
+
readonly loop: 3;
|
|
16
|
+
readonly if: 4;
|
|
17
|
+
readonly else: 5;
|
|
18
|
+
readonly end: 11;
|
|
19
|
+
readonly br: 12;
|
|
20
|
+
readonly brIf: 13;
|
|
21
|
+
readonly brTable: 14;
|
|
22
|
+
readonly return: 15;
|
|
23
|
+
readonly call: 16;
|
|
24
|
+
readonly drop: 26;
|
|
25
|
+
readonly select: 27;
|
|
26
|
+
readonly localGet: 32;
|
|
27
|
+
readonly localSet: 33;
|
|
28
|
+
readonly localTee: 34;
|
|
29
|
+
readonly globalGet: 35;
|
|
30
|
+
readonly globalSet: 36;
|
|
31
|
+
readonly i32Load: 40;
|
|
32
|
+
readonly i64Load: 41;
|
|
33
|
+
readonly f64Load: 43;
|
|
34
|
+
readonly i32Load8U: 45;
|
|
35
|
+
readonly i32Load16U: 47;
|
|
36
|
+
readonly i32Store: 54;
|
|
37
|
+
readonly i64Store: 55;
|
|
38
|
+
readonly i32Store8: 58;
|
|
39
|
+
readonly i32Store16: 59;
|
|
40
|
+
readonly f64Store: 57;
|
|
41
|
+
readonly i32Const: 65;
|
|
42
|
+
readonly i64Const: 66;
|
|
43
|
+
readonly f64Const: 68;
|
|
44
|
+
readonly i32Eqz: 69;
|
|
45
|
+
readonly i32Eq: 70;
|
|
46
|
+
readonly i32Ne: 71;
|
|
47
|
+
readonly i32LtS: 72;
|
|
48
|
+
readonly i32LtU: 73;
|
|
49
|
+
readonly i32GtS: 74;
|
|
50
|
+
readonly i32GtU: 75;
|
|
51
|
+
readonly i32LeS: 76;
|
|
52
|
+
readonly i32LeU: 77;
|
|
53
|
+
readonly i32GeS: 78;
|
|
54
|
+
readonly i32GeU: 79;
|
|
55
|
+
readonly i64Eqz: 80;
|
|
56
|
+
readonly i64Ne: 82;
|
|
57
|
+
readonly f64Eq: 97;
|
|
58
|
+
readonly f64Ne: 98;
|
|
59
|
+
readonly i32Add: 106;
|
|
60
|
+
readonly i32Sub: 107;
|
|
61
|
+
readonly i32Mul: 108;
|
|
62
|
+
readonly i32And: 113;
|
|
63
|
+
readonly i32Or: 114;
|
|
64
|
+
readonly i32Xor: 115;
|
|
65
|
+
readonly i32Shl: 116;
|
|
66
|
+
readonly i32ShrU: 118;
|
|
67
|
+
readonly i32Ctz: 104;
|
|
68
|
+
readonly i64And: 131;
|
|
69
|
+
readonly i64Or: 132;
|
|
70
|
+
readonly i64Shl: 134;
|
|
71
|
+
readonly i64ShrU: 136;
|
|
72
|
+
readonly f64Abs: 153;
|
|
73
|
+
readonly f64Neg: 154;
|
|
74
|
+
readonly f64Add: 160;
|
|
75
|
+
readonly f64Sub: 161;
|
|
76
|
+
readonly f64Mul: 162;
|
|
77
|
+
readonly f64Div: 163;
|
|
78
|
+
readonly f64ConvertI32U: 184;
|
|
79
|
+
};
|
|
80
|
+
/** Unsigned LEB128. */
|
|
81
|
+
export declare const uleb: (n: number, out?: Array<number>) => Array<number>;
|
|
82
|
+
/** Signed LEB128 of a 32-bit integer. */
|
|
83
|
+
export declare const sleb: (n: number, out?: Array<number>) => Array<number>;
|
|
84
|
+
/** SIMD opcodes, after the `0xfd` prefix. */
|
|
85
|
+
export declare const Simd: {
|
|
86
|
+
readonly v128Load: 0;
|
|
87
|
+
readonly v128Store: 11;
|
|
88
|
+
readonly v128Const: 12;
|
|
89
|
+
readonly i8x16Swizzle: 14;
|
|
90
|
+
readonly i8x16Splat: 15;
|
|
91
|
+
readonly i8x16Eq: 35;
|
|
92
|
+
readonly i8x16Ne: 36;
|
|
93
|
+
readonly v128Not: 77;
|
|
94
|
+
readonly v128And: 78;
|
|
95
|
+
readonly v128Or: 80;
|
|
96
|
+
readonly v128AnyTrue: 83;
|
|
97
|
+
readonly i8x16AllTrue: 99;
|
|
98
|
+
readonly i8x16Bitmask: 100;
|
|
99
|
+
readonly i8x16ShrU: 109;
|
|
100
|
+
readonly i8x16RelaxedSwizzle: 256;
|
|
101
|
+
readonly i16x8ExtendLowI8x16U: 137;
|
|
102
|
+
readonly i16x8ExtendHighI8x16U: 138;
|
|
103
|
+
};
|
|
104
|
+
/** A branch target: a block, a loop or an `if`. */
|
|
105
|
+
export declare class Label {
|
|
106
|
+
readonly _label = true;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The body of a function being written: its code, its locals (after the
|
|
110
|
+
* parameters) and the stack of labels that branches refer to.
|
|
111
|
+
*/
|
|
112
|
+
export declare class Body {
|
|
113
|
+
readonly params: number;
|
|
114
|
+
readonly code: Array<number>;
|
|
115
|
+
/** The types of the locals after the parameters. */
|
|
116
|
+
private readonly types;
|
|
117
|
+
private readonly labels;
|
|
118
|
+
private next;
|
|
119
|
+
/** Trace writes since the last check that dominates the code that follows (see the compiler). */
|
|
120
|
+
writes: number;
|
|
121
|
+
/** The local holding the trace pointer, in the compiler's rule functions. */
|
|
122
|
+
tp: number;
|
|
123
|
+
/** The local holding the end of the input, in the compiler's rule functions (-1: read the global). */
|
|
124
|
+
endLocal: number;
|
|
125
|
+
constructor(params: number);
|
|
126
|
+
/** A new local of type `i32`. */
|
|
127
|
+
local(): number;
|
|
128
|
+
/** A new local of type `i64`. */
|
|
129
|
+
localI64(): number;
|
|
130
|
+
/** A new local of type `v128`. */
|
|
131
|
+
localV128(): number;
|
|
132
|
+
/** A new local of type `f64`. */
|
|
133
|
+
localF64(): number;
|
|
134
|
+
/** The locals declaration, in index order (runs of one type each). */
|
|
135
|
+
locals(): Array<number>;
|
|
136
|
+
op(...bytes: ReadonlyArray<number>): this;
|
|
137
|
+
i32(n: number): this;
|
|
138
|
+
i64(n: bigint): this;
|
|
139
|
+
f64(x: number): this;
|
|
140
|
+
get(l: number): this;
|
|
141
|
+
set(l: number): this;
|
|
142
|
+
tee(l: number): this;
|
|
143
|
+
gget(g: number): this;
|
|
144
|
+
gset(g: number): this;
|
|
145
|
+
call(f: number): this;
|
|
146
|
+
/** `v128.const` of sixteen bytes. */
|
|
147
|
+
v128(bytes: ArrayLike<number>): this;
|
|
148
|
+
/** A SIMD instruction, with a memory access's alignment and offset for loads and stores. */
|
|
149
|
+
simd(op: number, align?: number, offset?: number): this;
|
|
150
|
+
/** A memory access with an alignment exponent and a constant offset. */
|
|
151
|
+
mem(op: number, align: number, offset: number): this;
|
|
152
|
+
/** `block ... end`: a branch to its label exits the block. */
|
|
153
|
+
block(body: (exit: Label) => void): this;
|
|
154
|
+
/** `loop ... end`: a branch to its label restarts the loop. */
|
|
155
|
+
loop(body: (again: Label) => void): this;
|
|
156
|
+
/** `if ... (else ...) end` on the `i32` at the top of the stack. */
|
|
157
|
+
if(then: () => void, otherwise?: () => void): this;
|
|
158
|
+
/** `if (result i32) ... else ... end`. */
|
|
159
|
+
ifI32(then: () => void, otherwise: () => void): this;
|
|
160
|
+
private structured;
|
|
161
|
+
/**
|
|
162
|
+
* Whether a branch went to a label out of scope: a bug in the compiler,
|
|
163
|
+
* which then refuses the function (see the WebAssembly compiler).
|
|
164
|
+
*/
|
|
165
|
+
invalid: boolean;
|
|
166
|
+
private depth;
|
|
167
|
+
br(label: Label): this;
|
|
168
|
+
brIf(label: Label): this;
|
|
169
|
+
/** `br_table`: `targets[i]` for the index at the top of the stack, `otherwise` out of range. */
|
|
170
|
+
brTable(targets: ReadonlyArray<Label>, otherwise: Label): this;
|
|
171
|
+
}
|
|
172
|
+
/** A function type: parameter and result types. */
|
|
173
|
+
export interface FuncType {
|
|
174
|
+
readonly params: ReadonlyArray<number>;
|
|
175
|
+
readonly results: ReadonlyArray<number>;
|
|
176
|
+
}
|
|
177
|
+
/** A global: its type, whether it is mutable, and its initial value. */
|
|
178
|
+
export interface Global {
|
|
179
|
+
readonly type: number;
|
|
180
|
+
readonly init: number;
|
|
181
|
+
}
|
|
182
|
+
/** What a module is made of. */
|
|
183
|
+
export interface ModuleSpec {
|
|
184
|
+
readonly types: ReadonlyArray<FuncType>;
|
|
185
|
+
/** Imported functions: module, name, type index. */
|
|
186
|
+
readonly imports: ReadonlyArray<readonly [string, string, number]>;
|
|
187
|
+
/** The imported memory (module "env", name "mem"). */
|
|
188
|
+
readonly memoryPages: number;
|
|
189
|
+
/** Defined functions: type index and body. */
|
|
190
|
+
readonly functions: ReadonlyArray<readonly [number, Body]>;
|
|
191
|
+
readonly globals: ReadonlyArray<Global>;
|
|
192
|
+
/** Exported functions and globals: name, kind (0 function, 3 global), index. */
|
|
193
|
+
readonly exports: ReadonlyArray<readonly [string, 0 | 3, number]>;
|
|
194
|
+
/** Active data segments: offset and bytes. */
|
|
195
|
+
readonly data: ReadonlyArray<readonly [number, Uint8Array]>;
|
|
196
|
+
}
|
|
197
|
+
/** The binary module. */
|
|
198
|
+
export declare const encodeModule: (spec: ModuleSpec) => Uint8Array<ArrayBuffer>;
|
|
199
|
+
//# sourceMappingURL=wasmAsm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasmAsm.d.ts","names":[],"sources":["../../../src/internal/compiler/wasmAsm.ts"],"mappings":";;;;;;qBAOa;qBACA;qBACA;qBACA;;qBAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAsEA,OAAQ,WAAW,MAAK,kBAAqB;;qBAY7C,OAAQ,WAAW,MAAK,kBAAqB;;qBAc7C;;;;;;;;;;;;;;;;;;;;qBAmCA;WACF;;;;;;qBAOE;WAaU;WAZZ,MAAM;;mBAEE;mBACA;UACT;;EAER;;EAEA;;EAEA;EAEqB,YAAA;;EAKrB;;EAMA;;EAMA;;EAMA;;EAMA,UAAU;EAeV,MAAM,OAAO;EAKb,IAAI;EAMJ,IAAI;EAMJ,IAAI;EAOJ,IAAI;EAMJ,IAAI;EAMJ,IAAI;EAMJ,KAAK;EAML,KAAK;EAML,KAAK;;EAOL,KAAK,OAAO;;EAQZ,KAAK,YAAY,gBAAY;;EAW7B,IAAI,YAAY,eAAe;;EAQ/B,MAAM,OAAO,MAAM;;EAKnB,KAAK,OAAO,OAAO;;EAKnB,GAAG,kBAAkB;;EAcrB,MAAM,kBAAkB;UAWhB;;;;;EAcR;UAEQ;EAMR,GAAG,OAAO;EAMV,KAAK,OAAO;;EAOZ,QAAQ,SAAS,cAAc,QAAQ,WAAW;;;iBAUnC;WACN,QAAQ;WACR,SAAS;;;iBAIH;WACN;WACA;;;iBAIM;WACN,OAAO,cAAc;;WAErB,SAAS;;WAET;;WAEA,WAAW,gCAAgC;WAC3C,SAAS,cAAc;;WAEvB,SAAS;;WAET,MAAM,gCAAgC;;;qBAkCpC,eAAgB,MAAM,eAAa,WAAW"}
|
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
// src/internal/compiler/wasmAsm.ts
|
|
2
|
+
/**
|
|
3
|
+
* A small WebAssembly assembler for the WASM compiler: function bodies with
|
|
4
|
+
* structured labels, and the binary module around them. It writes only the
|
|
5
|
+
* instructions and sections that compiler uses.
|
|
6
|
+
*/
|
|
7
|
+
/** Value types. */
|
|
8
|
+
const I32 = 127;
|
|
9
|
+
const I64 = 126;
|
|
10
|
+
const F64 = 124;
|
|
11
|
+
const V128 = 123;
|
|
12
|
+
const Void = 64;
|
|
13
|
+
/** Opcodes used by the compiler. */
|
|
14
|
+
const Op = {
|
|
15
|
+
unreachable: 0,
|
|
16
|
+
block: 2,
|
|
17
|
+
loop: 3,
|
|
18
|
+
if: 4,
|
|
19
|
+
else: 5,
|
|
20
|
+
end: 11,
|
|
21
|
+
br: 12,
|
|
22
|
+
brIf: 13,
|
|
23
|
+
brTable: 14,
|
|
24
|
+
return: 15,
|
|
25
|
+
call: 16,
|
|
26
|
+
drop: 26,
|
|
27
|
+
select: 27,
|
|
28
|
+
localGet: 32,
|
|
29
|
+
localSet: 33,
|
|
30
|
+
localTee: 34,
|
|
31
|
+
globalGet: 35,
|
|
32
|
+
globalSet: 36,
|
|
33
|
+
i32Load: 40,
|
|
34
|
+
i64Load: 41,
|
|
35
|
+
f64Load: 43,
|
|
36
|
+
i32Load8U: 45,
|
|
37
|
+
i32Load16U: 47,
|
|
38
|
+
i32Store: 54,
|
|
39
|
+
i64Store: 55,
|
|
40
|
+
i32Store8: 58,
|
|
41
|
+
i32Store16: 59,
|
|
42
|
+
f64Store: 57,
|
|
43
|
+
i32Const: 65,
|
|
44
|
+
i64Const: 66,
|
|
45
|
+
f64Const: 68,
|
|
46
|
+
i32Eqz: 69,
|
|
47
|
+
i32Eq: 70,
|
|
48
|
+
i32Ne: 71,
|
|
49
|
+
i32LtS: 72,
|
|
50
|
+
i32LtU: 73,
|
|
51
|
+
i32GtS: 74,
|
|
52
|
+
i32GtU: 75,
|
|
53
|
+
i32LeS: 76,
|
|
54
|
+
i32LeU: 77,
|
|
55
|
+
i32GeS: 78,
|
|
56
|
+
i32GeU: 79,
|
|
57
|
+
i64Eqz: 80,
|
|
58
|
+
i64Ne: 82,
|
|
59
|
+
f64Eq: 97,
|
|
60
|
+
f64Ne: 98,
|
|
61
|
+
i32Add: 106,
|
|
62
|
+
i32Sub: 107,
|
|
63
|
+
i32Mul: 108,
|
|
64
|
+
i32And: 113,
|
|
65
|
+
i32Or: 114,
|
|
66
|
+
i32Xor: 115,
|
|
67
|
+
i32Shl: 116,
|
|
68
|
+
i32ShrU: 118,
|
|
69
|
+
i32Ctz: 104,
|
|
70
|
+
i64And: 131,
|
|
71
|
+
i64Or: 132,
|
|
72
|
+
i64Shl: 134,
|
|
73
|
+
i64ShrU: 136,
|
|
74
|
+
f64Abs: 153,
|
|
75
|
+
f64Neg: 154,
|
|
76
|
+
f64Add: 160,
|
|
77
|
+
f64Sub: 161,
|
|
78
|
+
f64Mul: 162,
|
|
79
|
+
f64Div: 163,
|
|
80
|
+
f64ConvertI32U: 184
|
|
81
|
+
};
|
|
82
|
+
/** Unsigned LEB128. */
|
|
83
|
+
const uleb = (n, out = []) => {
|
|
84
|
+
let v = n >>> 0;
|
|
85
|
+
do {
|
|
86
|
+
let b = v & 127;
|
|
87
|
+
v >>>= 7;
|
|
88
|
+
if (v !== 0) b |= 128;
|
|
89
|
+
out.push(b);
|
|
90
|
+
} while (v !== 0);
|
|
91
|
+
return out;
|
|
92
|
+
};
|
|
93
|
+
/** Signed LEB128 of a 32-bit integer. */
|
|
94
|
+
const sleb = (n, out = []) => {
|
|
95
|
+
let v = n | 0;
|
|
96
|
+
for (;;) {
|
|
97
|
+
const b = v & 127;
|
|
98
|
+
v >>= 7;
|
|
99
|
+
if (v === 0 && (b & 64) === 0 || v === -1 && (b & 64) !== 0) {
|
|
100
|
+
out.push(b);
|
|
101
|
+
return out;
|
|
102
|
+
}
|
|
103
|
+
out.push(b | 128);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
/** SIMD opcodes, after the `0xfd` prefix. */
|
|
107
|
+
const Simd = {
|
|
108
|
+
v128Load: 0,
|
|
109
|
+
v128Store: 11,
|
|
110
|
+
v128Const: 12,
|
|
111
|
+
i8x16Swizzle: 14,
|
|
112
|
+
i8x16Splat: 15,
|
|
113
|
+
i8x16Eq: 35,
|
|
114
|
+
i8x16Ne: 36,
|
|
115
|
+
v128Not: 77,
|
|
116
|
+
v128And: 78,
|
|
117
|
+
v128Or: 80,
|
|
118
|
+
v128AnyTrue: 83,
|
|
119
|
+
i8x16AllTrue: 99,
|
|
120
|
+
i8x16Bitmask: 100,
|
|
121
|
+
i8x16ShrU: 109,
|
|
122
|
+
i8x16RelaxedSwizzle: 256,
|
|
123
|
+
i16x8ExtendLowI8x16U: 137,
|
|
124
|
+
i16x8ExtendHighI8x16U: 138
|
|
125
|
+
};
|
|
126
|
+
/** Signed LEB128 of a 64-bit integer. */
|
|
127
|
+
const sleb64 = (n, out) => {
|
|
128
|
+
let v = BigInt.asIntN(64, n);
|
|
129
|
+
for (;;) {
|
|
130
|
+
const b = Number(v & 127n);
|
|
131
|
+
v >>= 7n;
|
|
132
|
+
if (v === 0n && (b & 64) === 0 || v === -1n && (b & 64) !== 0) {
|
|
133
|
+
out.push(b);
|
|
134
|
+
return out;
|
|
135
|
+
}
|
|
136
|
+
out.push(b | 128);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
/** A branch target: a block, a loop or an `if`. */
|
|
140
|
+
var Label = class {
|
|
141
|
+
_label = true;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* The body of a function being written: its code, its locals (after the
|
|
145
|
+
* parameters) and the stack of labels that branches refer to.
|
|
146
|
+
*/
|
|
147
|
+
var Body = class {
|
|
148
|
+
params;
|
|
149
|
+
code = [];
|
|
150
|
+
/** The types of the locals after the parameters. */
|
|
151
|
+
types = [];
|
|
152
|
+
labels = [];
|
|
153
|
+
next;
|
|
154
|
+
/** Trace writes since the last check that dominates the code that follows (see the compiler). */
|
|
155
|
+
writes = 0;
|
|
156
|
+
/** The local holding the trace pointer, in the compiler's rule functions. */
|
|
157
|
+
tp = -1;
|
|
158
|
+
/** The local holding the end of the input, in the compiler's rule functions (-1: read the global). */
|
|
159
|
+
endLocal = -1;
|
|
160
|
+
constructor(params) {
|
|
161
|
+
this.params = params;
|
|
162
|
+
this.next = params;
|
|
163
|
+
}
|
|
164
|
+
/** A new local of type `i32`. */
|
|
165
|
+
local() {
|
|
166
|
+
this.types.push(127);
|
|
167
|
+
return this.next++;
|
|
168
|
+
}
|
|
169
|
+
/** A new local of type `i64`. */
|
|
170
|
+
localI64() {
|
|
171
|
+
this.types.push(126);
|
|
172
|
+
return this.next++;
|
|
173
|
+
}
|
|
174
|
+
/** A new local of type `v128`. */
|
|
175
|
+
localV128() {
|
|
176
|
+
this.types.push(123);
|
|
177
|
+
return this.next++;
|
|
178
|
+
}
|
|
179
|
+
/** A new local of type `f64`. */
|
|
180
|
+
localF64() {
|
|
181
|
+
this.types.push(124);
|
|
182
|
+
return this.next++;
|
|
183
|
+
}
|
|
184
|
+
/** The locals declaration, in index order (runs of one type each). */
|
|
185
|
+
locals() {
|
|
186
|
+
const groups = [];
|
|
187
|
+
for (const type of this.types) {
|
|
188
|
+
const last = groups[groups.length - 1];
|
|
189
|
+
if (last !== void 0 && last[1] === type) last[0]++;
|
|
190
|
+
else groups.push([1, type]);
|
|
191
|
+
}
|
|
192
|
+
const out = uleb(groups.length);
|
|
193
|
+
for (const [n, type] of groups) {
|
|
194
|
+
uleb(n, out);
|
|
195
|
+
out.push(type);
|
|
196
|
+
}
|
|
197
|
+
return out;
|
|
198
|
+
}
|
|
199
|
+
op(...bytes) {
|
|
200
|
+
for (const b of bytes) this.code.push(b);
|
|
201
|
+
return this;
|
|
202
|
+
}
|
|
203
|
+
i32(n) {
|
|
204
|
+
this.code.push(Op.i32Const);
|
|
205
|
+
sleb(n, this.code);
|
|
206
|
+
return this;
|
|
207
|
+
}
|
|
208
|
+
i64(n) {
|
|
209
|
+
this.code.push(Op.i64Const);
|
|
210
|
+
sleb64(n, this.code);
|
|
211
|
+
return this;
|
|
212
|
+
}
|
|
213
|
+
f64(x) {
|
|
214
|
+
this.code.push(Op.f64Const);
|
|
215
|
+
const bytes = new Uint8Array(new Float64Array([x]).buffer);
|
|
216
|
+
for (const b of bytes) this.code.push(b);
|
|
217
|
+
return this;
|
|
218
|
+
}
|
|
219
|
+
get(l) {
|
|
220
|
+
this.code.push(Op.localGet);
|
|
221
|
+
uleb(l, this.code);
|
|
222
|
+
return this;
|
|
223
|
+
}
|
|
224
|
+
set(l) {
|
|
225
|
+
this.code.push(Op.localSet);
|
|
226
|
+
uleb(l, this.code);
|
|
227
|
+
return this;
|
|
228
|
+
}
|
|
229
|
+
tee(l) {
|
|
230
|
+
this.code.push(Op.localTee);
|
|
231
|
+
uleb(l, this.code);
|
|
232
|
+
return this;
|
|
233
|
+
}
|
|
234
|
+
gget(g) {
|
|
235
|
+
this.code.push(Op.globalGet);
|
|
236
|
+
uleb(g, this.code);
|
|
237
|
+
return this;
|
|
238
|
+
}
|
|
239
|
+
gset(g) {
|
|
240
|
+
this.code.push(Op.globalSet);
|
|
241
|
+
uleb(g, this.code);
|
|
242
|
+
return this;
|
|
243
|
+
}
|
|
244
|
+
call(f) {
|
|
245
|
+
this.code.push(Op.call);
|
|
246
|
+
uleb(f, this.code);
|
|
247
|
+
return this;
|
|
248
|
+
}
|
|
249
|
+
/** `v128.const` of sixteen bytes. */
|
|
250
|
+
v128(bytes) {
|
|
251
|
+
this.code.push(253);
|
|
252
|
+
uleb(Simd.v128Const, this.code);
|
|
253
|
+
for (let i = 0; i < 16; i++) this.code.push((bytes[i] ?? 0) & 255);
|
|
254
|
+
return this;
|
|
255
|
+
}
|
|
256
|
+
/** A SIMD instruction, with a memory access's alignment and offset for loads and stores. */
|
|
257
|
+
simd(op, align = -1, offset = 0) {
|
|
258
|
+
this.code.push(253);
|
|
259
|
+
uleb(op, this.code);
|
|
260
|
+
if (align >= 0) {
|
|
261
|
+
uleb(align, this.code);
|
|
262
|
+
uleb(offset, this.code);
|
|
263
|
+
}
|
|
264
|
+
return this;
|
|
265
|
+
}
|
|
266
|
+
/** A memory access with an alignment exponent and a constant offset. */
|
|
267
|
+
mem(op, align, offset) {
|
|
268
|
+
this.code.push(op);
|
|
269
|
+
uleb(align, this.code);
|
|
270
|
+
uleb(offset, this.code);
|
|
271
|
+
return this;
|
|
272
|
+
}
|
|
273
|
+
/** `block ... end`: a branch to its label exits the block. */
|
|
274
|
+
block(body) {
|
|
275
|
+
return this.structured(Op.block, body);
|
|
276
|
+
}
|
|
277
|
+
/** `loop ... end`: a branch to its label restarts the loop. */
|
|
278
|
+
loop(body) {
|
|
279
|
+
return this.structured(Op.loop, body);
|
|
280
|
+
}
|
|
281
|
+
/** `if ... (else ...) end` on the `i32` at the top of the stack. */
|
|
282
|
+
if(then, otherwise) {
|
|
283
|
+
this.code.push(Op.if, Void);
|
|
284
|
+
this.labels.push(new Label());
|
|
285
|
+
then();
|
|
286
|
+
if (otherwise !== void 0) {
|
|
287
|
+
this.code.push(Op.else);
|
|
288
|
+
otherwise();
|
|
289
|
+
}
|
|
290
|
+
this.labels.pop();
|
|
291
|
+
this.code.push(Op.end);
|
|
292
|
+
return this;
|
|
293
|
+
}
|
|
294
|
+
/** `if (result i32) ... else ... end`. */
|
|
295
|
+
ifI32(then, otherwise) {
|
|
296
|
+
this.code.push(Op.if, 127);
|
|
297
|
+
this.labels.push(new Label());
|
|
298
|
+
then();
|
|
299
|
+
this.code.push(Op.else);
|
|
300
|
+
otherwise();
|
|
301
|
+
this.labels.pop();
|
|
302
|
+
this.code.push(Op.end);
|
|
303
|
+
return this;
|
|
304
|
+
}
|
|
305
|
+
structured(op, body) {
|
|
306
|
+
const label = new Label();
|
|
307
|
+
this.code.push(op, Void);
|
|
308
|
+
this.labels.push(label);
|
|
309
|
+
body(label);
|
|
310
|
+
this.labels.pop();
|
|
311
|
+
this.code.push(Op.end);
|
|
312
|
+
return this;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Whether a branch went to a label out of scope: a bug in the compiler,
|
|
316
|
+
* which then refuses the function (see the WebAssembly compiler).
|
|
317
|
+
*/
|
|
318
|
+
invalid = false;
|
|
319
|
+
depth(label) {
|
|
320
|
+
const i = this.labels.lastIndexOf(label);
|
|
321
|
+
if (i < 0) this.invalid = true;
|
|
322
|
+
return this.labels.length - 1 - i;
|
|
323
|
+
}
|
|
324
|
+
br(label) {
|
|
325
|
+
this.code.push(Op.br);
|
|
326
|
+
uleb(this.depth(label), this.code);
|
|
327
|
+
return this;
|
|
328
|
+
}
|
|
329
|
+
brIf(label) {
|
|
330
|
+
this.code.push(Op.brIf);
|
|
331
|
+
uleb(this.depth(label), this.code);
|
|
332
|
+
return this;
|
|
333
|
+
}
|
|
334
|
+
/** `br_table`: `targets[i]` for the index at the top of the stack, `otherwise` out of range. */
|
|
335
|
+
brTable(targets, otherwise) {
|
|
336
|
+
this.code.push(Op.brTable);
|
|
337
|
+
uleb(targets.length, this.code);
|
|
338
|
+
for (const t of targets) uleb(this.depth(t), this.code);
|
|
339
|
+
uleb(this.depth(otherwise), this.code);
|
|
340
|
+
return this;
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
const utf8Encoder = /*#__PURE__*/ new TextEncoder();
|
|
344
|
+
/** Appends `bytes` to `out`. */
|
|
345
|
+
const append = (out, bytes) => {
|
|
346
|
+
for (let i = 0; i < bytes.length; i++) out.push(bytes[i]);
|
|
347
|
+
};
|
|
348
|
+
/** Appends a name: its length and its UTF-8 bytes. */
|
|
349
|
+
const name = (out, s) => {
|
|
350
|
+
const bytes = utf8Encoder.encode(s);
|
|
351
|
+
uleb(bytes.length, out);
|
|
352
|
+
append(out, bytes);
|
|
353
|
+
};
|
|
354
|
+
/** Appends a section: its id, its size, the number of its items and the items `write` appends. */
|
|
355
|
+
const section = (out, id, items, write) => {
|
|
356
|
+
const body = uleb(items.length);
|
|
357
|
+
for (const item of items) write(body, item);
|
|
358
|
+
out.push(id);
|
|
359
|
+
uleb(body.length, out);
|
|
360
|
+
append(out, body);
|
|
361
|
+
};
|
|
362
|
+
const f64Bytes = (x) => new Uint8Array(new Float64Array([x]).buffer);
|
|
363
|
+
/** The binary module. */
|
|
364
|
+
const encodeModule = (spec) => {
|
|
365
|
+
const out = [
|
|
366
|
+
0,
|
|
367
|
+
97,
|
|
368
|
+
115,
|
|
369
|
+
109,
|
|
370
|
+
1,
|
|
371
|
+
0,
|
|
372
|
+
0,
|
|
373
|
+
0
|
|
374
|
+
];
|
|
375
|
+
section(out, 1, spec.types, (body, t) => {
|
|
376
|
+
body.push(96);
|
|
377
|
+
uleb(t.params.length, body);
|
|
378
|
+
append(body, t.params);
|
|
379
|
+
uleb(t.results.length, body);
|
|
380
|
+
append(body, t.results);
|
|
381
|
+
});
|
|
382
|
+
const memory = [
|
|
383
|
+
"env",
|
|
384
|
+
"mem",
|
|
385
|
+
-1
|
|
386
|
+
];
|
|
387
|
+
section(out, 2, [...spec.imports, memory], (body, [m, n, t]) => {
|
|
388
|
+
name(body, m);
|
|
389
|
+
name(body, n);
|
|
390
|
+
if (t < 0) body.push(2, 0, ...uleb(spec.memoryPages));
|
|
391
|
+
else body.push(0, ...uleb(t));
|
|
392
|
+
});
|
|
393
|
+
section(out, 3, spec.functions, (body, [t]) => uleb(t, body));
|
|
394
|
+
section(out, 6, spec.globals, (body, g) => {
|
|
395
|
+
if (g.type === 124) {
|
|
396
|
+
body.push(124, 1, Op.f64Const);
|
|
397
|
+
append(body, f64Bytes(g.init));
|
|
398
|
+
} else {
|
|
399
|
+
body.push(127, 1, Op.i32Const);
|
|
400
|
+
sleb(g.init, body);
|
|
401
|
+
}
|
|
402
|
+
body.push(Op.end);
|
|
403
|
+
});
|
|
404
|
+
section(out, 7, spec.exports, (body, [n, kind, i]) => {
|
|
405
|
+
name(body, n);
|
|
406
|
+
body.push(kind);
|
|
407
|
+
uleb(i, body);
|
|
408
|
+
});
|
|
409
|
+
section(out, 10, spec.functions, (body, [, fn]) => {
|
|
410
|
+
const locals = fn.locals();
|
|
411
|
+
uleb(locals.length + fn.code.length + 1, body);
|
|
412
|
+
append(body, locals);
|
|
413
|
+
append(body, fn.code);
|
|
414
|
+
body.push(Op.end);
|
|
415
|
+
});
|
|
416
|
+
section(out, 11, spec.data, (body, [offset, bytes]) => {
|
|
417
|
+
body.push(0, Op.i32Const);
|
|
418
|
+
sleb(offset, body);
|
|
419
|
+
body.push(Op.end);
|
|
420
|
+
uleb(bytes.length, body);
|
|
421
|
+
append(body, bytes);
|
|
422
|
+
});
|
|
423
|
+
return new Uint8Array(out);
|
|
424
|
+
};
|
|
425
|
+
export { Body, F64, I32, I64, Label, Op, Simd, V128, encodeModule, sleb, uleb };
|
|
426
|
+
|
|
427
|
+
//# sourceMappingURL=wasmAsm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasmAsm.js","names":[],"sources":["../../../src/internal/compiler/wasmAsm.ts"],"sourcesContent":["/**\n * A small WebAssembly assembler for the WASM compiler: function bodies with\n * structured labels, and the binary module around them. It writes only the\n * instructions and sections that compiler uses.\n */\n\n/** Value types. */\nexport const I32 = 0x7f\nexport const I64 = 0x7e\nexport const F64 = 0x7c\nexport const V128 = 0x7b\nconst Void = 0x40\n\n/** Opcodes used by the compiler. */\nexport const Op = {\n unreachable: 0x00,\n block: 0x02,\n loop: 0x03,\n if: 0x04,\n else: 0x05,\n end: 0x0b,\n br: 0x0c,\n brIf: 0x0d,\n brTable: 0x0e,\n return: 0x0f,\n call: 0x10,\n drop: 0x1a,\n select: 0x1b,\n localGet: 0x20,\n localSet: 0x21,\n localTee: 0x22,\n globalGet: 0x23,\n globalSet: 0x24,\n i32Load: 0x28,\n i64Load: 0x29,\n f64Load: 0x2b,\n i32Load8U: 0x2d,\n i32Load16U: 0x2f,\n i32Store: 0x36,\n i64Store: 0x37,\n i32Store8: 0x3a,\n i32Store16: 0x3b,\n f64Store: 0x39,\n i32Const: 0x41,\n i64Const: 0x42,\n f64Const: 0x44,\n i32Eqz: 0x45,\n i32Eq: 0x46,\n i32Ne: 0x47,\n i32LtS: 0x48,\n i32LtU: 0x49,\n i32GtS: 0x4a,\n i32GtU: 0x4b,\n i32LeS: 0x4c,\n i32LeU: 0x4d,\n i32GeS: 0x4e,\n i32GeU: 0x4f,\n i64Eqz: 0x50,\n i64Ne: 0x52,\n f64Eq: 0x61,\n f64Ne: 0x62,\n i32Add: 0x6a,\n i32Sub: 0x6b,\n i32Mul: 0x6c,\n i32And: 0x71,\n i32Or: 0x72,\n i32Xor: 0x73,\n i32Shl: 0x74,\n i32ShrU: 0x76,\n i32Ctz: 0x68,\n i64And: 0x83,\n i64Or: 0x84,\n i64Shl: 0x86,\n i64ShrU: 0x88,\n f64Abs: 0x99,\n f64Neg: 0x9a,\n f64Add: 0xa0,\n f64Sub: 0xa1,\n f64Mul: 0xa2,\n f64Div: 0xa3,\n f64ConvertI32U: 0xb8\n} as const\n\n/** Unsigned LEB128. */\nexport const uleb = (n: number, out: Array<number> = []): Array<number> => {\n let v = n >>> 0\n do {\n let b = v & 0x7f\n v >>>= 7\n if (v !== 0) b |= 0x80\n out.push(b)\n } while (v !== 0)\n return out\n}\n\n/** Signed LEB128 of a 32-bit integer. */\nexport const sleb = (n: number, out: Array<number> = []): Array<number> => {\n let v = n | 0\n for (;;) {\n const b = v & 0x7f\n v >>= 7\n if ((v === 0 && (b & 0x40) === 0) || (v === -1 && (b & 0x40) !== 0)) {\n out.push(b)\n return out\n }\n out.push(b | 0x80)\n }\n}\n\n/** SIMD opcodes, after the `0xfd` prefix. */\nexport const Simd = {\n v128Load: 0x00,\n v128Store: 0x0b,\n v128Const: 0x0c,\n i8x16Swizzle: 0x0e,\n i8x16Splat: 0x0f,\n i8x16Eq: 0x23,\n i8x16Ne: 0x24,\n v128Not: 0x4d,\n v128And: 0x4e,\n v128Or: 0x50,\n v128AnyTrue: 0x53,\n i8x16AllTrue: 0x63,\n i8x16Bitmask: 0x64,\n i8x16ShrU: 0x6d,\n i8x16RelaxedSwizzle: 0x100,\n i16x8ExtendLowI8x16U: 0x89,\n i16x8ExtendHighI8x16U: 0x8a\n} as const\n\n/** Signed LEB128 of a 64-bit integer. */\nconst sleb64 = (n: bigint, out: Array<number>): Array<number> => {\n let v = BigInt.asIntN(64, n)\n for (;;) {\n const b = Number(v & 0x7fn)\n v >>= 7n\n if ((v === 0n && (b & 0x40) === 0) || (v === -1n && (b & 0x40) !== 0)) {\n out.push(b)\n return out\n }\n out.push(b | 0x80)\n }\n}\n\n/** A branch target: a block, a loop or an `if`. */\nexport class Label {\n readonly _label = true\n}\n\n/**\n * The body of a function being written: its code, its locals (after the\n * parameters) and the stack of labels that branches refer to.\n */\nexport class Body {\n readonly code: Array<number> = []\n /** The types of the locals after the parameters. */\n private readonly types: Array<number> = []\n private readonly labels: Array<Label> = []\n private next: number\n /** Trace writes since the last check that dominates the code that follows (see the compiler). */\n writes = 0\n /** The local holding the trace pointer, in the compiler's rule functions. */\n tp = -1\n /** The local holding the end of the input, in the compiler's rule functions (-1: read the global). */\n endLocal = -1\n\n constructor(readonly params: number) {\n this.next = params\n }\n\n /** A new local of type `i32`. */\n local(): number {\n this.types.push(I32)\n return this.next++\n }\n\n /** A new local of type `i64`. */\n localI64(): number {\n this.types.push(I64)\n return this.next++\n }\n\n /** A new local of type `v128`. */\n localV128(): number {\n this.types.push(V128)\n return this.next++\n }\n\n /** A new local of type `f64`. */\n localF64(): number {\n this.types.push(F64)\n return this.next++\n }\n\n /** The locals declaration, in index order (runs of one type each). */\n locals(): Array<number> {\n const groups: Array<[number, number]> = []\n for (const type of this.types) {\n const last = groups[groups.length - 1]\n if (last !== undefined && last[1] === type) last[0]++\n else groups.push([1, type])\n }\n const out = uleb(groups.length)\n for (const [n, type] of groups) {\n uleb(n, out)\n out.push(type)\n }\n return out\n }\n\n op(...bytes: ReadonlyArray<number>): this {\n for (const b of bytes) this.code.push(b)\n return this\n }\n\n i32(n: number): this {\n this.code.push(Op.i32Const)\n sleb(n, this.code)\n return this\n }\n\n i64(n: bigint): this {\n this.code.push(Op.i64Const)\n sleb64(n, this.code)\n return this\n }\n\n f64(x: number): this {\n this.code.push(Op.f64Const)\n const bytes = new Uint8Array(new Float64Array([x]).buffer)\n for (const b of bytes) this.code.push(b)\n return this\n }\n\n get(l: number): this {\n this.code.push(Op.localGet)\n uleb(l, this.code)\n return this\n }\n\n set(l: number): this {\n this.code.push(Op.localSet)\n uleb(l, this.code)\n return this\n }\n\n tee(l: number): this {\n this.code.push(Op.localTee)\n uleb(l, this.code)\n return this\n }\n\n gget(g: number): this {\n this.code.push(Op.globalGet)\n uleb(g, this.code)\n return this\n }\n\n gset(g: number): this {\n this.code.push(Op.globalSet)\n uleb(g, this.code)\n return this\n }\n\n call(f: number): this {\n this.code.push(Op.call)\n uleb(f, this.code)\n return this\n }\n\n /** `v128.const` of sixteen bytes. */\n v128(bytes: ArrayLike<number>): this {\n this.code.push(0xfd)\n uleb(Simd.v128Const, this.code)\n for (let i = 0; i < 16; i++) this.code.push((bytes[i] ?? 0) & 0xff)\n return this\n }\n\n /** A SIMD instruction, with a memory access's alignment and offset for loads and stores. */\n simd(op: number, align = -1, offset = 0): this {\n this.code.push(0xfd)\n uleb(op, this.code)\n if (align >= 0) {\n uleb(align, this.code)\n uleb(offset, this.code)\n }\n return this\n }\n\n /** A memory access with an alignment exponent and a constant offset. */\n mem(op: number, align: number, offset: number): this {\n this.code.push(op)\n uleb(align, this.code)\n uleb(offset, this.code)\n return this\n }\n\n /** `block ... end`: a branch to its label exits the block. */\n block(body: (exit: Label) => void): this {\n return this.structured(Op.block, body)\n }\n\n /** `loop ... end`: a branch to its label restarts the loop. */\n loop(body: (again: Label) => void): this {\n return this.structured(Op.loop, body)\n }\n\n /** `if ... (else ...) end` on the `i32` at the top of the stack. */\n if(then: () => void, otherwise?: () => void): this {\n this.code.push(Op.if, Void)\n this.labels.push(new Label())\n then()\n if (otherwise !== undefined) {\n this.code.push(Op.else)\n otherwise()\n }\n this.labels.pop()\n this.code.push(Op.end)\n return this\n }\n\n /** `if (result i32) ... else ... end`. */\n ifI32(then: () => void, otherwise: () => void): this {\n this.code.push(Op.if, I32)\n this.labels.push(new Label())\n then()\n this.code.push(Op.else)\n otherwise()\n this.labels.pop()\n this.code.push(Op.end)\n return this\n }\n\n private structured(op: number, body: (label: Label) => void): this {\n const label = new Label()\n this.code.push(op, Void)\n this.labels.push(label)\n body(label)\n this.labels.pop()\n this.code.push(Op.end)\n return this\n }\n\n /**\n * Whether a branch went to a label out of scope: a bug in the compiler,\n * which then refuses the function (see the WebAssembly compiler).\n */\n invalid = false\n\n private depth(label: Label): number {\n const i = this.labels.lastIndexOf(label)\n if (i < 0) this.invalid = true\n return this.labels.length - 1 - i\n }\n\n br(label: Label): this {\n this.code.push(Op.br)\n uleb(this.depth(label), this.code)\n return this\n }\n\n brIf(label: Label): this {\n this.code.push(Op.brIf)\n uleb(this.depth(label), this.code)\n return this\n }\n\n /** `br_table`: `targets[i]` for the index at the top of the stack, `otherwise` out of range. */\n brTable(targets: ReadonlyArray<Label>, otherwise: Label): this {\n this.code.push(Op.brTable)\n uleb(targets.length, this.code)\n for (const t of targets) uleb(this.depth(t), this.code)\n uleb(this.depth(otherwise), this.code)\n return this\n }\n}\n\n/** A function type: parameter and result types. */\nexport interface FuncType {\n readonly params: ReadonlyArray<number>\n readonly results: ReadonlyArray<number>\n}\n\n/** A global: its type, whether it is mutable, and its initial value. */\nexport interface Global {\n readonly type: number\n readonly init: number\n}\n\n/** What a module is made of. */\nexport interface ModuleSpec {\n readonly types: ReadonlyArray<FuncType>\n /** Imported functions: module, name, type index. */\n readonly imports: ReadonlyArray<readonly [string, string, number]>\n /** The imported memory (module \"env\", name \"mem\"). */\n readonly memoryPages: number\n /** Defined functions: type index and body. */\n readonly functions: ReadonlyArray<readonly [number, Body]>\n readonly globals: ReadonlyArray<Global>\n /** Exported functions and globals: name, kind (0 function, 3 global), index. */\n readonly exports: ReadonlyArray<readonly [string, 0 | 3, number]>\n /** Active data segments: offset and bytes. */\n readonly data: ReadonlyArray<readonly [number, Uint8Array]>\n}\n\nconst utf8Encoder = /*#__PURE__*/ new TextEncoder()\n\n/** Appends `bytes` to `out`. */\nconst append = (out: Array<number>, bytes: ArrayLike<number>): void => {\n for (let i = 0; i < bytes.length; i++) out.push(bytes[i])\n}\n\n/** Appends a name: its length and its UTF-8 bytes. */\nconst name = (out: Array<number>, s: string): void => {\n const bytes = utf8Encoder.encode(s)\n uleb(bytes.length, out)\n append(out, bytes)\n}\n\n/** Appends a section: its id, its size, the number of its items and the items `write` appends. */\nconst section = <A>(\n out: Array<number>,\n id: number,\n items: ReadonlyArray<A>,\n write: (body: Array<number>, item: A) => void\n) => {\n const body = uleb(items.length)\n for (const item of items) write(body, item)\n out.push(id)\n uleb(body.length, out)\n append(out, body)\n}\n\nconst f64Bytes = (x: number): Uint8Array => new Uint8Array(new Float64Array([x]).buffer)\n\n/** The binary module. */\nexport const encodeModule = (spec: ModuleSpec): Uint8Array<ArrayBuffer> => {\n const out = [0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00]\n section(out, 1, spec.types, (body, t) => {\n body.push(0x60)\n uleb(t.params.length, body)\n append(body, t.params)\n uleb(t.results.length, body)\n append(body, t.results)\n })\n const memory: readonly [string, string, number] = [\"env\", \"mem\", -1]\n section(out, 2, [...spec.imports, memory], (body, [m, n, t]) => {\n name(body, m)\n name(body, n)\n if (t < 0) body.push(0x02, 0x00, ...uleb(spec.memoryPages))\n else body.push(0x00, ...uleb(t))\n })\n section(out, 3, spec.functions, (body, [t]) => uleb(t, body))\n section(out, 6, spec.globals, (body, g) => {\n if (g.type === F64) {\n body.push(F64, 0x01, Op.f64Const)\n append(body, f64Bytes(g.init))\n } else {\n body.push(I32, 0x01, Op.i32Const)\n sleb(g.init, body)\n }\n body.push(Op.end)\n })\n section(out, 7, spec.exports, (body, [n, kind, i]) => {\n name(body, n)\n body.push(kind)\n uleb(i, body)\n })\n section(out, 10, spec.functions, (body, [, fn]) => {\n const locals = fn.locals()\n uleb(locals.length + fn.code.length + 1, body)\n append(body, locals)\n append(body, fn.code)\n body.push(Op.end)\n })\n section(out, 11, spec.data, (body, [offset, bytes]) => {\n body.push(0x00, Op.i32Const)\n sleb(offset, body)\n body.push(Op.end)\n uleb(bytes.length, body)\n append(body, bytes)\n })\n return new Uint8Array(out)\n}\n"],"mappings":";;;;;;;AAOA,MAAa,MAAM;AACnB,MAAa,MA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AAS,EAAE,IAAI,CAAC;EAC/B,OAAO;GACL,KAAK,KAAA,KAAU,GAAM,GAAG,QAAQ;GAChC,KAAK,EAAE,MAAM,IAAI;EACnB;EACA,KAAK,KAAK,GAAG,GAAG;CAClB,CAAC;CACD,QAAQ,KAAK,GAAG,KAAK,UAAU,MAAM,CAAC,GAAG,MAAM,OAAO;EACpD,KAAK,MAAM,CAAC;EACZ,KAAK,KAAK,IAAI;EACd,KAAK,GAAG,IAAI;CACd,CAAC;CACD,QAAQ,KAAK,IAAI,KAAK,YAAY,MAAM,GAAG,QAAQ;EACjD,MAAM,SAAS,GAAG,OAAO;EACzB,KAAK,OAAO,SAAS,GAAG,KAAK,SAAS,GAAG,IAAI;EAC7C,OAAO,MAAM,MAAM;EACnB,OAAO,MAAM,GAAG,IAAI;EACpB,KAAK,KAAK,GAAG,GAAG;CAClB,CAAC;CACD,QAAQ,KAAK,IAAI,KAAK,OAAO,MAAM,CAAC,QAAQ,WAAW;EACrD,KAAK,KAAK,GAAM,GAAG,QAAQ;EAC3B,KAAK,QAAQ,IAAI;EACjB,KAAK,KAAK,GAAG,GAAG;EAChB,KAAK,MAAM,QAAQ,IAAI;EACvB,OAAO,MAAM,KAAK;CACpB,CAAC;CACD,OAAO,IAAI,WAAW,GAAG;AAC3B"}
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* `[key, value]` pairs: the compilers use these when a parser maps a
|
|
4
4
|
* repetition of pairs with `Object.fromEntries` (see `Parser.fromEntries`).
|
|
5
5
|
*/
|
|
6
|
+
type FromEntries = <K extends PropertyKey, V>(entries: Iterable<readonly [K, V]>) => { [P in K]: V; };
|
|
6
7
|
/** The built-in `Object.fromEntries`, which compiled parsers recognize. */
|
|
7
|
-
export declare const fromEntries:
|
|
8
|
+
export declare const fromEntries: FromEntries;
|
|
8
9
|
/**
|
|
9
10
|
* Whether `o[key] = value` on a new plain object creates the same property
|
|
10
11
|
* as `Object.fromEntries` (a writable, enumerable, configurable data
|
|
@@ -22,4 +23,5 @@ export declare const isPlainKey: (key: unknown) => key is string;
|
|
|
22
23
|
export declare const addEntry: (o: object, deferred: Array<unknown> | undefined, key: unknown, value: unknown) => Array<unknown> | undefined;
|
|
23
24
|
/** Adds the deferred entries of {@link addEntry} to `o`, in order. */
|
|
24
25
|
export declare const flushEntries: (o: object, deferred: ReadonlyArray<unknown>) => void;
|
|
26
|
+
export {};
|
|
25
27
|
//# sourceMappingURL=entries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entries.d.ts","names":[],"sources":["../../src/internal/entries.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"entries.d.ts","names":[],"sources":["../../src/internal/entries.ts"],"mappings":";;;;;KAQK,eAAe,UAAU,aAAa,GAAG,SAAS,mBAAmB,GAAG,WAAW,KAAK,IAAI;;qBAKpF,aAAa;;;;;;;qBAUb,aAAc,iBAAe;;;;;;;;qBAiB7B,WACX,WACA,UAAU,4BACV,cACA,mBACC;;qBAWU,eAAgB,WAAW,UAAU"}
|