porffor 0.48.3 → 0.48.4

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.
@@ -1,4 +1,4 @@
1
- import { Valtype, FuncType, ExportDesc, Section, Magic, ModuleVersion, Opcodes, PageSize, Reftype } from './wasmSpec.js';
1
+ import { Valtype, FuncType, ExportDesc, Section, Magic, Opcodes, PageSize, Reftype } from './wasmSpec.js';
2
2
  import { encodeVector, encodeString, encodeLocal, unsignedLEB128, signedLEB128, unsignedLEB128_into, signedLEB128_into, ieee754_binary64, ieee754_binary64_into } from './encoding.js';
3
3
  import { importedFuncs } from './builtins.js';
4
4
  import { log } from './log.js';
@@ -9,17 +9,10 @@ const createSection = (type, data) => [
9
9
  ...encodeVector(data)
10
10
  ];
11
11
 
12
- const customSection = (name, data) => [
12
+ const customSection = (name, data) => createSection(
13
13
  Section.custom,
14
- ...encodeVector([...encodeString(name), ...data])
15
- ];
16
-
17
- const chHint = (topTier, baselineTier, strategy) => {
18
- // 1 byte of 4 2 bit components: spare, top tier, baseline tier, compilation strategy
19
- // tiers: 0x00 = default, 0x01 = baseline (liftoff), 0x02 = optimized (turbofan)
20
- // strategy: 0x00 = default, 0x01 = lazy, 0x02 = eager, 0x03 = lazy baseline, eager top tier
21
- return (strategy | (baselineTier << 2) | (topTier << 4));
22
- };
14
+ [ ...encodeString(name), ...data ]
15
+ );
23
16
 
24
17
  const encodeNames = funcs => {
25
18
  const encodeSection = (id, section) => [
@@ -50,11 +43,6 @@ const encodeNames = funcs => {
50
43
  export default (funcs, globals, tags, pages, data, noTreeshake = false) => {
51
44
  const types = [], typeCache = {};
52
45
 
53
- const optLevel = parseInt(process.argv.find(x => x.startsWith('-O'))?.[2] ?? 1);
54
-
55
- const compileHints = Prefs.compileHints;
56
- if (compileHints) log.warning('assemble', 'compile hints is V8 only w/ experimental arg! (you used -compile-hints)');
57
-
58
46
  const getType = (params, returns) => {
59
47
  const hash = `${params.join(',')}_${returns.join(',')}`;
60
48
  if (Prefs.optLog) log('assemble', `getType(${JSON.stringify(params)}, ${JSON.stringify(returns)}) -> ${hash} | cache: ${typeCache[hash]}`);
@@ -77,15 +65,15 @@ export default (funcs, globals, tags, pages, data, noTreeshake = false) => {
77
65
  };
78
66
 
79
67
  let importFuncs = [], importDelta = 0;
80
- if (optLevel < 1 || !Prefs.treeshakeWasmImports || noTreeshake) {
68
+ if (!Prefs.treeshakeWasmImports || noTreeshake) {
81
69
  importFuncs = importedFuncs;
82
70
  } else {
83
71
  let imports = new Map();
84
72
 
85
73
  // tree shake imports
86
74
  for (const f of funcs) {
87
- for (const inst of f.wasm) {
88
- if ((inst[0] === Opcodes.call /* || inst[0] === Opcodes.return_call */) && inst[1] < importedFuncs.length) {
75
+ if (f.usesImports) for (const inst of f.wasm) {
76
+ if (inst[0] === Opcodes.call && inst[1] < importedFuncs.length) {
89
77
  const idx = inst[1];
90
78
  const func = importedFuncs[idx];
91
79
 
@@ -261,101 +249,103 @@ export default (funcs, globals, tags, pages, data, noTreeshake = false) => {
261
249
  );
262
250
  time('export section');
263
251
 
264
- const codeSection = createSection(
265
- Section.code,
266
- encodeVector(funcs.map(x => {
267
- // time(x.name);
268
- const locals = Object.values(x.locals).sort((a, b) => a.idx - b.idx).slice(x.params.length);
269
- // time(' locals gen');
270
-
271
- let localDecl = [], typeCount = 0, lastType;
272
- for (let i = 0; i < locals.length; i++) {
273
- const local = locals[i];
274
- if (i !== 0 && local.type !== lastType) {
275
- localDecl.push(encodeLocal(typeCount, lastType));
276
- typeCount = 0;
277
- }
278
-
279
- typeCount++;
280
- lastType = local.type;
252
+ let codeSection = [];
253
+ for (let i = 0; i < funcs.length; i++) {
254
+ const x = funcs[i];
255
+ // time(x.name);
256
+ const locals = Object.values(x.locals).sort((a, b) => a.idx - b.idx);
257
+ // time(' locals gen');
258
+
259
+ const paramCount = x.params.length;
260
+ let localDecl = [], typeCount = 0, lastType, declCount = 0;
261
+ for (let i = paramCount; i <= locals.length; i++) {
262
+ const local = locals[i];
263
+ if (i !== paramCount && local?.type !== lastType) {
264
+ unsignedLEB128_into(typeCount, localDecl);
265
+ localDecl.push(lastType);
266
+ typeCount = 0;
267
+ declCount++;
281
268
  }
282
269
 
283
- if (typeCount !== 0) localDecl.push(encodeLocal(typeCount, lastType));
284
- // time(' localDecl gen');
285
-
286
- const makeAssembled = Prefs.d;
287
- let wasm = [], wasmNonFlat = [];
288
- for (let i = 0; i < x.wasm.length; i++) {
289
- let o = x.wasm[i];
290
-
291
- // encode local/global ops as unsigned leb128 from raw number
292
- if (
293
- // (o[0] === Opcodes.local_get || o[0] === Opcodes.local_set || o[0] === Opcodes.local_tee || o[0] === Opcodes.global_get || o[0] === Opcodes.global_set) &&
294
- (o[0] >= Opcodes.local_get && o[0] <= Opcodes.global_set) &&
295
- o[1] > 127
296
- ) {
297
- const n = o[1];
298
- o = [ o[0] ];
299
- unsignedLEB128_into(n, o);
300
- }
270
+ typeCount++;
271
+ lastType = local?.type;
272
+ }
301
273
 
302
- // encode f64.const ops as ieee754 from raw number
303
- if (o[0] === Opcodes.f64_const) {
304
- const n = o[1];
305
- // o = [ o[0] ];
306
- // ieee754_binary64_into(n, o);
307
- o = ieee754_binary64(n);
308
- if (o.length === 8) o.unshift(Opcodes.f64_const);
309
- }
274
+ // time(' localDecl gen');
275
+
276
+ const makeAssembled = Prefs.d;
277
+ let wasm = [], wasmNonFlat = [];
278
+ for (let i = 0; i < x.wasm.length; i++) {
279
+ let o = x.wasm[i];
280
+
281
+ // encode local/global ops as unsigned leb128 from raw number
282
+ if (
283
+ (o[0] >= Opcodes.local_get && o[0] <= Opcodes.global_set) &&
284
+ o[1] > 127
285
+ ) {
286
+ const n = o[1];
287
+ o = [ o[0] ];
288
+ unsignedLEB128_into(n, o);
289
+ }
310
290
 
311
- // encode call ops as unsigned leb128 from raw number
312
- if ((o[0] === Opcodes.call /* || o[0] === Opcodes.return_call */) && o[1] >= importedFuncs.length) {
313
- const n = o[1] - importDelta;
314
- // o = [ o[0] ];
315
- o = [ Opcodes.call ];
316
- unsignedLEB128_into(n, o);
317
- }
291
+ // encode f64.const ops as ieee754 from raw number
292
+ if (o[0] === Opcodes.f64_const) {
293
+ const n = o[1];
294
+ o = ieee754_binary64(n);
295
+ if (o.length === 8) o.unshift(Opcodes.f64_const);
296
+ }
297
+
298
+ // encode call ops as unsigned leb128 from raw number
299
+ if ((o[0] === Opcodes.call /* || o[0] === Opcodes.return_call */) && o[1] >= importedFuncs.length) {
300
+ const n = o[1] - importDelta;
301
+ o = [ Opcodes.call ];
302
+ unsignedLEB128_into(n, o);
303
+ }
318
304
 
319
- // encode call indirect ops as types from info
320
- if (o[0] === Opcodes.call_indirect) {
321
- o = [...o];
322
- const params = [];
323
- for (let i = 0; i < o[1]; i++) {
324
- params.push(valtypeBinary, Valtype.i32);
325
- }
326
-
327
- let returns = [ valtypeBinary, Valtype.i32 ];
328
- if (o.at(-1) === 'no_type_return') {
329
- o.pop();
330
- returns = [ valtypeBinary ];
331
- }
332
-
333
- o[1] = getType(params, returns);
305
+ // encode call indirect ops as types from info
306
+ if (o[0] === Opcodes.call_indirect) {
307
+ o = [...o];
308
+ const params = [];
309
+ for (let i = 0; i < o[1]; i++) {
310
+ params.push(valtypeBinary, Valtype.i32);
334
311
  }
335
312
 
336
- for (let j = 0; j < o.length; j++) {
337
- const x = o[j];
338
- if (x == null || !(x <= 0xff)) continue;
339
- wasm.push(x);
313
+ let returns = [ valtypeBinary, Valtype.i32 ];
314
+ if (o.at(-1) === 'no_type_return') {
315
+ o.pop();
316
+ returns = [ valtypeBinary ];
340
317
  }
341
318
 
342
- if (makeAssembled) wasmNonFlat.push(o);
319
+ o[1] = getType(params, returns);
343
320
  }
344
- // time(' wasm transform');
345
321
 
346
- if (makeAssembled) {
347
- x.assembled = { localDecl, wasm, wasmNonFlat };
322
+ for (let j = 0; j < o.length; j++) {
323
+ const x = o[j];
324
+ if (x == null || !(x <= 0xff)) continue;
325
+ wasm.push(x);
348
326
  }
349
327
 
350
- let out = unsignedLEB128(localDecl.length)
351
- .concat(localDecl.flat(), wasm, Opcodes.end);
328
+ if (makeAssembled) wasmNonFlat.push(o);
329
+ }
330
+ // time(' wasm transform');
331
+
332
+ if (makeAssembled) {
333
+ x.assembled = { localDecl, wasm, wasmNonFlat };
334
+ }
352
335
 
353
- out.unshift(...unsignedLEB128(out.length));
336
+ let out = unsignedLEB128(declCount)
337
+ .concat(localDecl, wasm, Opcodes.end);
354
338
 
355
- // time(' finish');
356
- return out;
357
- }))
358
- );
339
+ codeSection.push(
340
+ ...unsignedLEB128(out.length),
341
+ ...out
342
+ );
343
+
344
+ // time(' finish');
345
+ }
346
+
347
+ codeSection.unshift(...unsignedLEB128(funcs.length, codeSection));
348
+ codeSection.unshift(Section.code, ...unsignedLEB128(codeSection.length));
359
349
  time('code section');
360
350
 
361
351
  const typeSection = createSection(
@@ -364,25 +354,32 @@ export default (funcs, globals, tags, pages, data, noTreeshake = false) => {
364
354
  );
365
355
  time('type section');
366
356
 
367
- const dataSection = data.length === 0 ? [] : createSection(
368
- Section.data,
369
- encodeVector(data.map(x => {
357
+ let dataSection = [];
358
+ if (data.length > 0) {
359
+ for (let i = 0; i < data.length; i++) {
360
+ const x = data[i];
370
361
  if (Prefs.d && x.bytes.length > PageSize) log.warning('assemble', `data (${x.page}) has more bytes than Wasm page size! (${x.bytes.length})`);
371
362
 
372
- const bytes = unsignedLEB128(x.bytes.length).concat(x.bytes);
373
363
  if (x.page != null) {
374
364
  // type: active
375
365
  let offset = pages.allocs.get(x.page) ?? (pages.get(x.page) * pageSize);
376
366
  if (offset === 0) offset = 16;
377
- bytes.unshift(0x00, Opcodes.i32_const, ...signedLEB128(offset), Opcodes.end);
367
+ dataSection.push(0x00, Opcodes.i32_const, ...signedLEB128(offset), Opcodes.end);
378
368
  } else {
379
369
  // type: passive
380
- bytes.unshift(0x01);
370
+ dataSection.push(0x01);
381
371
  }
382
372
 
383
- return bytes;
384
- }))
385
- );
373
+ dataSection.push(
374
+ ...unsignedLEB128(x.bytes.length),
375
+ ...x.bytes
376
+ );
377
+ }
378
+
379
+ dataSection.unshift(...unsignedLEB128(data.length, dataSection));
380
+ dataSection.unshift(Section.data, ...unsignedLEB128(dataSection.length));
381
+ }
382
+
386
383
  time('data section');
387
384
 
388
385
  const dataCountSection = data.length === 0 ? [] : createSection(
@@ -391,31 +388,11 @@ export default (funcs, globals, tags, pages, data, noTreeshake = false) => {
391
388
  );
392
389
  time('datacount section');
393
390
 
394
- if (Prefs.sections) console.log({
395
- typeSection: typeSection.map(x => x.toString(16)),
396
- importSection: importSection.map(x => x.toString(16)),
397
- funcSection: funcSection.map(x => x.toString(16)),
398
- globalSection: globalSection.map(x => x.toString(16)),
399
- exportSection: exportSection.map(x => x.toString(16)),
400
- codeSection: codeSection.map(x => x.toString(16)),
401
- dataSection: dataSection.map(x => x.toString(16)),
402
- });
403
-
404
- // compilation hints section - unspecd, v8 only
405
- // https://github.com/WebAssembly/design/issues/1473#issuecomment-1431274746
406
- const chSection = !compileHints ? [] : customSection(
407
- 'compilationHints',
408
- // for now just do everything as optimize eager
409
- encodeVector(funcs.map(_ => chHint(0x02, 0x02, 0x02)))
410
- );
411
-
412
391
  return Uint8Array.from([
413
392
  ...Magic,
414
- ...ModuleVersion,
415
393
  ...typeSection,
416
394
  ...importSection,
417
395
  ...funcSection,
418
- ...chSection,
419
396
  ...tableSection,
420
397
  ...memorySection,
421
398
  ...tagSection,
@@ -68,21 +68,6 @@ for (let i = 0; i < importedFuncs.length; i++) {
68
68
  importedFuncs[f.name] = i;
69
69
  }
70
70
 
71
- const printStaticStr = str => {
72
- const out = [];
73
-
74
- for (let i = 0; i < str.length; i++) {
75
- out.push(
76
- // ...number(str.charCodeAt(i)),
77
- ...number(str.charCodeAt(i), Valtype.i32),
78
- Opcodes.i32_from_u,
79
- [ Opcodes.call, importedFuncs.printChar ]
80
- );
81
- }
82
-
83
- return out;
84
- };
85
-
86
71
  export const UNDEFINED = 0;
87
72
  export const NULL = 0;
88
73
 
@@ -106,6 +91,7 @@ export const BuiltinVars = function(ctx) {
106
91
  this.__performance_timeOrigin = [
107
92
  [ Opcodes.call, importedFuncs.timeOrigin ]
108
93
  ];
94
+ this.__performance_timeOrigin.usesImports = true;
109
95
 
110
96
  this.__Uint8Array_BYTES_PER_ELEMENT = number(1);
111
97
  this.__Int8Array_BYTES_PER_ELEMENT = number(1);
@@ -849,6 +835,7 @@ export const BuiltinFuncs = function() {
849
835
  [ Opcodes.call, importedFuncs.time ]
850
836
  ]
851
837
  };
838
+ this.__performance_now.usesImports = true;
852
839
 
853
840
 
854
841
  this.__Porffor_type = {
@@ -725,49 +725,54 @@ this.__Porffor_printString = {
725
725
  wasm:()=>[[32,0],[33,2],[32,1],[184],[68,195],[97],[4,64],[32,2],[32,0],[252,3],[40,1,0],[184],[160],[33,3],[3,64],[32,2],[32,3],[99],[4,64],[32,2],[32,2],[68,1],[160],[33,2],[252,2],[45,0,4],[183],[16,1],[12,1],[11],[11],[5],[32,2],[32,0],[252,3],[40,1,0],[184],[68,2],[162],[160],[33,3],[3,64],[32,2],[32,3],[99],[4,64],[32,2],[252,2],[47,0,4],[183],[16,1],[32,2],[68,2],[160],[33,2],[12,1],[11],[11],[11],[68,0],[65,128,1],[15]],
726
726
  params:[124,127],typedParams:1,returns:[124,127],typedReturns:1,
727
727
  locals:[124,124],localNames:["arg","arg#type","ptr","end"],
728
+ usesImports:1,
728
729
  }
729
730
  this.__Porffor_printHexDigit = {
730
731
  wasm:()=>[[32,0],[33,2],[65,1],[33,3],[2,64],[2,64],[2,64],[2,64],[2,64],[2,64],[2,64],[2,64],[32,2],[68,15],[97],[32,3],[65,128,1],[114],[65,1],[65,128,1],[114],[70],[113],[13,0],[32,2],[68,14],[97],[32,3],[65,128,1],[114],[65,1],[65,128,1],[114],[70],[113],[13,1],[32,2],[68,13],[97],[32,3],[65,128,1],[114],[65,1],[65,128,1],[114],[70],[113],[13,2],[32,2],[68,12],[97],[32,3],[65,128,1],[114],[65,1],[65,128,1],[114],[70],[113],[13,3],[32,2],[68,11],[97],[32,3],[65,128,1],[114],[65,1],[65,128,1],[114],[70],[113],[13,4],[32,2],[68,10],[97],[32,3],[65,128,1],[114],[65,1],[65,128,1],[114],[70],[113],[13,5],[12,6],[11],[68,102],[16,1],[68,0],[65,128,1],[15],[11],[68,101],[16,1],[68,0],[65,128,1],[15],[11],[68,100],[16,1],[68,0],[65,128,1],[15],[11],[68,99],[16,1],[68,0],[65,128,1],[15],[11],[68,98],[16,1],[68,0],[65,128,1],[15],[11],[68,97],[16,1],[68,0],[65,128,1],[15],[11],[32,0],[16,0],[11],[68,0],[65,128,1],[15]],
731
732
  params:[124,127],typedParams:1,returns:[124,127],typedReturns:1,
732
733
  locals:[124,127],localNames:["arg","arg#type","#switch_1","#switch_1#type"],
734
+ usesImports:1,
733
735
  }
734
736
  this.__Porffor_numberLog = {
735
737
  wasm:()=>[[32,0],[16,0],[68,10],[16,1],[68,0],[65,128,1],[15]],
736
738
  params:[124,127],typedParams:1,returns:[124,127],typedReturns:1,
737
739
  locals:[],localNames:["arg","arg#type"],
740
+ usesImports:1,
738
741
  }
739
742
  this.__Porffor_miniLog = {
740
743
  wasm:(_,{t,builtin,internalThrow})=>[[32,1],[33,2],[2,64],...t([1],()=>[[32,2],[65,1],[70],[4,64],[32,0],[16,0],[12,0],[11]]),...t([2],()=>[[32,2],[65,2],[70],[4,64],[32,0],[33,3],[32,1],[33,4],[2,127],...t([67,195],()=>[[32,4],[65,195,0],[70],[32,4],[65,195,1],[70],[114],[4,64],[32,3],[252,3],[40,1,0],[12,1],[11]]),[32,3],[252,3],[11],[4,64],[68,116],[16,1],[68,114],[16,1],[68,117],[16,1],[68,101],[16,1],[5],[68,102],[16,1],[68,97],[16,1],[68,108],[16,1],[68,115],[16,1],[68,101],[16,1],[11],[12,0],[11]]),...t([195,67],()=>[[32,2],[65,195,1],[70],[32,2],[65,195,0],[70],[114],[4,64],[68,39],[16,1],[32,0],[32,1],[16,builtin('__Porffor_printString')],[33,5],[26],[68,39],[16,1],[12,0],[11]]),...t([80],()=>[[32,2],[65,208,0],[70],[4,64],[32,0],[252,3],[40,1,0],[184],[68,1],[161],[34,6],[68,-1],[97],[4,64],[68,91],[16,1],[68,93],[16,1],[5],[68,91],[16,1],[68,32],[16,1],[68,0],[33,7],[3,64],[32,7],[32,6],[101],[4,64],[2,64],[32,0],[33,8],[32,7],[33,9],[32,1],[33,4],[2,124],...t([67],()=>[[32,4],[65,195,0],[70],[4,64],[65,8],[16,builtin('__Porffor_allocateBytes')],[34,10],[65,1],[54,0,0],[32,10],[32,9],[252,3],[65,2],[108],[32,8],[252,3],[106],[47,0,4],[59,0,4],[32,10],[184],[65,195,0],[33,5],[12,1],[11]]),...t([80],()=>[[32,4],[65,208,0],[70],[4,64],[32,9],[252,3],[65,9],[108],[32,8],[252,3],[106],[34,11],[43,0,4],[32,11],[45,0,12],[33,5],[12,1],[11]]),...t([88],()=>[[32,4],[65,216,0],[70],[4,64],[32,8],[252,3],[40,0,4],[32,9],[252,3],[106],[45,0,4],[184],[65,1],[33,5],[12,1],[11]]),...t([89],()=>[[32,4],[65,217,0],[70],[4,64],[32,8],[252,3],[40,0,4],[32,9],[252,3],[106],[44,0,4],[183],[65,1],[33,5],[12,1],[11]]),...t([90],()=>[[32,4],[65,218,0],[70],[4,64],[32,8],[252,3],[40,0,4],[32,9],[252,3],[106],[45,0,4],[184],[65,1],[33,5],[12,1],[11]]),...t([91],()=>[[32,4],[65,219,0],[70],[4,64],[32,8],[252,3],[40,0,4],[32,9],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,5],[12,1],[11]]),...t([92],()=>[[32,4],[65,220,0],[70],[4,64],[32,8],[252,3],[40,0,4],[32,9],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,5],[12,1],[11]]),...t([93],()=>[[32,4],[65,221,0],[70],[4,64],[32,8],[252,3],[40,0,4],[32,9],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,5],[12,1],[11]]),...t([94],()=>[[32,4],[65,222,0],[70],[4,64],[32,8],[252,3],[40,0,4],[32,9],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,5],[12,1],[11]]),...t([95],()=>[[32,4],[65,223,0],[70],[4,64],[32,8],[252,3],[40,0,4],[32,9],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,5],[12,1],[11]]),...t([96],()=>[[32,4],[65,224,0],[70],[4,64],[32,8],[252,3],[40,0,4],[32,9],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,5],[12,1],[11]]),...t([128],()=>[[32,4],[65,128,1],[70],[4,64],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11]]),...t([195],()=>[[32,4],[65,195,1],[70],[4,64],[65,8],[16,builtin('__Porffor_allocateBytes')],[34,10],[65,1],[54,0,0],[32,10],[32,9],[252,3],[32,8],[252,3],[106],[45,0,4],[58,0,4],[32,10],[184],[65,195,1],[33,5],[12,1],[11]]),[32,8],[252,2],[32,1],[32,9],[65,1],[16,builtin('__ecma262_ToPropertyKey')],[33,12],[252,2],[32,12],[16,builtin('__Porffor_object_get')],[33,5],[11],[32,5],[16,builtin('__Porffor_miniLog')],[33,5],[26],[32,7],[32,6],[98],[4,64],[68,44],[16,1],[68,32],[16,1],[11],[11],[32,7],[68,1],[160],[33,7],[68,0],[12,1],[11],[11],[68,32],[16,1],[68,93],[16,1],[11],[12,0],[11]]),...t([0,128],()=>[[32,2],[65,0],[70],[32,2],[65,128,1],[70],[114],[4,64],[68,117],[16,1],[68,110],[16,1],[68,100],[16,1],[68,101],[16,1],[68,102],[16,1],[68,105],[16,1],[68,110],[16,1],[68,101],[16,1],[68,100],[16,1],[12,0],[11]]),...t([7],()=>[[32,2],[65,7],[70],[4,64],[32,0],[33,3],[32,1],[33,4],[2,127],...t([67,195],()=>[[32,4],[65,195,0],[70],[32,4],[65,195,1],[70],[114],[4,64],[32,3],[252,3],[40,1,0],[12,1],[11]]),[32,3],[252,3],[11],[4,64],[68,91],[16,1],[68,79],[16,1],[68,98],[16,1],[68,106],[16,1],[68,101],[16,1],[68,99],[16,1],[68,116],[16,1],[68,93],[16,1],[5],[68,110],[16,1],[68,117],[16,1],[68,108],[16,1],[68,108],[16,1],[11],[12,0],[11]]),[11],[68,10],[16,1],[68,0],[65,128,1],[15]],
741
744
  params:[124,127],typedParams:1,returns:[124,127],typedReturns:1,
742
745
  locals:[127,124,127,127,124,124,124,124,127,127,127],localNames:["arg","arg#type","#typeswitch_tmp1","#logicinner_tmp","#typeswitch_tmp2","#last_type","arrLen","i","#member_obj","#member_prop","#member_allocd","#loadArray_offset","#swap"],
743
746
  usedTypes:[67,195],
744
- usesTag:1,
747
+ usesTag:1,usesImports:1,
745
748
  }
746
749
  this.__Porffor_print = {
747
750
  wasm:(_,{t,makeString,builtin,internalThrow})=>[[32,3],[65,128,1],[70],[4,64],[68,1],[33,2],[65,2],[33,3],[11],[32,1],[33,4],[2,64],...t([1],()=>[[32,4],[65,1],[70],[4,64],[32,2],[33,5],[32,3],[33,6],[2,127],...t([67,195],()=>[[32,6],[65,195,0],[70],[32,6],[65,195,1],[70],[114],[4,64],[32,5],[252,3],[40,1,0],[12,1],[11]]),[32,5],[252,3],[11],[4,64],[68,27],[16,1],[68,91],[16,1],[68,51],[16,1],[68,51],[16,1],[68,109],[16,1],[11],[32,0],[16,0],[32,2],[33,5],[32,3],[33,6],[2,127],...t([67,195],()=>[[32,6],[65,195,0],[70],[32,6],[65,195,1],[70],[114],[4,64],[32,5],[252,3],[40,1,0],[12,1],[11]]),[32,5],[252,3],[11],[4,64],[68,27],[16,1],[68,91],[16,1],[68,48],[16,1],[68,109],[16,1],[11],[68,0],[65,128,1],[15],[11]]),...t([2],()=>[[32,4],[65,2],[70],[4,64],[32,2],[33,5],[32,3],[33,6],[2,127],...t([67,195],()=>[[32,6],[65,195,0],[70],[32,6],[65,195,1],[70],[114],[4,64],[32,5],[252,3],[40,1,0],[12,1],[11]]),[32,5],[252,3],[11],[4,64],[68,27],[16,1],[68,91],[16,1],[68,51],[16,1],[68,51],[16,1],[68,109],[16,1],[11],[32,0],[33,5],[32,1],[33,6],[2,127],...t([67,195],()=>[[32,6],[65,195,0],[70],[32,6],[65,195,1],[70],[114],[4,64],[32,5],[252,3],[40,1,0],[12,1],[11]]),[32,5],[252,3],[11],[4,64],[68,116],[16,1],[68,114],[16,1],[68,117],[16,1],[68,101],[16,1],[5],[68,102],[16,1],[68,97],[16,1],[68,108],[16,1],[68,115],[16,1],[68,101],[16,1],[11],[32,2],[33,5],[32,3],[33,6],[2,127],...t([67,195],()=>[[32,6],[65,195,0],[70],[32,6],[65,195,1],[70],[114],[4,64],[32,5],[252,3],[40,1,0],[12,1],[11]]),[32,5],[252,3],[11],[4,64],[68,27],[16,1],[68,91],[16,1],[68,48],[16,1],[68,109],[16,1],[11],[68,0],[65,128,1],[15],[11]]),...t([195,67],()=>[[32,4],[65,195,1],[70],[32,4],[65,195,0],[70],[114],[4,64],[32,2],[33,5],[32,3],[33,6],[2,127],...t([67,195],()=>[[32,6],[65,195,0],[70],[32,6],[65,195,1],[70],[114],[4,64],[32,5],[252,3],[40,1,0],[12,1],[11]]),[32,5],[252,3],[11],[4,64],[68,27],[16,1],[68,91],[16,1],[68,51],[16,1],[68,50],[16,1],[68,109],[16,1],[11],[68,39],[16,1],[32,0],[32,1],[16,builtin('__Porffor_printString')],[33,7],[26],[68,39],[16,1],[32,2],[33,5],[32,3],[33,6],[2,127],...t([67,195],()=>[[32,6],[65,195,0],[70],[32,6],[65,195,1],[70],[114],[4,64],[32,5],[252,3],[40,1,0],[12,1],[11]]),[32,5],[252,3],[11],[4,64],[68,27],[16,1],[68,91],[16,1],[68,48],[16,1],[68,109],[16,1],[11],[68,0],[65,128,1],[15],[11]]),...t([0,128],()=>[[32,4],[65,0],[70],[32,4],[65,128,1],[70],[114],[4,64],[32,2],[33,5],[32,3],[33,6],[2,127],...t([67,195],()=>[[32,6],[65,195,0],[70],[32,6],[65,195,1],[70],[114],[4,64],[32,5],[252,3],[40,1,0],[12,1],[11]]),[32,5],[252,3],[11],[4,64],[68,27],[16,1],[68,91],[16,1],[68,50],[16,1],[68,109],[16,1],[11],[68,117],[16,1],[68,110],[16,1],[68,100],[16,1],[68,101],[16,1],[68,102],[16,1],[68,105],[16,1],[68,110],[16,1],[68,101],[16,1],[68,100],[16,1],[32,2],[33,5],[32,3],[33,6],[2,127],...t([67,195],()=>[[32,6],[65,195,0],[70],[32,6],[65,195,1],[70],[114],[4,64],[32,5],[252,3],[40,1,0],[12,1],[11]]),[32,5],[252,3],[11],[4,64],[68,27],[16,1],[68,91],[16,1],[68,48],[16,1],[68,109],[16,1],[11],[68,0],[65,128,1],[15],[11]]),...t([7],()=>[[32,4],[65,7],[70],[4,64],[32,0],[33,5],[32,1],[33,6],[2,127],...t([67,195],()=>[[32,6],[65,195,0],[70],[32,6],[65,195,1],[70],[114],[4,64],[32,5],[252,3],[40,1,0],[12,1],[11]]),[32,5],[252,3],[11],[4,64],[32,0],[32,1],[16,builtin('__Object_keys')],[33,7],[34,8],[252,3],[40,1,0],[184],[68,0],[97],[4,64],[68,123],[16,1],[68,125],[16,1],[68,0],[65,128,1],[15],[11],[68,123],[16,1],[68,32],[16,1],[32,8],[252,3],[40,1,0],[184],[68,1],[161],[33,9],[68,0],[33,10],[3,64],[32,10],[32,9],[101],[4,64],[32,8],[33,13],[32,10],[34,14],[252,3],[65,9],[108],[32,13],[252,3],[106],[34,15],[43,0,4],[32,15],[45,0,12],[34,7],[33,12],[33,11],[68,32],[16,1],[68,32],[16,1],[32,11],[32,12],[16,builtin('__Porffor_printString')],[33,7],[26],[68,58],[16,1],[68,32],[16,1],[32,0],[252,2],[32,1],[32,11],[32,12],[16,builtin('__ecma262_ToPropertyKey')],[33,7],[252,2],[32,7],[16,builtin('__Porffor_object_get')],[34,7],[68,0],[65,128,1],[16,builtin('__Porffor_print')],[33,7],[26],[32,10],[32,9],[98],[4,64],[68,44],[16,1],[68,10],[16,1],[11],[32,10],[68,1],[160],[33,10],[68,0],[12,1],[11],[11],[68,32],[16,1],[68,125],[16,1],[5],[32,2],[33,5],[32,3],[33,6],[2,127],...t([67,195],()=>[[32,6],[65,195,0],[70],[32,6],[65,195,1],[70],[114],[4,64],[32,5],[252,3],[40,1,0],[12,1],[11]]),[32,5],[252,3],[11],[4,64],[68,27],[16,1],[68,91],[16,1],[68,49],[16,1],[68,109],[16,1],[11],[68,110],[16,1],[68,117],[16,1],[68,108],[16,1],[68,108],[16,1],[11],[32,2],[33,5],[32,3],[33,6],[2,127],...t([67,195],()=>[[32,6],[65,195,0],[70],[32,6],[65,195,1],[70],[114],[4,64],[32,5],[252,3],[40,1,0],[12,1],[11]]),[32,5],[252,3],[11],[4,64],[68,27],[16,1],[68,91],[16,1],[68,48],[16,1],[68,109],[16,1],[11],[68,0],[65,128,1],[15],[11]]),...t([6],()=>[[32,4],[65,6],[70],[4,64],[68,91],[16,1],[68,70],[16,1],[68,117],[16,1],[68,110],[16,1],[68,99],[16,1],[68,116],[16,1],[68,105],[16,1],[68,111],[16,1],[68,110],[16,1],[68,32],[16,1],[32,0],[252,2],[16,builtin('__Porffor_funcLut_name')],[183],[65,195,1],[16,builtin('__Porffor_printString')],[33,7],[26],[68,93],[16,1],[68,0],[65,128,1],[15],[11]]),...t([18],()=>[[32,4],[65,18],[70],[4,64],[32,2],[33,5],[32,3],[33,6],[2,127],...t([67,195],()=>[[32,6],[65,195,0],[70],[32,6],[65,195,1],[70],[114],[4,64],[32,5],[252,3],[40,1,0],[12,1],[11]]),[32,5],[252,3],[11],[4,64],[68,27],[16,1],[68,91],[16,1],[68,51],[16,1],[68,53],[16,1],[68,109],[16,1],[11],[32,0],[32,1],[16,builtin('__Date_prototype_toISOString')],[34,7],[16,builtin('__Porffor_printString')],[33,7],[26],[32,2],[33,5],[32,3],[33,6],[2,127],...t([67,195],()=>[[32,6],[65,195,0],[70],[32,6],[65,195,1],[70],[114],[4,64],[32,5],[252,3],[40,1,0],[12,1],[11]]),[32,5],[252,3],[11],[4,64],[68,27],[16,1],[68,91],[16,1],[68,48],[16,1],[68,109],[16,1],[11],[68,0],[65,128,1],[15],[11]]),...t([5],()=>[[32,4],[65,5],[70],[4,64],[32,2],[33,5],[32,3],[33,6],[2,127],...t([67,195],()=>[[32,6],[65,195,0],[70],[32,6],[65,195,1],[70],[114],[4,64],[32,5],[252,3],[40,1,0],[12,1],[11]]),[32,5],[252,3],[11],[4,64],[68,27],[16,1],[68,91],[16,1],[68,51],[16,1],[68,50],[16,1],[68,109],[16,1],[11],[32,0],[32,1],[16,builtin('__Symbol_prototype_toString')],[34,7],[16,builtin('__Porffor_printString')],[33,7],[26],[32,2],[33,5],[32,3],[33,6],[2,127],...t([67,195],()=>[[32,6],[65,195,0],[70],[32,6],[65,195,1],[70],[114],[4,64],[32,5],[252,3],[40,1,0],[12,1],[11]]),[32,5],[252,3],[11],[4,64],[68,27],[16,1],[68,91],[16,1],[68,48],[16,1],[68,109],[16,1],[11],[68,0],[65,128,1],[15],[11]]),...t([80],()=>[[32,4],[65,208,0],[70],[4,64],[32,0],[32,1],[32,2],[32,3],[68,0],[65,2],[16,builtin('__Porffor_printArray')],[33,7],[26],[68,0],[65,128,1],[15],[11]]),...t([88],()=>[[32,4],[65,216,0],[70],[4,64],[68,85],[16,1],[68,105],[16,1],[68,110],[16,1],[68,116],[16,1],[68,56],[16,1],[68,65],[16,1],[68,114],[16,1],[68,114],[16,1],[68,97],[16,1],[68,121],[16,1],[32,0],[32,1],[32,2],[32,3],[68,1],[65,2],[16,builtin('__Porffor_printArray')],[33,7],[26],[68,0],[65,128,1],[15],[11]]),...t([89],()=>[[32,4],[65,217,0],[70],[4,64],[68,73],[16,1],[68,110],[16,1],[68,116],[16,1],[68,56],[16,1],[68,65],[16,1],[68,114],[16,1],[68,114],[16,1],[68,97],[16,1],[68,121],[16,1],[32,0],[32,1],[32,2],[32,3],[68,1],[65,2],[16,builtin('__Porffor_printArray')],[33,7],[26],[68,0],[65,128,1],[15],[11]]),...t([90],()=>[[32,4],[65,218,0],[70],[4,64],[68,85],[16,1],[68,105],[16,1],[68,110],[16,1],[68,116],[16,1],[68,56],[16,1],[68,67],[16,1],[68,108],[16,1],[68,97],[16,1],[68,109],[16,1],[68,112],[16,1],[68,101],[16,1],[68,100],[16,1],[68,65],[16,1],[68,114],[16,1],[68,114],[16,1],[68,97],[16,1],[68,121],[16,1],[32,0],[32,1],[32,2],[32,3],[68,1],[65,2],[16,builtin('__Porffor_printArray')],[33,7],[26],[68,0],[65,128,1],[15],[11]]),...t([91],()=>[[32,4],[65,219,0],[70],[4,64],[68,85],[16,1],[68,105],[16,1],[68,110],[16,1],[68,116],[16,1],[68,49],[16,1],[68,54],[16,1],[68,65],[16,1],[68,114],[16,1],[68,114],[16,1],[68,97],[16,1],[68,121],[16,1],[32,0],[32,1],[32,2],[32,3],[68,1],[65,2],[16,builtin('__Porffor_printArray')],[33,7],[26],[68,0],[65,128,1],[15],[11]]),...t([92],()=>[[32,4],[65,220,0],[70],[4,64],[68,73],[16,1],[68,110],[16,1],[68,116],[16,1],[68,49],[16,1],[68,54],[16,1],[68,65],[16,1],[68,114],[16,1],[68,114],[16,1],[68,97],[16,1],[68,121],[16,1],[32,0],[32,1],[32,2],[32,3],[68,1],[65,2],[16,builtin('__Porffor_printArray')],[33,7],[26],[68,0],[65,128,1],[15],[11]]),...t([93],()=>[[32,4],[65,221,0],[70],[4,64],[68,85],[16,1],[68,105],[16,1],[68,110],[16,1],[68,116],[16,1],[68,51],[16,1],[68,50],[16,1],[68,65],[16,1],[68,114],[16,1],[68,114],[16,1],[68,97],[16,1],[68,121],[16,1],[32,0],[32,1],[32,2],[32,3],[68,1],[65,2],[16,builtin('__Porffor_printArray')],[33,7],[26],[68,0],[65,128,1],[15],[11]]),...t([94],()=>[[32,4],[65,222,0],[70],[4,64],[68,73],[16,1],[68,110],[16,1],[68,116],[16,1],[68,51],[16,1],[68,50],[16,1],[68,65],[16,1],[68,114],[16,1],[68,114],[16,1],[68,97],[16,1],[68,121],[16,1],[32,0],[32,1],[32,2],[32,3],[68,1],[65,2],[16,builtin('__Porffor_printArray')],[33,7],[26],[68,0],[65,128,1],[15],[11]]),...t([95],()=>[[32,4],[65,223,0],[70],[4,64],[68,70],[16,1],[68,108],[16,1],[68,111],[16,1],[68,97],[16,1],[68,116],[16,1],[68,51],[16,1],[68,50],[16,1],[68,65],[16,1],[68,114],[16,1],[68,114],[16,1],[68,97],[16,1],[68,121],[16,1],[32,0],[32,1],[32,2],[32,3],[68,1],[65,2],[16,builtin('__Porffor_printArray')],[33,7],[26],[68,0],[65,128,1],[15],[11]]),...t([96],()=>[[32,4],[65,224,0],[70],[4,64],[68,70],[16,1],[68,108],[16,1],[68,111],[16,1],[68,97],[16,1],[68,116],[16,1],[68,54],[16,1],[68,52],[16,1],[68,65],[16,1],[68,114],[16,1],[68,114],[16,1],[68,97],[16,1],[68,121],[16,1],[32,0],[32,1],[32,2],[32,3],[68,1],[65,2],[16,builtin('__Porffor_printArray')],[33,7],[26],[68,0],[65,128,1],[15],[11]]),...t([22,21],()=>[[32,4],[65,22],[70],[32,4],[65,21],[70],[114],[4,64],[32,1],[184],[68,22],[97],[4,64],[68,83],[16,1],[68,104],[16,1],[68,97],[16,1],[68,114],[16,1],[68,101],[16,1],[68,100],[16,1],[68,65],[16,1],[68,114],[16,1],[68,114],[16,1],[68,97],[16,1],[68,121],[16,1],[68,66],[16,1],[68,117],[16,1],[68,102],[16,1],[68,102],[16,1],[68,101],[16,1],[68,114],[16,1],[5],[68,65],[16,1],[68,114],[16,1],[68,114],[16,1],[68,97],[16,1],[68,121],[16,1],[68,66],[16,1],[68,117],[16,1],[68,102],[16,1],[68,102],[16,1],[68,101],[16,1],[68,114],[16,1],[11],[68,32],[16,1],[68,123],[16,1],[68,10],[16,1],[32,2],[33,5],[32,3],[33,6],[2,127],...t([67,195],()=>[[32,6],[65,195,0],[70],[32,6],[65,195,1],[70],[114],[4,64],[32,5],[252,3],[40,1,0],[12,1],[11]]),[32,5],[252,3],[11],[4,64],[68,27],[16,1],[68,91],[16,1],[68,51],[16,1],[68,52],[16,1],[68,109],[16,1],[11],[68,32],[16,1],[68,32],[16,1],[68,91],[16,1],[68,85],[16,1],[68,105],[16,1],[68,110],[16,1],[68,116],[16,1],[68,56],[16,1],[68,67],[16,1],[68,111],[16,1],[68,110],[16,1],[68,116],[16,1],[68,101],[16,1],[68,110],[16,1],[68,116],[16,1],[68,115],[16,1],[68,93],[16,1],[32,2],[33,5],[32,3],[33,6],[2,127],...t([67,195],()=>[[32,6],[65,195,0],[70],[32,6],[65,195,1],[70],[114],[4,64],[32,5],[252,3],[40,1,0],[12,1],[11]]),[32,5],[252,3],[11],[4,64],[68,27],[16,1],[68,91],[16,1],[68,48],[16,1],[68,109],[16,1],[11],[68,41],[16,1],[68,58],[16,1],[68,32],[16,1],[68,60],[16,1],[68,14],[65,6],[68,0],[65,7],[32,0],[32,1],[68,0],[65,128,1],[68,0],[65,128,1],[16,builtin('Uint8Array')],[34,7],[33,17],[34,16],[252,3],[40,1,0],[184],[68,1],[161],[33,18],[65,1],[33,19],[68,0],[33,10],[3,64],[32,10],[32,18],[101],[4,64],[2,64],[32,16],[33,13],[32,10],[33,14],[32,17],[33,6],[2,124],...t([67],()=>[[32,6],[65,195,0],[70],[4,64],[65,8],[16,builtin('__Porffor_allocateBytes')],[34,22],[65,1],[54,0,0],[32,22],[32,14],[252,3],[65,2],[108],[32,13],[252,3],[106],[47,0,4],[59,0,4],[32,22],[184],[65,195,0],[33,7],[12,1],[11]]),...t([80],()=>[[32,6],[65,208,0],[70],[4,64],[32,14],[252,3],[65,9],[108],[32,13],[252,3],[106],[34,15],[43,0,4],[32,15],[45,0,12],[33,7],[12,1],[11]]),...t([88],()=>[[32,6],[65,216,0],[70],[4,64],[32,13],[252,3],[40,0,4],[32,14],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11]]),...t([89],()=>[[32,6],[65,217,0],[70],[4,64],[32,13],[252,3],[40,0,4],[32,14],[252,3],[106],[44,0,4],[183],[65,1],[33,7],[12,1],[11]]),...t([90],()=>[[32,6],[65,218,0],[70],[4,64],[32,13],[252,3],[40,0,4],[32,14],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11]]),...t([91],()=>[[32,6],[65,219,0],[70],[4,64],[32,13],[252,3],[40,0,4],[32,14],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,7],[12,1],[11]]),...t([92],()=>[[32,6],[65,220,0],[70],[4,64],[32,13],[252,3],[40,0,4],[32,14],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,7],[12,1],[11]]),...t([93],()=>[[32,6],[65,221,0],[70],[4,64],[32,13],[252,3],[40,0,4],[32,14],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,7],[12,1],[11]]),...t([94],()=>[[32,6],[65,222,0],[70],[4,64],[32,13],[252,3],[40,0,4],[32,14],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,7],[12,1],[11]]),...t([95],()=>[[32,6],[65,223,0],[70],[4,64],[32,13],[252,3],[40,0,4],[32,14],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,7],[12,1],[11]]),...t([96],()=>[[32,6],[65,224,0],[70],[4,64],[32,13],[252,3],[40,0,4],[32,14],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,7],[12,1],[11]]),...t([128],()=>[[32,6],[65,128,1],[70],[4,64],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11]]),...t([195],()=>[[32,6],[65,195,1],[70],[4,64],[65,8],[16,builtin('__Porffor_allocateBytes')],[34,22],[65,1],[54,0,0],[32,22],[32,14],[252,3],[32,13],[252,3],[106],[45,0,4],[58,0,4],[32,22],[184],[65,195,1],[33,7],[12,1],[11]]),[32,13],[252,2],[32,17],[32,14],[65,1],[16,builtin('__ecma262_ToPropertyKey')],[33,23],[252,2],[32,23],[16,builtin('__Porffor_object_get')],[33,7],[11],[33,20],[32,7],[33,21],[32,20],[68,240],[16,builtin('f64_&')],[68,16],[163],[65,1],[16,builtin('__Porffor_printHexDigit')],[33,7],[26],[32,20],[68,15],[16,builtin('f64_&')],[65,1],[16,builtin('__Porffor_printHexDigit')],[33,7],[26],[32,10],[32,18],[98],[4,64],[68,32],[16,1],[11],[11],[32,10],[68,1],[160],[33,10],[68,0],[12,1],[11],[11],[68,62],[16,1],[68,44],[16,1],[68,10],[16,1],[68,32],[16,1],[68,32],[16,1],[68,98],[16,1],[68,121],[16,1],[68,116],[16,1],[68,101],[16,1],[68,76],[16,1],[68,101],[16,1],[68,110],[16,1],[68,103],[16,1],[68,116],[16,1],[68,104],[16,1],[68,58],[16,1],[68,32],[16,1],[32,2],[33,5],[32,3],[33,6],[2,127],...t([67,195],()=>[[32,6],[65,195,0],[70],[32,6],[65,195,1],[70],[114],[4,64],[32,5],[252,3],[40,1,0],[12,1],[11]]),[32,5],[252,3],[11],[4,64],[68,27],[16,1],[68,91],[16,1],[68,51],[16,1],[68,51],[16,1],[68,109],[16,1],[11],[32,0],[33,13],[32,1],[33,24],...makeString(_,"byteLength",1),[33,14],[32,1],[33,6],[2,124],...t([21],()=>[[32,6],[65,21],[70],[4,64],[32,13],[32,24],[16,builtin('__ArrayBuffer_prototype_byteLength$get')],[33,7],[12,1],[11]]),...t([22],()=>[[32,6],[65,22],[70],[4,64],[32,13],[32,24],[16,builtin('__SharedArrayBuffer_prototype_byteLength$get')],[33,7],[12,1],[11]]),...t([23],()=>[[32,6],[65,23],[70],[4,64],[32,13],[32,24],[16,builtin('__DataView_prototype_byteLength$get')],[33,7],[12,1],[11]]),...t([88],()=>[[32,6],[65,216,0],[70],[4,64],[32,13],[32,24],[16,builtin('__Uint8Array_prototype_byteLength$get')],[33,7],[12,1],[11]]),...t([89],()=>[[32,6],[65,217,0],[70],[4,64],[32,13],[32,24],[16,builtin('__Int8Array_prototype_byteLength$get')],[33,7],[12,1],[11]]),...t([90],()=>[[32,6],[65,218,0],[70],[4,64],[32,13],[32,24],[16,builtin('__Uint8ClampedArray_prototype_byteLength$get')],[33,7],[12,1],[11]]),...t([91],()=>[[32,6],[65,219,0],[70],[4,64],[32,13],[32,24],[16,builtin('__Uint16Array_prototype_byteLength$get')],[33,7],[12,1],[11]]),...t([92],()=>[[32,6],[65,220,0],[70],[4,64],[32,13],[32,24],[16,builtin('__Int16Array_prototype_byteLength$get')],[33,7],[12,1],[11]]),...t([93],()=>[[32,6],[65,221,0],[70],[4,64],[32,13],[32,24],[16,builtin('__Uint32Array_prototype_byteLength$get')],[33,7],[12,1],[11]]),...t([94],()=>[[32,6],[65,222,0],[70],[4,64],[32,13],[32,24],[16,builtin('__Int32Array_prototype_byteLength$get')],[33,7],[12,1],[11]]),...t([95],()=>[[32,6],[65,223,0],[70],[4,64],[32,13],[32,24],[16,builtin('__Float32Array_prototype_byteLength$get')],[33,7],[12,1],[11]]),...t([96],()=>[[32,6],[65,224,0],[70],[4,64],[32,13],[32,24],[16,builtin('__Float64Array_prototype_byteLength$get')],[33,7],[12,1],[11]]),...t([128],()=>[[32,6],[65,128,1],[70],[4,64],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11]]),[32,13],[252,2],[32,1],[32,14],[252,3],[65,195,1],[16,builtin('__Porffor_object_get')],[33,7],[11],[16,0],[32,2],[33,5],[32,3],[33,6],[2,127],...t([67,195],()=>[[32,6],[65,195,0],[70],[32,6],[65,195,1],[70],[114],[4,64],[32,5],[252,3],[40,1,0],[12,1],[11]]),[32,5],[252,3],[11],[4,64],[68,27],[16,1],[68,91],[16,1],[68,48],[16,1],[68,109],[16,1],[11],[68,10],[16,1],[68,125],[16,1],[68,0],[65,128,1],[15],[11]]),...t([23],()=>[[32,4],[65,23],[70],[4,64],[68,68],[16,1],[68,97],[16,1],[68,116],[16,1],[68,97],[16,1],[68,86],[16,1],[68,105],[16,1],[68,101],[16,1],[68,119],[16,1],[68,32],[16,1],[68,123],[16,1],[68,10],[16,1],[68,32],[16,1],[68,32],[16,1],[68,98],[16,1],[68,121],[16,1],[68,116],[16,1],[68,101],[16,1],[68,76],[16,1],[68,101],[16,1],[68,110],[16,1],[68,103],[16,1],[68,116],[16,1],[68,104],[16,1],[68,58],[16,1],[68,32],[16,1],[32,0],[32,1],[16,builtin('__DataView_prototype_byteLength$get')],[34,7],[32,2],[32,3],[16,builtin('__Porffor_print')],[33,7],[26],[68,44],[16,1],[68,10],[16,1],[68,32],[16,1],[68,32],[16,1],[68,98],[16,1],[68,121],[16,1],[68,116],[16,1],[68,101],[16,1],[68,79],[16,1],[68,102],[16,1],[68,102],[16,1],[68,115],[16,1],[68,101],[16,1],[68,116],[16,1],[68,58],[16,1],[68,32],[16,1],[32,0],[32,1],[16,builtin('__DataView_prototype_byteOffset$get')],[34,7],[32,2],[32,3],[16,builtin('__Porffor_print')],[33,7],[26],[68,44],[16,1],[68,10],[16,1],[68,32],[16,1],[68,32],[16,1],[68,98],[16,1],[68,117],[16,1],[68,102],[16,1],[68,102],[16,1],[68,101],[16,1],[68,114],[16,1],[68,58],[16,1],[68,32],[16,1],[32,0],[32,1],[16,builtin('__DataView_prototype_buffer$get')],[34,7],[32,2],[32,3],[16,builtin('__Porffor_print')],[33,7],[26],[68,10],[16,1],[68,125],[16,1],[68,0],[65,128,1],[15],[11]]),...t([35,20],()=>[[32,4],[65,35],[70],[32,4],[65,20],[70],[114],[4,64],[32,1],[184],[68,35],[97],[4,64],[68,87],[16,1],[68,101],[16,1],[68,97],[16,1],[68,107],[16,1],[68,77],[16,1],[68,97],[16,1],[68,112],[16,1],[5],[68,77],[16,1],[68,97],[16,1],[68,112],[16,1],[11],[68,40],[16,1],[32,0],[32,1],[16,builtin('__Map_prototype_keys')],[33,7],[34,25],[252,3],[40,1,0],[184],[68,1],[161],[34,26],[68,1],[160],[16,0],[68,41],[16,1],[68,32],[16,1],[68,123],[16,1],[68,32],[16,1],[68,0],[33,10],[3,64],[32,10],[32,26],[99],[4,64],[32,25],[33,13],[65,208,0],[33,24],[32,10],[34,14],[252,3],[65,9],[108],[32,13],[252,3],[106],[34,15],[43,0,4],[32,15],[45,0,12],[34,7],[33,28],[34,27],[32,28],[68,0],[65,128,1],[16,builtin('__Porffor_print')],[33,7],[26],[68,32],[16,1],[68,61],[16,1],[68,62],[16,1],[68,32],[16,1],[32,0],[32,1],[32,27],[32,28],[16,builtin('__Map_prototype_get')],[34,7],[32,2],[32,3],[16,builtin('__Porffor_print')],[33,7],[26],[32,10],[32,26],[98],[4,64],[68,44],[16,1],[68,32],[16,1],[11],[32,10],[68,1],[160],[33,10],[68,0],[12,1],[11],[11],[68,32],[16,1],[68,125],[16,1],[68,0],[65,128,1],[15],[11]]),...t([34,19],()=>[[32,4],[65,34],[70],[32,4],[65,19],[70],[114],[4,64],[32,1],[184],[68,34],[97],[4,64],[68,87],[16,1],[68,101],[16,1],[68,97],[16,1],[68,107],[16,1],[68,83],[16,1],[68,101],[16,1],[68,116],[16,1],[5],[68,83],[16,1],[68,101],[16,1],[68,116],[16,1],[11],[68,40],[16,1],[32,0],[32,1],[16,builtin('__Set_prototype_values')],[33,7],[34,29],[252,3],[40,1,0],[184],[68,1],[161],[34,30],[68,1],[160],[16,0],[68,41],[16,1],[68,32],[16,1],[68,123],[16,1],[68,32],[16,1],[68,0],[33,10],[3,64],[32,10],[32,30],[101],[4,64],[32,29],[33,13],[65,208,0],[33,24],[32,10],[34,14],[252,3],[65,9],[108],[32,13],[252,3],[106],[34,15],[43,0,4],[32,15],[45,0,12],[34,7],[32,2],[32,3],[16,builtin('__Porffor_print')],[33,7],[26],[32,10],[32,30],[98],[4,64],[68,44],[16,1],[68,32],[16,1],[11],[32,10],[68,1],[160],[33,10],[68,0],[12,1],[11],[11],[68,32],[16,1],[68,125],[16,1],[68,0],[65,128,1],[15],[11]]),...t([33],()=>[[32,4],[65,33],[70],[4,64],[68,87],[16,1],[68,101],[16,1],[68,97],[16,1],[68,107],[16,1],[68,82],[16,1],[68,101],[16,1],[68,102],[16,1],[68,32],[16,1],[68,123],[16,1],[68,125],[16,1],[68,0],[65,128,1],[15],[11]]),[11],[68,0],[65,128,1],[15]],
748
751
  params:[124,127,124,127],typedParams:1,returns:[124,127],typedReturns:1,
749
752
  locals:[127,124,127,127,124,124,124,124,127,124,124,127,124,127,124,127,124,127,127,127,127,124,124,124,127,124,124],localNames:["arg","arg#type","colors","colors#type","#typeswitch_tmp1","#logicinner_tmp","#typeswitch_tmp2","#last_type","keys","len","i","x","x#type","#member_obj","#member_prop","#loadArray_offset","buffer","buffer#type","bufferLen","bufferLen#type","ele","ele#type","#member_allocd","#swap","#member_obj#type","map","mapLen","key","key#type","set","setLen"],
750
753
  usedTypes:[80,195,67],
751
- usesTag:1,
754
+ usesTag:1,usesImports:1,
752
755
  }
753
756
  this.__Porffor_printArray = {
754
757
  wasm:(_,{t,builtin,internalThrow})=>[[32,5],[65,128,1],[70],[4,64],[68,0],[33,4],[65,2],[33,5],[11],[32,0],[252,3],[40,1,0],[184],[68,1],[161],[33,6],[32,4],[33,7],[32,5],[33,8],[2,127],...t([67,195],()=>[[32,8],[65,195,0],[70],[32,8],[65,195,1],[70],[114],[4,64],[32,7],[252,3],[40,1,0],[12,1],[11]]),[32,7],[252,3],[11],[4,64],[68,40],[16,1],[32,6],[68,1],[160],[16,0],[68,41],[16,1],[68,32],[16,1],[11],[32,6],[68,-1],[97],[4,64],[68,91],[16,1],[68,93],[16,1],[5],[68,91],[16,1],[68,32],[16,1],[68,0],[33,9],[3,64],[32,9],[32,6],[101],[4,64],[2,64],[32,0],[33,10],[32,9],[33,11],[32,1],[33,8],[2,124],...t([67],()=>[[32,8],[65,195,0],[70],[4,64],[65,8],[16,builtin('__Porffor_allocateBytes')],[34,13],[65,1],[54,0,0],[32,13],[32,11],[252,3],[65,2],[108],[32,10],[252,3],[106],[47,0,4],[59,0,4],[32,13],[184],[65,195,0],[33,12],[12,1],[11]]),...t([80],()=>[[32,8],[65,208,0],[70],[4,64],[32,11],[252,3],[65,9],[108],[32,10],[252,3],[106],[34,14],[43,0,4],[32,14],[45,0,12],[33,12],[12,1],[11]]),...t([88],()=>[[32,8],[65,216,0],[70],[4,64],[32,10],[252,3],[40,0,4],[32,11],[252,3],[106],[45,0,4],[184],[65,1],[33,12],[12,1],[11]]),...t([89],()=>[[32,8],[65,217,0],[70],[4,64],[32,10],[252,3],[40,0,4],[32,11],[252,3],[106],[44,0,4],[183],[65,1],[33,12],[12,1],[11]]),...t([90],()=>[[32,8],[65,218,0],[70],[4,64],[32,10],[252,3],[40,0,4],[32,11],[252,3],[106],[45,0,4],[184],[65,1],[33,12],[12,1],[11]]),...t([91],()=>[[32,8],[65,219,0],[70],[4,64],[32,10],[252,3],[40,0,4],[32,11],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,12],[12,1],[11]]),...t([92],()=>[[32,8],[65,220,0],[70],[4,64],[32,10],[252,3],[40,0,4],[32,11],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,12],[12,1],[11]]),...t([93],()=>[[32,8],[65,221,0],[70],[4,64],[32,10],[252,3],[40,0,4],[32,11],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,12],[12,1],[11]]),...t([94],()=>[[32,8],[65,222,0],[70],[4,64],[32,10],[252,3],[40,0,4],[32,11],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,12],[12,1],[11]]),...t([95],()=>[[32,8],[65,223,0],[70],[4,64],[32,10],[252,3],[40,0,4],[32,11],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,12],[12,1],[11]]),...t([96],()=>[[32,8],[65,224,0],[70],[4,64],[32,10],[252,3],[40,0,4],[32,11],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,12],[12,1],[11]]),...t([128],()=>[[32,8],[65,128,1],[70],[4,64],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11]]),...t([195],()=>[[32,8],[65,195,1],[70],[4,64],[65,8],[16,builtin('__Porffor_allocateBytes')],[34,13],[65,1],[54,0,0],[32,13],[32,11],[252,3],[32,10],[252,3],[106],[45,0,4],[58,0,4],[32,13],[184],[65,195,1],[33,12],[12,1],[11]]),[32,10],[252,2],[32,1],[32,11],[65,1],[16,builtin('__ecma262_ToPropertyKey')],[33,15],[252,2],[32,15],[16,builtin('__Porffor_object_get')],[33,12],[11],[32,12],[32,2],[65,2],[16,builtin('__Porffor_print')],[33,12],[26],[32,9],[32,6],[98],[4,64],[68,44],[16,1],[68,32],[16,1],[11],[11],[32,9],[68,1],[160],[33,9],[68,0],[12,1],[11],[11],[68,32],[16,1],[68,93],[16,1],[11],[68,0],[65,128,1],[15]],
755
758
  params:[124,127,124,127,124,127],typedParams:1,returns:[124,127],typedReturns:1,
756
759
  locals:[124,124,127,124,124,124,127,127,127,127],localNames:["arg","arg#type","colors","colors#type","length","length#type","arrLen","#logicinner_tmp","#typeswitch_tmp1","i","#member_obj","#member_prop","#last_type","#member_allocd","#loadArray_offset","#swap"],
757
760
  usedTypes:[67,195],
758
- usesTag:1,
761
+ usesTag:1,usesImports:1,
759
762
  }
760
763
  this.__Porffor_consoleIndent = {
761
764
  wasm:(_,{glbl})=>[[68,0],[33,0],[65,1],[33,1],[3,64],[32,0],...glbl(35,'tabLevel',124),[99],[4,64],[68,9],[16,1],[32,0],[68,1],[160],[33,0],[68,0],[12,1],[11],[11],[68,0],[65,128,1],[15]],
762
765
  params:[],typedParams:1,returns:[124,127],typedReturns:1,
763
766
  locals:[124,127],localNames:["i","i#type"],
764
767
  globalInits:{tabLevel:(_,{glbl})=>[[68,0],...glbl(36,'tabLevel',124),[65,1],...glbl(36,'tabLevel#type',127)],countMap:(_,{glbl,loc,builtin})=>[[68,49],[65,6],[68,0],[65,7],[68,0],[65,128,1],[16,builtin('Map')],[34,loc('#last_type',127)],...glbl(36,'countMap#type',127),...glbl(36,'countMap',124)],timeMap:(_,{glbl,loc,builtin})=>[[68,49],[65,6],[68,0],[65,7],[68,0],[65,128,1],[16,builtin('Map')],[34,loc('#last_type',127)],...glbl(36,'timeMap#type',127),...glbl(36,'timeMap',124)]},
768
+ usesImports:1,
765
769
  }
766
770
  this.__console_clear = {
767
771
  wasm:(_,{glbl})=>[[68,27],[16,1],[68,91],[16,1],[68,49],[16,1],[68,59],[16,1],[68,49],[16,1],[68,72],[16,1],[68,27],[16,1],[68,91],[16,1],[68,74],[16,1],[68,0],...glbl(36,'tabLevel',124),[65,1],...glbl(36,'tabLevel#type',127),[68,0],[65,128,1],[15]],
768
772
  params:[],typedParams:1,returns:[124,127],typedReturns:1,
769
773
  locals:[],localNames:[],
770
774
  globalInits:{tabLevel:(_,{glbl})=>[[68,0],...glbl(36,'tabLevel',124),[65,1],...glbl(36,'tabLevel#type',127)],countMap:(_,{glbl,loc,builtin})=>[[68,49],[65,6],[68,0],[65,7],[68,0],[65,128,1],[16,builtin('Map')],[34,loc('#last_type',127)],...glbl(36,'countMap#type',127),...glbl(36,'countMap',124)],timeMap:(_,{glbl,loc,builtin})=>[[68,49],[65,6],[68,0],[65,7],[68,0],[65,128,1],[16,builtin('Map')],[34,loc('#last_type',127)],...glbl(36,'timeMap#type',127),...glbl(36,'timeMap',124)]},
775
+ usesImports:1,
771
776
  }
772
777
  this.__Porffor_consolePrint = {
773
778
  wasm:(_,{builtin})=>[[32,1],[184],[68,195],[97],[32,1],[184],[68,67],[97],[114],[4,64],[32,0],[32,1],[16,builtin('__Porffor_printString')],[26],[26],[68,0],[65,128,1],[15],[11],[32,0],[32,1],[68,0],[65,128,1],[16,builtin('__Porffor_print')],[26],[26],[68,0],[65,128,1],[15]],
@@ -798,56 +803,56 @@ wasm:(_,{builtin})=>[[32,0],[252,3],[40,1,0],[184],[68,1],[161],[33,2],[68,0],[3
798
803
  params:[124,127],typedParams:1,returns:[124,127],typedReturns:1,
799
804
  locals:[124,124,127,127,124,124,127],localNames:["args","args#type","argLen","i","i#type","#last_type","#member_obj","#member_prop","#loadArray_offset"],
800
805
  usedTypes:[80],
801
- hasRestArgument:1,
806
+ hasRestArgument:1,usesImports:1,
802
807
  }
803
808
  this.__console_debug = {
804
809
  wasm:(_,{builtin})=>[[32,0],[252,3],[40,1,0],[184],[68,1],[161],[33,2],[68,0],[33,3],[65,1],[33,4],[3,64],[32,3],[32,2],[101],[4,64],[16,builtin('__Porffor_consoleIndent')],[33,5],[26],[32,0],[33,6],[32,3],[34,7],[252,3],[65,9],[108],[32,6],[252,3],[106],[34,8],[43,0,4],[32,8],[45,0,12],[34,5],[16,builtin('__Porffor_consolePrint')],[33,5],[26],[32,3],[32,2],[98],[4,64],[68,32],[16,1],[11],[32,3],[68,1],[160],[33,3],[68,0],[12,1],[11],[11],[68,10],[16,1],[68,0],[65,128,1],[15]],
805
810
  params:[124,127],typedParams:1,returns:[124,127],typedReturns:1,
806
811
  locals:[124,124,127,127,124,124,127],localNames:["args","args#type","argLen","i","i#type","#last_type","#member_obj","#member_prop","#loadArray_offset"],
807
812
  usedTypes:[80],
808
- hasRestArgument:1,
813
+ hasRestArgument:1,usesImports:1,
809
814
  }
810
815
  this.__console_info = {
811
816
  wasm:(_,{builtin})=>[[32,0],[252,3],[40,1,0],[184],[68,1],[161],[33,2],[68,0],[33,3],[65,1],[33,4],[3,64],[32,3],[32,2],[101],[4,64],[16,builtin('__Porffor_consoleIndent')],[33,5],[26],[32,0],[33,6],[32,3],[34,7],[252,3],[65,9],[108],[32,6],[252,3],[106],[34,8],[43,0,4],[32,8],[45,0,12],[34,5],[16,builtin('__Porffor_consolePrint')],[33,5],[26],[32,3],[32,2],[98],[4,64],[68,32],[16,1],[11],[32,3],[68,1],[160],[33,3],[68,0],[12,1],[11],[11],[68,10],[16,1],[68,0],[65,128,1],[15]],
812
817
  params:[124,127],typedParams:1,returns:[124,127],typedReturns:1,
813
818
  locals:[124,124,127,127,124,124,127],localNames:["args","args#type","argLen","i","i#type","#last_type","#member_obj","#member_prop","#loadArray_offset"],
814
819
  usedTypes:[80],
815
- hasRestArgument:1,
820
+ hasRestArgument:1,usesImports:1,
816
821
  }
817
822
  this.__console_warn = {
818
823
  wasm:(_,{builtin})=>[[32,0],[252,3],[40,1,0],[184],[68,1],[161],[33,2],[68,0],[33,3],[65,1],[33,4],[3,64],[32,3],[32,2],[101],[4,64],[16,builtin('__Porffor_consoleIndent')],[33,5],[26],[32,0],[33,6],[32,3],[34,7],[252,3],[65,9],[108],[32,6],[252,3],[106],[34,8],[43,0,4],[32,8],[45,0,12],[34,5],[16,builtin('__Porffor_consolePrint')],[33,5],[26],[32,3],[32,2],[98],[4,64],[68,32],[16,1],[11],[32,3],[68,1],[160],[33,3],[68,0],[12,1],[11],[11],[68,10],[16,1],[68,0],[65,128,1],[15]],
819
824
  params:[124,127],typedParams:1,returns:[124,127],typedReturns:1,
820
825
  locals:[124,124,127,127,124,124,127],localNames:["args","args#type","argLen","i","i#type","#last_type","#member_obj","#member_prop","#loadArray_offset"],
821
826
  usedTypes:[80],
822
- hasRestArgument:1,
827
+ hasRestArgument:1,usesImports:1,
823
828
  }
824
829
  this.__console_error = {
825
830
  wasm:(_,{builtin})=>[[32,0],[252,3],[40,1,0],[184],[68,1],[161],[33,2],[68,0],[33,3],[65,1],[33,4],[3,64],[32,3],[32,2],[101],[4,64],[16,builtin('__Porffor_consoleIndent')],[33,5],[26],[32,0],[33,6],[32,3],[34,7],[252,3],[65,9],[108],[32,6],[252,3],[106],[34,8],[43,0,4],[32,8],[45,0,12],[34,5],[16,builtin('__Porffor_consolePrint')],[33,5],[26],[32,3],[32,2],[98],[4,64],[68,32],[16,1],[11],[32,3],[68,1],[160],[33,3],[68,0],[12,1],[11],[11],[68,10],[16,1],[68,0],[65,128,1],[15]],
826
831
  params:[124,127],typedParams:1,returns:[124,127],typedReturns:1,
827
832
  locals:[124,124,127,127,124,124,127],localNames:["args","args#type","argLen","i","i#type","#last_type","#member_obj","#member_prop","#loadArray_offset"],
828
833
  usedTypes:[80],
829
- hasRestArgument:1,
834
+ hasRestArgument:1,usesImports:1,
830
835
  }
831
836
  this.__console_assert = {
832
837
  wasm:(_,{t,builtin})=>[[32,0],[33,4],[32,1],[33,5],[2,127],...t([67,195],()=>[[32,5],[65,195,0],[70],[32,5],[65,195,1],[70],[114],[4,64],[32,4],[252,3],[40,1,0],[12,1],[11]]),[32,4],[252,3],[11],[4,64],[68,0],[65,128,1],[15],[11],[16,builtin('__Porffor_consoleIndent')],[33,6],[26],[68,65],[16,1],[68,115],[16,1],[68,115],[16,1],[68,101],[16,1],[68,114],[16,1],[68,116],[16,1],[68,105],[16,1],[68,111],[16,1],[68,110],[16,1],[68,32],[16,1],[68,102],[16,1],[68,97],[16,1],[68,105],[16,1],[68,108],[16,1],[68,101],[16,1],[68,100],[16,1],[32,2],[252,3],[40,1,0],[184],[68,0],[98],[4,64],[68,58],[16,1],[68,32],[16,1],[11],[32,2],[252,3],[40,1,0],[184],[68,1],[161],[33,7],[68,0],[33,8],[65,1],[33,9],[3,64],[32,8],[32,7],[101],[4,64],[32,2],[33,10],[32,8],[34,11],[252,3],[65,9],[108],[32,10],[252,3],[106],[34,12],[43,0,4],[32,12],[45,0,12],[34,6],[16,builtin('__Porffor_consolePrint')],[33,6],[26],[32,8],[32,7],[98],[4,64],[68,32],[16,1],[11],[32,8],[68,1],[160],[33,8],[68,0],[12,1],[11],[11],[68,10],[16,1],[68,0],[65,128,1],[15]],
833
838
  params:[124,127,124,127],typedParams:1,returns:[124,127],typedReturns:1,
834
839
  locals:[124,127,127,124,124,127,124,124,127],localNames:["assertion","assertion#type","args","args#type","#logicinner_tmp","#typeswitch_tmp1","#last_type","argLen","i","i#type","#member_obj","#member_prop","#loadArray_offset"],
835
840
  usedTypes:[80],
836
- hasRestArgument:1,
841
+ hasRestArgument:1,usesImports:1,
837
842
  }
838
843
  this.__Porffor_dirObject = {
839
844
  wasm:(_,{t,builtin,internalThrow})=>[[32,1],[184],[68,7],[98],[34,8],[69],[4,127],[32,4],[68,0],[97],[65,2],[33,9],[5],[32,8],[65,2],[33,9],[11],[4,64],[32,0],[32,1],[32,2],[65,2],[16,builtin('__Porffor_print')],[33,9],[26],[68,0],[65,128,1],[15],[11],[68,123],[16,1],[68,32],[16,1],[32,0],[32,1],[16,builtin('__Object_keys')],[34,9],[33,11],[34,10],[252,3],[40,1,0],[184],[68,1],[161],[33,12],[65,1],[33,13],[68,0],[33,14],[65,1],[33,15],[3,64],[32,14],[32,12],[101],[4,64],[2,64],[32,10],[33,18],[32,14],[33,19],[32,11],[33,20],[2,124],...t([67],()=>[[32,20],[65,195,0],[70],[4,64],[65,8],[16,builtin('__Porffor_allocateBytes')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[65,2],[108],[32,18],[252,3],[106],[47,0,4],[59,0,4],[32,21],[184],[65,195,0],[33,9],[12,1],[11]]),...t([80],()=>[[32,20],[65,208,0],[70],[4,64],[32,19],[252,3],[65,9],[108],[32,18],[252,3],[106],[34,22],[43,0,4],[32,22],[45,0,12],[33,9],[12,1],[11]]),...t([88],()=>[[32,20],[65,216,0],[70],[4,64],[32,18],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,9],[12,1],[11]]),...t([89],()=>[[32,20],[65,217,0],[70],[4,64],[32,18],[252,3],[40,0,4],[32,19],[252,3],[106],[44,0,4],[183],[65,1],[33,9],[12,1],[11]]),...t([90],()=>[[32,20],[65,218,0],[70],[4,64],[32,18],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,9],[12,1],[11]]),...t([91],()=>[[32,20],[65,219,0],[70],[4,64],[32,18],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,9],[12,1],[11]]),...t([92],()=>[[32,20],[65,220,0],[70],[4,64],[32,18],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,9],[12,1],[11]]),...t([93],()=>[[32,20],[65,221,0],[70],[4,64],[32,18],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,9],[12,1],[11]]),...t([94],()=>[[32,20],[65,222,0],[70],[4,64],[32,18],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,9],[12,1],[11]]),...t([95],()=>[[32,20],[65,223,0],[70],[4,64],[32,18],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,9],[12,1],[11]]),...t([96],()=>[[32,20],[65,224,0],[70],[4,64],[32,18],[252,3],[40,0,4],[32,19],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,9],[12,1],[11]]),...t([128],()=>[[32,20],[65,128,1],[70],[4,64],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11]]),...t([195],()=>[[32,20],[65,195,1],[70],[4,64],[65,8],[16,builtin('__Porffor_allocateBytes')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[32,18],[252,3],[106],[45,0,4],[58,0,4],[32,21],[184],[65,195,1],[33,9],[12,1],[11]]),[32,18],[252,2],[32,11],[32,19],[32,15],[16,builtin('__ecma262_ToPropertyKey')],[33,23],[252,2],[32,23],[16,builtin('__Porffor_object_get')],[33,9],[11],[33,16],[32,9],[33,17],[32,16],[32,17],[16,builtin('__Porffor_consolePrint')],[33,9],[26],[68,58],[16,1],[68,32],[16,1],[32,0],[252,2],[32,1],[32,16],[252,2],[32,17],[16,builtin('__Porffor_object_get')],[34,9],[33,25],[34,24],[32,25],[32,2],[65,2],[32,4],[68,1],[161],[65,1],[32,6],[65,2],[16,builtin('__Porffor_dirObject')],[33,9],[26],[2,127],[32,14],[34,26],[32,12],[34,27],[32,15],[65,128,1],[114],[65,195,1],[70],[32,13],[65,128,1],[114],[65,195,1],[70],[114],[4,64],[32,26],[32,15],[32,27],[32,13],[16,builtin('__Porffor_compareStrings')],[26],[252,3],[69],[12,1],[11],[98],[11],[4,64],[68,44],[16,1],[68,32],[16,1],[11],[11],[32,14],[68,1],[160],[33,14],[68,0],[12,1],[11],[11],[68,32],[16,1],[68,125],[16,1],[68,0],[65,128,1],[15]],
840
845
  params:[124,127,124,127,124,127,124,127],typedParams:1,returns:[124,127],typedReturns:1,
841
846
  locals:[127,127,124,127,124,127,124,127,124,127,124,124,127,127,127,127,124,127,124,124],localNames:["obj","obj#type","colors","colors#type","depth","depth#type","showHidden","showHidden#type","logictmpi","#last_type","keys","keys#type","keysLen","keysLen#type","i","i#type","key","key#type","#member_obj","#member_prop","#typeswitch_tmp1","#member_allocd","#loadArray_offset","#swap","value","value#type","__tmpop_left","__tmpop_right"],
842
847
  usedTypes:[67,195],
843
- usesTag:1,
848
+ usesTag:1,usesImports:1,
844
849
  }
845
850
  this.__console_dir = {
846
851
  wasm:(_,{t,makeString,builtin,internalThrow})=>[[68,1],[33,4],[68,2],[33,5],[68,0],[33,6],[32,2],[33,7],[32,3],[33,8],[2,127],...t([67,195],()=>[[32,8],[65,195,0],[70],[32,8],[65,195,1],[70],[114],[4,64],[32,7],[252,3],[40,1,0],[12,1],[11]]),[32,7],[252,3],[11],[4,64],[32,2],[33,9],...makeString(_,"colors",1),[33,10],[32,3],[33,8],[2,124],...t([128],()=>[[32,8],[65,128,1],[70],[4,64],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11]]),[32,9],[252,2],[32,3],[32,10],[252,3],[65,195,1],[16,builtin('__Porffor_object_get')],[33,11],[11],[33,4],[32,2],[33,9],...makeString(_,"depth",1),[33,10],[32,3],[33,8],[2,124],...t([128],()=>[[32,8],[65,128,1],[70],[4,64],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11]]),[32,9],[252,2],[32,3],[32,10],[252,3],[65,195,1],[16,builtin('__Porffor_object_get')],[33,11],[11],[33,5],[32,2],[33,9],...makeString(_,"showHidden",1),[33,10],[32,3],[33,8],[2,124],...t([128],()=>[[32,8],[65,128,1],[70],[4,64],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11]]),[32,9],[252,2],[32,3],[32,10],[252,3],[65,195,1],[16,builtin('__Porffor_object_get')],[33,11],[11],[33,6],[11],[16,builtin('__Porffor_consoleIndent')],[33,11],[26],[32,0],[32,1],[32,4],[65,2],[32,5],[65,1],[32,6],[65,2],[16,builtin('__Porffor_dirObject')],[33,11],[26],[68,10],[16,1],[68,0],[65,128,1],[15]],
847
852
  params:[124,127,124,127],typedParams:1,returns:[124,127],typedReturns:1,
848
853
  locals:[124,124,124,124,127,124,124,127],localNames:["obj","obj#type","options","options#type","colors","depth","showHidden","#logicinner_tmp","#typeswitch_tmp1","#member_obj","#member_prop","#last_type"],
849
854
  usedTypes:[195],
850
- usesTag:1,
855
+ usesTag:1,usesImports:1,
851
856
  }
852
857
  this.__console_dirxml = {
853
858
  wasm:(_,{builtin})=>[[32,0],[32,1],[68,0],[65,128,1],[16,builtin('__console_dir')],[34,2],[15]],
@@ -860,7 +865,7 @@ params:[124,127],typedParams:1,returns:[124,127],typedReturns:1,
860
865
  locals:[124,124,127,127,124,127,124,127],localNames:["label","label#type","logictmp","#logicinner_tmp","#typeswitch_tmp1","#last_type","val","val#type","#proto_target","#proto_target#type"],
861
866
  usedTypes:[195],
862
867
  globalInits:{tabLevel:(_,{glbl})=>[[68,0],...glbl(36,'tabLevel',124),[65,1],...glbl(36,'tabLevel#type',127)],countMap:(_,{glbl,loc,builtin})=>[[68,49],[65,6],[68,0],[65,7],[68,0],[65,128,1],[16,builtin('Map')],[34,loc('#last_type',127)],...glbl(36,'countMap#type',127),...glbl(36,'countMap',124)],timeMap:(_,{glbl,loc,builtin})=>[[68,49],[65,6],[68,0],[65,7],[68,0],[65,128,1],[16,builtin('Map')],[34,loc('#last_type',127)],...glbl(36,'timeMap#type',127),...glbl(36,'timeMap',124)]},
863
- usesTag:1,
868
+ usesTag:1,usesImports:1,
864
869
  }
865
870
  this.__console_countReset = {
866
871
  wasm:(_,{t,makeString,glbl,builtin,internalThrow})=>[[32,0],[34,2],[33,3],[32,1],[33,4],[2,127],...t([0,128],()=>[[32,4],[65,0],[70],[32,4],[65,128,1],[70],[114],[4,64],[65,1],[12,1],[11]]),...t([7],()=>[[32,4],[65,7],[70],[4,64],[32,3],[68,0],[97],[12,1],[11]]),[65,0],[11],[4,124],...makeString(_,"default",1),[34,0],[65,195,1],[33,5],[5],[32,2],[32,1],[33,5],[11],[32,0],[32,5],[33,1],[26],[26],...glbl(35,'countMap',124),[33,6],...glbl(35,'countMap#type',127),[33,7],...glbl(35,'countMap#type',127),[33,4],[2,124],...t([20],()=>[[32,4],[65,20],[70],[4,64],[32,6],[32,7],[32,0],[32,1],[68,-1],[65,1],[16,builtin('__Map_prototype_set')],[33,5],[12,1],[11]]),...t([35],()=>[[32,4],[65,35],[70],[4,64],[32,6],[32,7],[32,0],[32,1],[68,-1],[65,1],[16,builtin('__WeakMap_prototype_set')],[33,5],[12,1],[11]]),...internalThrow(_,'TypeError',`'set' proto func tried to be called on a type without an impl`),[68,0],[11],[26],[32,0],[32,1],[16,builtin('__console_count')],[33,5],[26],[68,0],[65,128,1],[15]],
@@ -876,7 +881,7 @@ params:[124,127],typedParams:1,returns:[124,127],typedReturns:1,
876
881
  locals:[124,124,127,127,124,127],localNames:["label","label#type","logictmp","#logicinner_tmp","#typeswitch_tmp1","#last_type","#proto_target","#proto_target#type"],
877
882
  usedTypes:[195],
878
883
  globalInits:{tabLevel:(_,{glbl})=>[[68,0],...glbl(36,'tabLevel',124),[65,1],...glbl(36,'tabLevel#type',127)],countMap:(_,{glbl,loc,builtin})=>[[68,49],[65,6],[68,0],[65,7],[68,0],[65,128,1],[16,builtin('Map')],[34,loc('#last_type',127)],...glbl(36,'countMap#type',127),...glbl(36,'countMap',124)],timeMap:(_,{glbl,loc,builtin})=>[[68,49],[65,6],[68,0],[65,7],[68,0],[65,128,1],[16,builtin('Map')],[34,loc('#last_type',127)],...glbl(36,'timeMap#type',127),...glbl(36,'timeMap',124)]},
879
- usesTag:1,
884
+ usesTag:1,usesImports:1,
880
885
  }
881
886
  this.__console_timeLog = {
882
887
  wasm:(_,{t,makeString,glbl,builtin,internalThrow})=>[[32,0],[34,2],[33,3],[32,1],[33,4],[2,127],...t([0,128],()=>[[32,4],[65,0],[70],[32,4],[65,128,1],[70],[114],[4,64],[65,1],[12,1],[11]]),...t([7],()=>[[32,4],[65,7],[70],[4,64],[32,3],[68,0],[97],[12,1],[11]]),[65,0],[11],[4,124],...makeString(_,"default",1),[34,0],[65,195,1],[33,5],[5],[32,2],[32,1],[33,5],[11],[32,0],[32,5],[33,1],[26],[26],[16,builtin('__Porffor_consoleIndent')],[33,5],[26],...glbl(35,'timeMap',124),[33,8],...glbl(35,'timeMap#type',127),[33,9],...glbl(35,'timeMap#type',127),[33,4],[2,124],...t([20],()=>[[32,4],[65,20],[70],[4,64],[32,8],[32,9],[32,0],[32,1],[16,builtin('__Map_prototype_get')],[33,5],[12,1],[11]]),...internalThrow(_,'TypeError',`'get' proto func tried to be called on a type without an impl`),[68,0],[11],[33,6],[32,5],[33,7],[32,6],[33,3],[32,7],[33,4],[2,124],...t([67,195],()=>[[32,4],[65,195,0],[70],[32,4],[65,195,1],[70],[114],[4,64],[32,3],[252,3],[40,1,0],[69],[184],[12,1],[11]]),[32,3],[68,0],[97],[184],[11],[252,3],[4,64],[68,84],[16,1],[68,105],[16,1],[68,109],[16,1],[68,101],[16,1],[68,114],[16,1],[68,32],[16,1],[68,39],[16,1],[32,0],[32,1],[16,builtin('__Porffor_consolePrint')],[33,5],[26],[68,39],[16,1],[68,32],[16,1],[68,100],[16,1],[68,111],[16,1],[68,101],[16,1],[68,115],[16,1],[68,32],[16,1],[68,110],[16,1],[68,111],[16,1],[68,116],[16,1],[68,32],[16,1],[68,101],[16,1],[68,120],[16,1],[68,105],[16,1],[68,115],[16,1],[68,116],[16,1],[68,10],[16,1],[68,0],[65,128,1],[15],[11],[32,0],[32,1],[16,builtin('__Porffor_consolePrint')],[33,5],[26],[68,58],[16,1],[68,32],[16,1],[16,builtin('__performance_now')],[32,6],[161],[16,0],[68,32],[16,1],[68,109],[16,1],[68,115],[16,1],[68,10],[16,1],[68,0],[65,128,1],[15]],
@@ -884,7 +889,7 @@ params:[124,127],typedParams:1,returns:[124,127],typedReturns:1,
884
889
  locals:[124,124,127,127,124,127,124,127],localNames:["label","label#type","logictmp","#logicinner_tmp","#typeswitch_tmp1","#last_type","val","val#type","#proto_target","#proto_target#type"],
885
890
  usedTypes:[195],
886
891
  globalInits:{tabLevel:(_,{glbl})=>[[68,0],...glbl(36,'tabLevel',124),[65,1],...glbl(36,'tabLevel#type',127)],countMap:(_,{glbl,loc,builtin})=>[[68,49],[65,6],[68,0],[65,7],[68,0],[65,128,1],[16,builtin('Map')],[34,loc('#last_type',127)],...glbl(36,'countMap#type',127),...glbl(36,'countMap',124)],timeMap:(_,{glbl,loc,builtin})=>[[68,49],[65,6],[68,0],[65,7],[68,0],[65,128,1],[16,builtin('Map')],[34,loc('#last_type',127)],...glbl(36,'timeMap#type',127),...glbl(36,'timeMap',124)]},
887
- usesTag:1,
892
+ usesTag:1,usesImports:1,
888
893
  }
889
894
  this.__console_timeEnd = {
890
895
  wasm:(_,{t,makeString,glbl,builtin,internalThrow})=>[[32,0],[34,2],[33,3],[32,1],[33,4],[2,127],...t([0,128],()=>[[32,4],[65,0],[70],[32,4],[65,128,1],[70],[114],[4,64],[65,1],[12,1],[11]]),...t([7],()=>[[32,4],[65,7],[70],[4,64],[32,3],[68,0],[97],[12,1],[11]]),[65,0],[11],[4,124],...makeString(_,"default",1),[34,0],[65,195,1],[33,5],[5],[32,2],[32,1],[33,5],[11],[32,0],[32,5],[33,1],[26],[26],[32,0],[32,1],[16,builtin('__console_timeLog')],[33,5],[26],...glbl(35,'timeMap',124),[33,6],...glbl(35,'timeMap#type',127),[33,7],...glbl(35,'timeMap#type',127),[33,4],[2,124],...t([19],()=>[[32,4],[65,19],[70],[4,64],[32,6],[32,7],[32,0],[32,1],[16,builtin('__Set_prototype_delete')],[33,5],[12,1],[11]]),...t([20],()=>[[32,4],[65,20],[70],[4,64],[32,6],[32,7],[32,0],[32,1],[16,builtin('__Map_prototype_delete')],[33,5],[12,1],[11]]),...t([34],()=>[[32,4],[65,34],[70],[4,64],[32,6],[32,7],[32,0],[32,1],[16,builtin('__WeakSet_prototype_delete')],[33,5],[12,1],[11]]),...t([35],()=>[[32,4],[65,35],[70],[4,64],[32,6],[32,7],[32,0],[32,1],[16,builtin('__WeakMap_prototype_delete')],[33,5],[12,1],[11]]),...internalThrow(_,'TypeError',`'delete' proto func tried to be called on a type without an impl`),[68,0],[11],[26],[68,0],[65,128,1],[15]],
@@ -1138,6 +1143,7 @@ this.__Date_now = {
1138
1143
  wasm:(_,{builtin})=>[[16,3],[16,builtin('__performance_now')],[160],[16,builtin('__Math_trunc')],[65,1],[15]],
1139
1144
  params:[],typedParams:1,returns:[124,127],typedReturns:1,
1140
1145
  locals:[],localNames:[],
1146
+ usesImports:1,
1141
1147
  }
1142
1148
  this.__Date_UTC = {
1143
1149
  wasm:(_,{builtin})=>[[32,0],[32,1],[16,builtin('__ecma262_ToNumber')],[33,15],[33,14],[68,0],[33,16],[32,3],[184],[68,128],[98],[4,64],[32,2],[32,3],[16,builtin('__ecma262_ToNumber')],[33,15],[33,16],[11],[68,1],[33,17],[32,5],[184],[68,128],[98],[4,64],[32,4],[32,5],[16,builtin('__ecma262_ToNumber')],[33,15],[33,17],[11],[68,0],[33,18],[32,7],[184],[68,128],[98],[4,64],[32,6],[32,7],[16,builtin('__ecma262_ToNumber')],[33,15],[33,18],[11],[68,0],[33,19],[32,9],[184],[68,128],[98],[4,64],[32,8],[32,9],[16,builtin('__ecma262_ToNumber')],[33,15],[33,19],[11],[68,0],[33,20],[32,11],[184],[68,128],[98],[4,64],[32,10],[32,11],[16,builtin('__ecma262_ToNumber')],[33,15],[33,20],[11],[68,0],[33,21],[32,13],[184],[68,128],[98],[4,64],[32,12],[32,13],[16,builtin('__ecma262_ToNumber')],[33,15],[33,18],[11],[32,14],[65,1],[16,builtin('__ecma262_MakeFullYear')],[33,15],[34,22],[65,1],[32,16],[65,1],[32,17],[65,1],[16,builtin('__ecma262_MakeDay')],[34,15],[32,18],[65,1],[32,19],[65,1],[32,20],[65,1],[32,21],[65,1],[16,builtin('__ecma262_MakeTime')],[34,15],[16,builtin('__ecma262_MakeDate')],[34,15],[16,builtin('__ecma262_TimeClip')],[34,15],[15]],
@@ -1780,7 +1786,7 @@ wasm:(_,{t,builtin,internalThrow})=>[[32,4],[68,0],[98],[32,5],[65,128,1],[114],
1780
1786
  params:[124,127,124,127,124,127],typedParams:1,returns:[124,127],typedReturns:1,
1781
1787
  locals:[127,124,124,124,124,127,127],localNames:["value","value#type","replacer","replacer#type","space","space#type","#last_type","spaceStr","i","len","#proto_target","#proto_target#type","#typeswitch_tmp1"],
1782
1788
  usedTypes:[195],
1783
- usesTag:1,
1789
+ usesTag:1,usesImports:1,
1784
1790
  }
1785
1791
  this.__Math_exp = {
1786
1792
  wasm:(_,{builtin})=>[[32,0],[16,builtin('__Number_isFinite')],[68,0],[97],[4,64],[32,0],[68,"Infinity"],[154],[97],[4,64],[68,0],[65,1],[15],[11],[32,0],[65,1],[15],[11],[32,0],[68,0],[99],[4,64],[68,1],[32,0],[154],[65,1],[16,builtin('__Math_exp')],[33,2],[163],[65,1],[15],[11],[32,0],[68,0.6931471805599453],[163],[16,builtin('__Math_floor')],[33,3],[32,0],[32,3],[68,0.6931471805599453],[162],[161],[34,4],[33,5],[68,1],[32,4],[160],[33,6],[68,2],[33,7],[3,64],[32,5],[16,builtin('__Math_abs')],[68,1e-15],[100],[4,64],[32,5],[32,4],[32,7],[163],[162],[33,5],[32,6],[32,5],[160],[33,6],[32,7],[68,1],[160],[33,7],[12,1],[11],[11],[3,64],[32,3],[32,3],[68,1],[161],[33,3],[68,0],[100],[4,64],[32,6],[68,2],[162],[33,6],[12,1],[11],[11],[32,6],[65,1],[15]],
@@ -389,6 +389,8 @@ const generateIdent = (scope, decl) => {
389
389
  if (builtinVars[name].floatOnly && valtype[0] === 'i') throw new Error(`Cannot use ${unhackName(name)} with integer valtype`);
390
390
 
391
391
  let wasm = builtinVars[name];
392
+ if (wasm.usesImports) scope.usesImports = true;
393
+
392
394
  if (typeof wasm === 'function') wasm = asmFuncToAsm(scope, wasm);
393
395
  return wasm.slice();
394
396
  }
@@ -1207,7 +1209,7 @@ const asmFuncToAsm = (scope, func) => {
1207
1209
  });
1208
1210
  };
1209
1211
 
1210
- const asmFunc = (name, { wasm, params = [], typedParams = false, locals: localTypes = [], globals: globalTypes = [], globalInits = [], returns = [], returnType, localNames = [], globalNames = [], data: _data = [], table = false, constr = false, hasRestArgument = false, usesTag = false, usedTypes = [] } = {}) => {
1212
+ const asmFunc = (name, { wasm, params = [], typedParams = false, locals: localTypes = [], globals: globalTypes = [], globalInits = [], returns = [], returnType, localNames = [], globalNames = [], data: _data = [], table = false, constr = false, hasRestArgument = false, usesTag = false, usesImports = false, usedTypes = [] } = {}) => {
1211
1213
  if (wasm == null) { // called with no builtin
1212
1214
  log.warning('codegen', `${name} has no built-in!`);
1213
1215
  wasm = [];
@@ -1282,6 +1284,7 @@ const asmFunc = (name, { wasm, params = [], typedParams = false, locals: localTy
1282
1284
 
1283
1285
  if (hasRestArgument) func.hasRestArgument = true;
1284
1286
  if (usesTag) ensureTag();
1287
+ if (usesImports) func.usesImports = true;
1285
1288
 
1286
1289
  for (const x of usedTypes) typeUsed(func, x);
1287
1290
 
@@ -2271,155 +2274,158 @@ const generateCall = (scope, decl, _global, _name, unusedValue = false) => {
2271
2274
  }
2272
2275
 
2273
2276
  let idx;
2274
- if (Object.hasOwn(funcIndex, name)) idx = funcIndex[name];
2275
- else if (Object.hasOwn(importedFuncs, name)) idx = importedFuncs[name];
2276
- else if (Object.hasOwn(builtinFuncs, name)) {
2277
- if (builtinFuncs[name].floatOnly && valtype !== 'f64') throw new Error(`Cannot use built-in ${unhackName(name)} with integer valtype`);
2278
- if (decl._new && !builtinFuncs[name].constr) return internalThrow(scope, 'TypeError', `${unhackName(name)} is not a constructor`, true);
2279
-
2280
- includeBuiltin(scope, name);
2281
- idx = funcIndex[name];
2282
- } else if (Object.hasOwn(internalConstrs, name)) {
2283
- if (decl._new && internalConstrs[name].notConstr) return internalThrow(scope, 'TypeError', `${unhackName(name)} is not a constructor`, true);
2284
- return internalConstrs[name].generate(scope, decl, _global, _name);
2285
- } else if (!decl._new && name && name.startsWith('__Porffor_wasm_')) {
2286
- const wasmOps = {
2287
- // pointer, align, offset
2288
- i32_load: { imms: 2, args: [ true ], returns: 1 },
2289
- // pointer, value, align, offset
2290
- i32_store: { imms: 2, args: [ true, true ], returns: 0 },
2291
- // pointer, align, offset
2292
- i32_load8_u: { imms: 2, args: [ true ], returns: 1 },
2293
- // pointer, value, align, offset
2294
- i32_store8: { imms: 2, args: [ true, true ], returns: 0 },
2295
- // pointer, align, offset
2296
- i32_load16_u: { imms: 2, args: [ true ], returns: 1 },
2297
- // pointer, value, align, offset
2298
- i32_store16: { imms: 2, args: [ true, true ], returns: 0 },
2299
-
2300
- // pointer, align, offset
2301
- f64_load: { imms: 2, args: [ true ], returns: 0 }, // 0 due to not i32
2302
- // pointer, value, align, offset
2303
- f64_store: { imms: 2, args: [ true, false ], returns: 0 },
2304
-
2305
- // value
2306
- i32_const: { imms: 1, args: [], returns: 0 },
2307
-
2308
- // dst, src, size, _, _
2309
- memory_copy: { imms: 2, args: [ true, true, true ], returns: 0 }
2310
- };
2277
+ if (Object.hasOwn(funcIndex, name)) {
2278
+ idx = funcIndex[name];
2279
+ } else if (Object.hasOwn(importedFuncs, name)) {
2280
+ idx = importedFuncs[name];
2281
+ scope.usesImports = true;
2282
+ } else if (Object.hasOwn(builtinFuncs, name)) {
2283
+ if (builtinFuncs[name].floatOnly && valtype !== 'f64') throw new Error(`Cannot use built-in ${unhackName(name)} with integer valtype`);
2284
+ if (decl._new && !builtinFuncs[name].constr) return internalThrow(scope, 'TypeError', `${unhackName(name)} is not a constructor`, true);
2285
+
2286
+ includeBuiltin(scope, name);
2287
+ idx = funcIndex[name];
2288
+ } else if (Object.hasOwn(internalConstrs, name)) {
2289
+ if (decl._new && internalConstrs[name].notConstr) return internalThrow(scope, 'TypeError', `${unhackName(name)} is not a constructor`, true);
2290
+ return internalConstrs[name].generate(scope, decl, _global, _name);
2291
+ } else if (!decl._new && name && name.startsWith('__Porffor_wasm_')) {
2292
+ const wasmOps = {
2293
+ // pointer, align, offset
2294
+ i32_load: { imms: 2, args: [ true ], returns: 1 },
2295
+ // pointer, value, align, offset
2296
+ i32_store: { imms: 2, args: [ true, true ], returns: 0 },
2297
+ // pointer, align, offset
2298
+ i32_load8_u: { imms: 2, args: [ true ], returns: 1 },
2299
+ // pointer, value, align, offset
2300
+ i32_store8: { imms: 2, args: [ true, true ], returns: 0 },
2301
+ // pointer, align, offset
2302
+ i32_load16_u: { imms: 2, args: [ true ], returns: 1 },
2303
+ // pointer, value, align, offset
2304
+ i32_store16: { imms: 2, args: [ true, true ], returns: 0 },
2305
+
2306
+ // pointer, align, offset
2307
+ f64_load: { imms: 2, args: [ true ], returns: 0 }, // 0 due to not i32
2308
+ // pointer, value, align, offset
2309
+ f64_store: { imms: 2, args: [ true, false ], returns: 0 },
2310
+
2311
+ // value
2312
+ i32_const: { imms: 1, args: [], returns: 0 },
2313
+
2314
+ // dst, src, size, _, _
2315
+ memory_copy: { imms: 2, args: [ true, true, true ], returns: 0 }
2316
+ };
2311
2317
 
2312
- const opName = name.slice('__Porffor_wasm_'.length);
2318
+ const opName = name.slice('__Porffor_wasm_'.length);
2313
2319
 
2314
- if (wasmOps[opName]) {
2315
- const op = wasmOps[opName];
2320
+ if (wasmOps[opName]) {
2321
+ const op = wasmOps[opName];
2316
2322
 
2317
- const argOut = [];
2318
- for (let i = 0; i < op.args.length; i++) {
2319
- if (!op.args[i]) globalThis.noi32F64CallConv = true;
2323
+ const argOut = [];
2324
+ for (let i = 0; i < op.args.length; i++) {
2325
+ if (!op.args[i]) globalThis.noi32F64CallConv = true;
2320
2326
 
2321
- argOut.push(
2322
- ...generate(scope, decl.arguments[i]),
2323
- ...(op.args[i] ? [ Opcodes.i32_to ] : [])
2324
- );
2327
+ argOut.push(
2328
+ ...generate(scope, decl.arguments[i]),
2329
+ ...(op.args[i] ? [ Opcodes.i32_to ] : [])
2330
+ );
2325
2331
 
2326
- globalThis.noi32F64CallConv = false;
2327
- }
2332
+ globalThis.noi32F64CallConv = false;
2333
+ }
2328
2334
 
2329
- // literals only
2330
- const imms = decl.arguments.slice(op.args.length).map(x => x.value);
2335
+ // literals only
2336
+ const imms = decl.arguments.slice(op.args.length).map(x => x.value);
2331
2337
 
2332
- let opcode = Opcodes[opName];
2333
- if (!Array.isArray(opcode)) opcode = [ opcode ];
2338
+ let opcode = Opcodes[opName];
2339
+ if (!Array.isArray(opcode)) opcode = [ opcode ];
2334
2340
 
2335
- return [
2336
- ...argOut,
2337
- [ ...opcode, ...imms ],
2338
- ...(new Array(op.returns).fill(Opcodes.i32_from))
2339
- ];
2340
- }
2341
- } else {
2342
- if (!Prefs.indirectCalls) return internalThrow(scope, 'TypeError', `${unhackName(name)} is not a function`, true);
2341
+ return [
2342
+ ...argOut,
2343
+ [ ...opcode, ...imms ],
2344
+ ...(new Array(op.returns).fill(Opcodes.i32_from))
2345
+ ];
2346
+ }
2347
+ } else {
2348
+ if (!Prefs.indirectCalls) return internalThrow(scope, 'TypeError', `${unhackName(name)} is not a function`, true);
2343
2349
 
2344
- funcs.table = true;
2345
- scope.table = true;
2350
+ funcs.table = true;
2351
+ scope.table = true;
2346
2352
 
2347
- let args = decl.arguments;
2348
- const wrapperArgc = Prefs.indirectWrapperArgc ?? 8;
2349
- if (args.length < wrapperArgc) {
2350
- args = args.concat(new Array(wrapperArgc - args.length).fill(DEFAULT_VALUE()));
2351
- }
2353
+ let args = decl.arguments;
2354
+ const wrapperArgc = Prefs.indirectWrapperArgc ?? 8;
2355
+ if (args.length < wrapperArgc) {
2356
+ args = args.concat(new Array(wrapperArgc - args.length).fill(DEFAULT_VALUE()));
2357
+ }
2352
2358
 
2353
- for (let i = 0; i < args.length; i++) {
2354
- const arg = args[i];
2355
- out = out.concat(generate(scope, arg), valtypeBinary === Valtype.i32 && scope.locals[arg.name]?.type !== Valtype.f64 ? [ [ Opcodes.f64_convert_i32_s ] ] : [], getNodeType(scope, arg));
2356
- }
2359
+ for (let i = 0; i < args.length; i++) {
2360
+ const arg = args[i];
2361
+ out = out.concat(generate(scope, arg), valtypeBinary === Valtype.i32 && scope.locals[arg.name]?.type !== Valtype.f64 ? [ [ Opcodes.f64_convert_i32_s ] ] : [], getNodeType(scope, arg));
2362
+ }
2357
2363
 
2358
- let knownThis = undefined, getCallee = undefined;
2359
- const calleeLocal = localTmp(scope, '#indirect_callee');
2364
+ let knownThis = undefined, getCallee = undefined;
2365
+ const calleeLocal = localTmp(scope, '#indirect_callee');
2360
2366
 
2361
- // hack: this should be more thorough, Function.bind, etc
2362
- if (decl.callee.type === 'MemberExpression' && !decl._new) {
2363
- const thisLocal = localTmp(scope, '#indirect_caller');
2364
- const thisLocalType = localTmp(scope, '#indirect_caller#type', Valtype.i32);
2367
+ // hack: this should be more thorough, Function.bind, etc
2368
+ if (decl.callee.type === 'MemberExpression' && !decl._new) {
2369
+ const thisLocal = localTmp(scope, '#indirect_caller');
2370
+ const thisLocalType = localTmp(scope, '#indirect_caller#type', Valtype.i32);
2365
2371
 
2366
- knownThis = [
2367
- [ Opcodes.local_get, thisLocal ],
2368
- [ Opcodes.local_get, thisLocalType ]
2369
- ];
2370
- getCallee = [
2371
- ...generate(scope, decl.callee.object),
2372
- [ Opcodes.local_set, thisLocal ],
2373
- ...getNodeType(scope, decl.callee.object),
2374
- [ Opcodes.local_set, thisLocalType ],
2372
+ knownThis = [
2373
+ [ Opcodes.local_get, thisLocal ],
2374
+ [ Opcodes.local_get, thisLocalType ]
2375
+ ];
2376
+ getCallee = [
2377
+ ...generate(scope, decl.callee.object),
2378
+ [ Opcodes.local_set, thisLocal ],
2379
+ ...getNodeType(scope, decl.callee.object),
2380
+ [ Opcodes.local_set, thisLocalType ],
2375
2381
 
2376
- ...generate(scope, {
2377
- type: 'MemberExpression',
2378
- object: { type: 'Identifier', name: '#indirect_caller' },
2379
- property: decl.callee.property,
2380
- computed: decl.callee.computed,
2381
- optional: decl.callee.optional
2382
- })
2383
- ];
2384
- }
2382
+ ...generate(scope, {
2383
+ type: 'MemberExpression',
2384
+ object: { type: 'Identifier', name: '#indirect_caller' },
2385
+ property: decl.callee.property,
2386
+ computed: decl.callee.computed,
2387
+ optional: decl.callee.optional
2388
+ })
2389
+ ];
2390
+ }
2385
2391
 
2386
- let callee = decl.callee, callAsNew = decl._new;
2387
- if (callee.type === 'Super') {
2388
- // call super constructor with direct super() call
2389
- callee = getObjProp(callee, 'constructor');
2390
- callAsNew = true;
2391
- knownThis = [
2392
- ...generate(scope, { type: 'ThisExpression' }),
2393
- ...getNodeType(scope, { type: 'ThisExpression' })
2394
- ];
2395
- }
2392
+ let callee = decl.callee, callAsNew = decl._new;
2393
+ if (callee.type === 'Super') {
2394
+ // call super constructor with direct super() call
2395
+ callee = getObjProp(callee, 'constructor');
2396
+ callAsNew = true;
2397
+ knownThis = [
2398
+ ...generate(scope, { type: 'ThisExpression' }),
2399
+ ...getNodeType(scope, { type: 'ThisExpression' })
2400
+ ];
2401
+ }
2396
2402
 
2397
- const newTargetWasm = decl._newTargetWasm ?? createNewTarget(scope, decl, [
2398
- [ Opcodes.local_get, calleeLocal ]
2399
- ], callAsNew);
2400
- const thisWasm = decl._thisWasm ?? knownThis ?? createThisArg(scope, decl);
2403
+ const newTargetWasm = decl._newTargetWasm ?? createNewTarget(scope, decl, [
2404
+ [ Opcodes.local_get, calleeLocal ]
2405
+ ], callAsNew);
2406
+ const thisWasm = decl._thisWasm ?? knownThis ?? createThisArg(scope, decl);
2401
2407
 
2402
- return [
2403
- ...(getCallee ? getCallee : generate(scope, callee)),
2404
- [ Opcodes.local_set, calleeLocal ],
2408
+ return [
2409
+ ...(getCallee ? getCallee : generate(scope, callee)),
2410
+ [ Opcodes.local_set, calleeLocal ],
2405
2411
 
2406
- ...typeSwitch(scope, getNodeType(scope, callee), {
2407
- [TYPES.function]: () => [
2408
- ...forceDuoValtype(scope, newTargetWasm, Valtype.f64),
2409
- ...forceDuoValtype(scope, thisWasm, Valtype.f64),
2410
- ...out,
2412
+ ...typeSwitch(scope, getNodeType(scope, callee), {
2413
+ [TYPES.function]: () => [
2414
+ ...forceDuoValtype(scope, newTargetWasm, Valtype.f64),
2415
+ ...forceDuoValtype(scope, thisWasm, Valtype.f64),
2416
+ ...out,
2411
2417
 
2412
- [ Opcodes.local_get, calleeLocal ],
2413
- Opcodes.i32_to_u,
2414
- [ Opcodes.call_indirect, args.length + 2, 0 ],
2415
- ...setLastType(scope)
2416
- ],
2418
+ [ Opcodes.local_get, calleeLocal ],
2419
+ Opcodes.i32_to_u,
2420
+ [ Opcodes.call_indirect, args.length + 2, 0 ],
2421
+ ...setLastType(scope)
2422
+ ],
2417
2423
 
2418
- default: internalThrow(scope, 'TypeError', `${unhackName(name)} is not a function`, Valtype.f64)
2419
- }, Valtype.f64),
2420
- ...(valtypeBinary === Valtype.i32 && scope.returns[0] !== Valtype.f64 ? [ [ Opcodes.f64_convert_i32_s ] ] : [])
2421
- ];
2422
- }
2424
+ default: internalThrow(scope, 'TypeError', `${unhackName(name)} is not a function`, Valtype.f64)
2425
+ }, Valtype.f64),
2426
+ ...(valtypeBinary === Valtype.i32 && scope.returns[0] !== Valtype.f64 ? [ [ Opcodes.f64_convert_i32_s ] ] : [])
2427
+ ];
2428
+ }
2423
2429
 
2424
2430
  const func = funcByIndex(idx);
2425
2431
 
@@ -6426,6 +6432,8 @@ const internalConstrs = {
6426
6432
 
6427
6433
  __Porffor_printStatic: {
6428
6434
  generate: (scope, decl) => {
6435
+ scope.usesImports = true;
6436
+
6429
6437
  const str = decl.arguments[0].value;
6430
6438
  return printStaticStr(str);
6431
6439
  },
@@ -251,7 +251,7 @@ params:${JSON.stringify(x.params)},typedParams:1,returns:${JSON.stringify(x.retu
251
251
  locals:${JSON.stringify(locals.slice(x.params.length).map(x => x[1].type))},localNames:${JSON.stringify(locals.map(x => x[0]))},
252
252
  ${usedTypes.length > 0 ? `usedTypes:${JSON.stringify(usedTypes)},` : ''}
253
253
  ${x.globalInits ? `globalInits:{${Object.keys(x.globalInits).map(y => `${y}:${rewriteWasm(x.globalInits[y])}`).join(',')}},` : ''}${x.data && Object.keys(x.data).length > 0 ? `data:${JSON.stringify(x.data)},` : ''}
254
- ${x.table ? `table:1,` : ''}${x.constr ? `constr:1,` : ''}${x.hasRestArgument ? `hasRestArgument:1,` : ''}${x.usesTag ? `usesTag:1,` : ''}
254
+ ${x.table ? `table:1,` : ''}${x.constr ? `constr:1,` : ''}${x.hasRestArgument ? `hasRestArgument:1,` : ''}${x.usesTag ? `usesTag:1,` : ''}${x.usesImports ? `usesImports:1,` : ''}
255
255
  }`.replaceAll('\n\n', '\n').replaceAll('\n\n', '\n').replaceAll('\n\n', '\n');
256
256
  }).join('\n')}
257
257
  }`;
@@ -226,8 +226,7 @@ export const Opcodes = {
226
226
  export const FuncType = 0x60;
227
227
  export const Empty = 0x00;
228
228
 
229
- export const Magic = [0x00, 0x61, 0x73, 0x6d];
230
- export const ModuleVersion = [0x01, 0x00, 0x00, 0x00];
229
+ export const Magic = [ 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00 ];
231
230
 
232
231
  export const PageSize = 65536; // 64KiB (1024 * 8)
233
232
 
package/compiler/wrap.js CHANGED
@@ -8,8 +8,6 @@ import './prefs.js';
8
8
 
9
9
  const fs = (typeof process?.version !== 'undefined' ? (await import('node:fs')) : undefined);
10
10
 
11
- const bold = x => `\u001b[1m${x}\u001b[0m`;
12
-
13
11
  const checkOOB = (memory, ptr) => ptr >= memory.buffer.byteLength;
14
12
 
15
13
  let dv;
@@ -352,7 +350,7 @@ export default (source, module = undefined, customImports = {}, print = str => p
352
350
  // fs.writeFileSync('out.wasm', Buffer.from(wasm));
353
351
 
354
352
  times.push(performance.now() - t1);
355
- if (Prefs.profileCompiler && !globalThis.onProgress) console.log(bold(`compiled in ${times[0].toFixed(2)}ms`));
353
+ if (Prefs.profileCompiler && !globalThis.onProgress) console.log(`\u001b[1mcompiled in ${times[0].toFixed(2)}ms\u001b[0m`);
356
354
 
357
355
  const printDecomp = (middleIndex, func, funcs, globals, exceptions) => {
358
356
  console.log(`\x1B[35m\x1B[1mporffor backtrace\u001b[0m`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "porffor",
3
3
  "description": "a basic experimental wip aot optimizing js -> wasm engine/compiler/runtime in js",
4
- "version": "0.48.3",
4
+ "version": "0.48.4",
5
5
  "author": "CanadaHonk",
6
6
  "license": "MIT",
7
7
  "scripts": {},
package/runner/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import fs from 'node:fs';
3
- globalThis.version = '0.48.3';
3
+ globalThis.version = '0.48.4';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {
@@ -9,18 +9,6 @@ if (typeof process === 'undefined' && typeof Deno !== 'undefined') {
9
9
 
10
10
  const start = performance.now();
11
11
 
12
- if (process.argv.includes('--compile-hints')) {
13
- const v8 = await import('node:v8');
14
- v8.setFlagsFromString(`--experimental-wasm-compilation-hints`);
15
-
16
- // see also these flags:
17
- // --experimental-wasm-branch-hinting
18
- // --experimental-wasm-extended-const
19
- // --experimental-wasm-inlining (?)
20
- // --experimental-wasm-js-inlining (?)
21
- // --experimental-wasm-return-call (on by default)
22
- }
23
-
24
12
  if (process.argv.includes('--help')) {
25
13
  // description + version
26
14
  console.log(`\x1B[1m\x1B[35mPorffor\x1B[0m is a JavaScript engine/runtime/compiler. \x1B[90m(${globalThis.version})\x1B[0m`);