@wasmgroundup/emit 0.2.12 → 0.2.14
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/dist/index.d.ts +9 -3
- package/dist/index.js +23 -5
- package/index.ts +27 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -81,6 +81,8 @@ declare const instr: {
|
|
|
81
81
|
div: number;
|
|
82
82
|
};
|
|
83
83
|
f64: {
|
|
84
|
+
load: number;
|
|
85
|
+
store: number;
|
|
84
86
|
const: number;
|
|
85
87
|
add: number;
|
|
86
88
|
sub: number;
|
|
@@ -95,10 +97,13 @@ declare function locals(n: number, type: valtype): BytecodeFragment;
|
|
|
95
97
|
declare function import_(mod: string, nm: string, d: BytecodeFragment): BytecodeFragment;
|
|
96
98
|
declare function importsec(ims: BytecodeFragment): BytecodeFragment;
|
|
97
99
|
declare const importdesc: {
|
|
98
|
-
func(x:
|
|
100
|
+
func(x: BytecodeFragment): BytecodeFragment;
|
|
101
|
+
table(tt: BytecodeFragment): BytecodeFragment;
|
|
102
|
+
mem(mt: BytecodeFragment): BytecodeFragment;
|
|
103
|
+
global(gt: BytecodeFragment): BytecodeFragment;
|
|
99
104
|
};
|
|
100
|
-
declare function mem(memtype: any): any;
|
|
101
105
|
declare function memsec(mems: BytecodeFragment[]): (number | BytecodeFragment)[];
|
|
106
|
+
declare function memtype(limits: BytecodeFragment): BytecodeFragment;
|
|
102
107
|
declare const limits: {
|
|
103
108
|
min(n: number): (number | number[])[];
|
|
104
109
|
minmax(n: number, m: number): (number | number[])[];
|
|
@@ -123,4 +128,5 @@ declare function data(x: BytecodeFragment, e: BytecodeFragment, bs: BytecodeFrag
|
|
|
123
128
|
declare function datasec(segs: BytecodeFragment[]): (number | BytecodeFragment)[];
|
|
124
129
|
declare function elem(x: BytecodeFragment, e: BytecodeFragment, ys: BytecodeFragment[]): BytecodeFragment[];
|
|
125
130
|
declare function elemsec(segs: BytecodeFragment[]): (number | BytecodeFragment)[];
|
|
126
|
-
|
|
131
|
+
declare function memarg(align: number, offset: number): number[][];
|
|
132
|
+
export { blocktype, BytecodeFragment, code, codesec, data, datasec, elem, elemsec, elemtype, export_, exportdesc, exportsec, f64, func, funcidx, funcsec, functype, global, globalsec, globaltype, i32, import_, importdesc, importsec, instr, limits, locals, memarg, memsec, memtype, module, mut, name, section, start, startsec, table, tableidx, tablesec, tabletype, typeidx, typesec, u32, valtype, vec, };
|
package/dist/index.js
CHANGED
|
@@ -151,6 +151,8 @@ const instr = {
|
|
|
151
151
|
div: 0x95,
|
|
152
152
|
},
|
|
153
153
|
f64: {
|
|
154
|
+
load: 0x2b,
|
|
155
|
+
store: 0x39,
|
|
154
156
|
const: 0x44,
|
|
155
157
|
add: 0xa0,
|
|
156
158
|
sub: 0xa1,
|
|
@@ -214,16 +216,29 @@ function importsec(ims) {
|
|
|
214
216
|
const importdesc = {
|
|
215
217
|
// x:typeidx
|
|
216
218
|
func(x) {
|
|
217
|
-
return [0x00,
|
|
219
|
+
return [0x00, x];
|
|
220
|
+
},
|
|
221
|
+
// tt:tabletype
|
|
222
|
+
table(tt) {
|
|
223
|
+
return [0x01, tt];
|
|
224
|
+
},
|
|
225
|
+
// mt:memtype
|
|
226
|
+
mem(mt) {
|
|
227
|
+
return [0x02, mt];
|
|
228
|
+
},
|
|
229
|
+
// gt:globaltype
|
|
230
|
+
global(gt) {
|
|
231
|
+
return [0x03, gt];
|
|
218
232
|
},
|
|
219
233
|
};
|
|
220
234
|
const memidx = u32;
|
|
221
|
-
function mem(memtype) {
|
|
222
|
-
return memtype;
|
|
223
|
-
}
|
|
224
235
|
function memsec(mems) {
|
|
225
236
|
return section(SECTION_ID_MEMORY, vec(mems));
|
|
226
237
|
}
|
|
238
|
+
// lim:limits
|
|
239
|
+
function memtype(limits) {
|
|
240
|
+
return limits;
|
|
241
|
+
}
|
|
227
242
|
const limits = {
|
|
228
243
|
min(n) {
|
|
229
244
|
return [0x00, u32(n)];
|
|
@@ -279,4 +294,7 @@ function elem(x, e, ys) {
|
|
|
279
294
|
function elemsec(segs) {
|
|
280
295
|
return section(SECTION_ID_ELEMENT, vec(segs));
|
|
281
296
|
}
|
|
282
|
-
|
|
297
|
+
function memarg(align, offset) {
|
|
298
|
+
return [u32(align), u32(offset)];
|
|
299
|
+
}
|
|
300
|
+
export { blocktype, code, codesec, data, datasec, elem, elemsec, elemtype, export_, exportdesc, exportsec, f64, func, funcidx, funcsec, functype, global, globalsec, globaltype, i32, import_, importdesc, importsec, instr, limits, locals, memarg, memsec, memtype, module, mut, name, section, start, startsec, table, tableidx, tablesec, tabletype, typeidx, typesec, u32, valtype, vec, };
|
package/index.ts
CHANGED
|
@@ -183,6 +183,8 @@ const instr = {
|
|
|
183
183
|
div: 0x95,
|
|
184
184
|
},
|
|
185
185
|
f64: {
|
|
186
|
+
load: 0x2b,
|
|
187
|
+
store: 0x39,
|
|
186
188
|
const: 0x44,
|
|
187
189
|
add: 0xa0,
|
|
188
190
|
sub: 0xa1,
|
|
@@ -260,21 +262,34 @@ function importsec(ims: BytecodeFragment): BytecodeFragment {
|
|
|
260
262
|
|
|
261
263
|
const importdesc = {
|
|
262
264
|
// x:typeidx
|
|
263
|
-
func(x:
|
|
264
|
-
return [0x00,
|
|
265
|
+
func(x: BytecodeFragment): BytecodeFragment {
|
|
266
|
+
return [0x00, x];
|
|
267
|
+
},
|
|
268
|
+
// tt:tabletype
|
|
269
|
+
table(tt: BytecodeFragment): BytecodeFragment {
|
|
270
|
+
return [0x01, tt];
|
|
271
|
+
},
|
|
272
|
+
// mt:memtype
|
|
273
|
+
mem(mt: BytecodeFragment): BytecodeFragment {
|
|
274
|
+
return [0x02, mt];
|
|
275
|
+
},
|
|
276
|
+
// gt:globaltype
|
|
277
|
+
global(gt: BytecodeFragment): BytecodeFragment {
|
|
278
|
+
return [0x03, gt];
|
|
265
279
|
},
|
|
266
280
|
};
|
|
267
281
|
|
|
268
282
|
const memidx = u32;
|
|
269
283
|
|
|
270
|
-
function mem(memtype) {
|
|
271
|
-
return memtype;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
284
|
function memsec(mems: BytecodeFragment[]) {
|
|
275
285
|
return section(SECTION_ID_MEMORY, vec(mems));
|
|
276
286
|
}
|
|
277
287
|
|
|
288
|
+
// lim:limits
|
|
289
|
+
function memtype(limits: BytecodeFragment) {
|
|
290
|
+
return limits;
|
|
291
|
+
}
|
|
292
|
+
|
|
278
293
|
const limits = {
|
|
279
294
|
min(n: number) {
|
|
280
295
|
return [0x00, u32(n)];
|
|
@@ -355,6 +370,10 @@ function elemsec(segs: BytecodeFragment[]) {
|
|
|
355
370
|
return section(SECTION_ID_ELEMENT, vec(segs));
|
|
356
371
|
}
|
|
357
372
|
|
|
373
|
+
function memarg(align: number, offset: number) {
|
|
374
|
+
return [u32(align), u32(offset)];
|
|
375
|
+
}
|
|
376
|
+
|
|
358
377
|
export {
|
|
359
378
|
blocktype,
|
|
360
379
|
BytecodeFragment,
|
|
@@ -383,8 +402,9 @@ export {
|
|
|
383
402
|
instr,
|
|
384
403
|
limits,
|
|
385
404
|
locals,
|
|
386
|
-
|
|
405
|
+
memarg,
|
|
387
406
|
memsec,
|
|
407
|
+
memtype,
|
|
388
408
|
module,
|
|
389
409
|
mut,
|
|
390
410
|
name,
|