porffor 0.14.0-b481bfc5f → 0.14.0-c6edfd328

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.
@@ -116,6 +116,20 @@ export default (funcs, globals, tags, pages, data, flags) => {
116
116
  ] ])
117
117
  );
118
118
 
119
+ if (pages.has('func argc lut')) {
120
+ // generate func argc lut data
121
+ const bytes = [];
122
+ for (let i = 0; i < funcs.length; i++) {
123
+ const argc = Math.floor(funcs[i].params.length / 2);
124
+ bytes.push(argc % 256, (argc / 256 | 0) % 256);
125
+ }
126
+
127
+ data.push({
128
+ offset: pages.get('func argc lut').ind * pageSize,
129
+ bytes
130
+ });
131
+ }
132
+
119
133
  // const t0 = performance.now();
120
134
 
121
135
  // specially optimized assembly for globals as this version is much (>5x) faster than traditional createSection()
@@ -144,4 +144,12 @@ export const __Array_prototype_toReversed = (_this: any[]) => {
144
144
 
145
145
  export const __Array_prototype_valueOf = (_this: any[]) => {
146
146
  return _this;
147
+ };
148
+
149
+ export const __Array_prototype_forEach = (_this: any[], callbackFn: Function) => {
150
+ const len: i32 = _this.length;
151
+ let i: i32 = 0;
152
+ while (i < len) {
153
+ callbackFn(_this[i], i++, _this);
154
+ }
147
155
  };
@@ -1063,7 +1063,7 @@ const asmFuncToAsm = (func, { name = '#unknown_asm_func', params = [], locals =
1063
1063
  });
1064
1064
  };
1065
1065
 
1066
- const asmFunc = (name, { wasm, params, locals: localTypes, globals: globalTypes = [], globalInits, returns, returnType, localNames = [], globalNames = [], data: _data = [], callsSelf = false }) => {
1066
+ const asmFunc = (name, { wasm, params, locals: localTypes, globals: globalTypes = [], globalInits, returns, returnType, localNames = [], globalNames = [], data: _data = [], table = false, callsSelf = false }) => {
1067
1067
  const existing = funcs.find(x => x.name === name);
1068
1068
  if (existing) return existing;
1069
1069
 
@@ -1117,9 +1117,18 @@ const asmFunc = (name, { wasm, params, locals: localTypes, globals: globalTypes
1117
1117
  }
1118
1118
  }
1119
1119
 
1120
+ if (table) for (const inst of wasm) {
1121
+ if (inst[0] === Opcodes.i32_load16_u && inst.at(-1) === 'read_argc') {
1122
+ inst.splice(2, 99);
1123
+ inst.push(...unsignedLEB128(allocPage({}, 'func argc lut') * pageSize));
1124
+ }
1125
+ }
1126
+
1120
1127
  funcs.push(func);
1121
1128
  funcIndex[name] = func.index;
1122
1129
 
1130
+ if (table) funcs.table = true;
1131
+
1123
1132
  return func;
1124
1133
  };
1125
1134
 
@@ -1859,36 +1868,128 @@ const generateCall = (scope, decl, _global, _name, unusedValue = false) => {
1859
1868
  const [ local, global ] = lookupName(scope, name);
1860
1869
  if (!Prefs.indirectCalls || local == null) return internalThrow(scope, 'TypeError', `${unhackName(name)} is not a function`, true);
1861
1870
 
1862
- // todo: only works when:
1863
- // 1. arg count matches arg count of function
1864
- // 2. function uses typedParams and typedReturns
1871
+ // todo: only works when function uses typedParams and typedReturns
1872
+
1873
+ const indirectMode = Prefs.indirectCallMode ?? 'vararg';
1874
+ // options: vararg, strict
1875
+ // - strict: simpler, smaller size usage, no func argc lut needed.
1876
+ // ONLY works when arg count of call == arg count of function being called
1877
+ // - vararg: large size usage, cursed.
1878
+ // works when arg count of call != arg count of function being called*
1879
+ // * most of the time, some edgecases
1865
1880
 
1866
1881
  funcs.table = true;
1882
+ scope.table = true;
1867
1883
 
1868
1884
  let args = decl.arguments;
1869
- let argWasm = [];
1885
+ let out = [];
1886
+
1887
+ let locals = [];
1888
+
1889
+ if (indirectMode === 'vararg') {
1890
+ const minArgc = Prefs.indirectCallMinArgc ?? 3;
1891
+
1892
+ if (args.length < minArgc) {
1893
+ args = args.concat(new Array(minArgc - args.length).fill(DEFAULT_VALUE));
1894
+ }
1895
+ }
1870
1896
 
1871
1897
  for (let i = 0; i < args.length; i++) {
1872
1898
  const arg = args[i];
1873
- argWasm = argWasm.concat(generate(scope, arg));
1899
+ out = out.concat(generate(scope, arg));
1874
1900
 
1875
1901
  if (valtypeBinary !== Valtype.i32 && (
1876
1902
  (builtinFuncs[name] && builtinFuncs[name].params[i * (typedParams ? 2 : 1)] === Valtype.i32) ||
1877
1903
  (importedFuncs[name] && name.startsWith('profile'))
1878
1904
  )) {
1879
- argWasm.push(Opcodes.i32_to);
1905
+ out.push(Opcodes.i32_to);
1880
1906
  }
1881
1907
 
1882
- argWasm = argWasm.concat(getNodeType(scope, arg));
1908
+ out = out.concat(getNodeType(scope, arg));
1909
+
1910
+ if (indirectMode === 'vararg') {
1911
+ const typeLocal = localTmp(scope, `#indirect_arg${i}_type`, Valtype.i32);
1912
+ const valLocal = localTmp(scope, `#indirect_arg${i}_val`);
1913
+
1914
+ locals.push([valLocal, typeLocal]);
1915
+
1916
+ out.push(
1917
+ [ Opcodes.local_set, typeLocal ],
1918
+ [ Opcodes.local_set, valLocal ]
1919
+ );
1920
+ }
1883
1921
  }
1884
1922
 
1923
+ if (indirectMode === 'strict') {
1924
+ return typeSwitch(scope, getNodeType(scope, decl.callee), {
1925
+ [TYPES.function]: [
1926
+ ...argWasm,
1927
+ [ global ? Opcodes.global_get : Opcodes.local_get, local.idx ],
1928
+ Opcodes.i32_to_u,
1929
+ [ Opcodes.call_indirect, args.length, 0 ],
1930
+ ...setLastType(scope)
1931
+ ],
1932
+ default: internalThrow(scope, 'TypeError', `${unhackName(name)} is not a function`, true)
1933
+ });
1934
+ }
1935
+
1936
+ // hi, I will now explain how vararg mode works:
1937
+ // wasm's indirect_call instruction requires you know the func type at compile-time
1938
+ // since we have varargs (variable argument count), we do not know it.
1939
+ // we could just store args in memory and not use wasm func args,
1940
+ // but that is slow (probably) and breaks js exports.
1941
+ // instead, we generate every* possibility of argc and use different indirect_call
1942
+ // ops for each one, with type depending on argc for that branch.
1943
+ // then we load the argc for the wanted function from a memory lut,
1944
+ // and call the branch with the matching argc we require.
1945
+ // sorry, yes it is very cursed (and size inefficient), but indirect calls
1946
+ // are kind of rare anyway (mostly callbacks) so I am not concerned atm.
1947
+ // *for argc 0-3, in future (todo:) the max number should be
1948
+ // dynamically changed to the max argc of any func in the js file.
1949
+
1950
+ const funcLocal = localTmp(scope, `#indirect_func`, Valtype.i32);
1951
+
1952
+ const gen = argc => {
1953
+ const out = [];
1954
+ for (let i = 0; i < argc; i++) {
1955
+ out.push(
1956
+ [ Opcodes.local_get, locals[i][0] ],
1957
+ [ Opcodes.local_get, locals[i][1] ]
1958
+ );
1959
+ }
1960
+
1961
+ out.push(
1962
+ [ Opcodes.local_get, funcLocal ],
1963
+ [ Opcodes.call_indirect, argc, 0 ],
1964
+ ...setLastType(scope)
1965
+ )
1966
+
1967
+ return out;
1968
+ };
1969
+
1970
+ const tableBc = {};
1971
+ for (let i = 0; i <= args.length; i++) {
1972
+ tableBc[i] = gen(i);
1973
+ }
1974
+
1975
+ // todo/perf: check if we should use br_table here or just generate our own big if..elses
1976
+
1885
1977
  return typeSwitch(scope, getNodeType(scope, decl.callee), {
1886
1978
  [TYPES.function]: [
1887
- ...argWasm,
1979
+ ...out,
1980
+
1888
1981
  [ global ? Opcodes.global_get : Opcodes.local_get, local.idx ],
1889
1982
  Opcodes.i32_to_u,
1890
- [ Opcodes.call_indirect, args.length, 0 ],
1891
- ...setLastType(scope)
1983
+ [ Opcodes.local_set, funcLocal ],
1984
+
1985
+ ...brTable([
1986
+ // get argc of func we are calling
1987
+ [ Opcodes.local_get, funcLocal ],
1988
+ ...number(ValtypeSize.i16, Valtype.i32),
1989
+ [ Opcodes.i32_mul ],
1990
+
1991
+ [ Opcodes.i32_load16_u, 0, ...unsignedLEB128(allocPage(scope, 'func argc lut') * pageSize), 'read_argc' ]
1992
+ ], tableBc, valtypeBinary)
1892
1993
  ],
1893
1994
  default: internalThrow(scope, 'TypeError', `${unhackName(name)} is not a function`, true)
1894
1995
  });
@@ -2046,16 +2147,17 @@ const brTable = (input, bc, returns) => {
2046
2147
  }
2047
2148
 
2048
2149
  for (let i = 0; i < count; i++) {
2049
- if (i === 0) out.push([ Opcodes.block, returns, 'br table start' ]);
2150
+ // if (i === 0) out.push([ Opcodes.block, returns, 'br table start' ]);
2151
+ if (i === 0) out.push([ Opcodes.block, returns ]);
2050
2152
  else out.push([ Opcodes.block, Blocktype.void ]);
2051
2153
  }
2052
2154
 
2053
- const nums = keys.filter(x => +x);
2155
+ const nums = keys.filter(x => +x >= 0);
2054
2156
  const offset = Math.min(...nums);
2055
2157
  const max = Math.max(...nums);
2056
2158
 
2057
2159
  const table = [];
2058
- let br = 1;
2160
+ let br = 0;
2059
2161
 
2060
2162
  for (let i = offset; i <= max; i++) {
2061
2163
  // if branch for this num, go to that block
@@ -2095,10 +2197,9 @@ const brTable = (input, bc, returns) => {
2095
2197
  br--;
2096
2198
  }
2097
2199
 
2098
- return [
2099
- ...out,
2100
- [ Opcodes.end, 'br table end' ]
2101
- ];
2200
+ out.push([ Opcodes.end ]);
2201
+
2202
+ return out;
2102
2203
  };
2103
2204
 
2104
2205
  const typeSwitch = (scope, type, bc, returns = valtypeBinary) => {
@@ -3605,7 +3706,8 @@ const generateFunc = (scope, decl) => {
3605
3706
 
3606
3707
  if (typedInput && decl.returnType) {
3607
3708
  const { type } = extractTypeAnnotation(decl.returnType);
3608
- if (type != null && !Prefs.indirectCalls) {
3709
+ // if (type != null && !Prefs.indirectCalls) {
3710
+ if (type != null) {
3609
3711
  innerScope.returnType = type;
3610
3712
  innerScope.returns = [ valtypeBinary ];
3611
3713
  }
@@ -10,7 +10,7 @@ export const BuiltinFuncs = function() {
10
10
  typedReturns: true,
11
11
  locals: [127,127,127,127,127,127,127],
12
12
  localNames: ["_this","_this#type","out","outPtr","thisPtr","thisLen","endPtr","chr","__length_setter_tmp"],
13
- data: [{"offset":0,"bytes":[5,0,0,0,60,0,98,0,105,0,103,0,62,0]}]
13
+ data: [{"offset":0,"bytes":[5,0,0,0,60,0,98,0,105,0,103,0,62,0]}],
14
14
  };
15
15
  this.__ByteString_prototype_big = {
16
16
  wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'bytestring: __ByteString_prototype_big/out', 'i8') * pageSize, 127),[34,2],[65,5],[106],[33,3],[32,0],[33,4],[32,0],[40,1,0],[33,5],[32,4],[32,5],[106],[33,6],[3,64],[32,4],[32,6],[72],[4,64],[32,4],[32,4],[65,1],[106],[33,4],[45,0,4],[33,7],[32,3],[32,3],[65,1],[106],[33,3],[32,7],[58,0,4],[12,1],[11],[11],[32,3],[65,60],[58,0,4],[32,3],[65,47],[58,0,5],[32,3],[65,226,0],[58,0,6],[32,3],[65,233,0],[58,0,7],[32,3],[65,231,0],[58,0,8],[32,3],[65,62],[58,0,9],[32,2],[32,5],[65,11],[106],[34,8],[54,1,0],[32,2],[65,18],[15]],
@@ -20,7 +20,7 @@ export const BuiltinFuncs = function() {
20
20
  typedReturns: true,
21
21
  locals: [127,127,127,127,127,127,127],
22
22
  localNames: ["_this","_this#type","out","outPtr","thisPtr","thisLen","endPtr","chr","__length_setter_tmp"],
23
- data: [{"offset":0,"bytes":[5,0,0,0,60,98,105,103,62]}]
23
+ data: [{"offset":0,"bytes":[5,0,0,0,60,98,105,103,62]}],
24
24
  };
25
25
  this.__String_prototype_blink = {
26
26
  wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'string: __String_prototype_blink/out', 'i16') * pageSize, 127),[34,2],[65,14],[106],[33,3],[32,0],[33,4],[32,0],[40,1,0],[33,5],[32,4],[32,5],[65,2],[108],[106],[33,6],[3,64],[32,4],[32,6],[72],[4,64],[32,4],[47,0,4],[33,7],[32,3],[32,7],[59,0,4],[32,4],[65,2],[106],[33,4],[32,3],[65,2],[106],[33,3],[12,1],[11],[11],[32,3],[65,60],[59,0,4],[32,3],[65,47],[59,0,6],[32,3],[65,226,0],[59,0,8],[32,3],[65,236,0],[59,0,10],[32,3],[65,233,0],[59,0,12],[32,3],[65,238,0],[59,0,14],[32,3],[65,235,0],[59,0,16],[32,3],[65,62],[59,0,18],[32,2],[32,5],[65,15],[106],[34,8],[54,1,0],[32,2],[65,2],[15]],
@@ -30,7 +30,7 @@ export const BuiltinFuncs = function() {
30
30
  typedReturns: true,
31
31
  locals: [127,127,127,127,127,127,127],
32
32
  localNames: ["_this","_this#type","out","outPtr","thisPtr","thisLen","endPtr","chr","__length_setter_tmp"],
33
- data: [{"offset":0,"bytes":[7,0,0,0,60,0,98,0,108,0,105,0,110,0,107,0,62,0]}]
33
+ data: [{"offset":0,"bytes":[7,0,0,0,60,0,98,0,108,0,105,0,110,0,107,0,62,0]}],
34
34
  };
35
35
  this.__ByteString_prototype_blink = {
36
36
  wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'bytestring: __ByteString_prototype_blink/out', 'i8') * pageSize, 127),[34,2],[65,7],[106],[33,3],[32,0],[33,4],[32,0],[40,1,0],[33,5],[32,4],[32,5],[106],[33,6],[3,64],[32,4],[32,6],[72],[4,64],[32,4],[32,4],[65,1],[106],[33,4],[45,0,4],[33,7],[32,3],[32,3],[65,1],[106],[33,3],[32,7],[58,0,4],[12,1],[11],[11],[32,3],[65,60],[58,0,4],[32,3],[65,47],[58,0,5],[32,3],[65,226,0],[58,0,6],[32,3],[65,236,0],[58,0,7],[32,3],[65,233,0],[58,0,8],[32,3],[65,238,0],[58,0,9],[32,3],[65,235,0],[58,0,10],[32,3],[65,62],[58,0,11],[32,2],[32,5],[65,15],[106],[34,8],[54,1,0],[32,2],[65,18],[15]],
@@ -40,7 +40,7 @@ export const BuiltinFuncs = function() {
40
40
  typedReturns: true,
41
41
  locals: [127,127,127,127,127,127,127],
42
42
  localNames: ["_this","_this#type","out","outPtr","thisPtr","thisLen","endPtr","chr","__length_setter_tmp"],
43
- data: [{"offset":0,"bytes":[7,0,0,0,60,98,108,105,110,107,62]}]
43
+ data: [{"offset":0,"bytes":[7,0,0,0,60,98,108,105,110,107,62]}],
44
44
  };
45
45
  this.__String_prototype_bold = {
46
46
  wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'string: __String_prototype_bold/out', 'i16') * pageSize, 127),[34,2],[65,6],[106],[33,3],[32,0],[33,4],[32,0],[40,1,0],[33,5],[32,4],[32,5],[65,2],[108],[106],[33,6],[3,64],[32,4],[32,6],[72],[4,64],[32,4],[47,0,4],[33,7],[32,3],[32,7],[59,0,4],[32,4],[65,2],[106],[33,4],[32,3],[65,2],[106],[33,3],[12,1],[11],[11],[32,3],[65,60],[59,0,4],[32,3],[65,47],[59,0,6],[32,3],[65,226,0],[59,0,8],[32,3],[65,62],[59,0,10],[32,2],[32,5],[65,7],[106],[34,8],[54,1,0],[32,2],[65,2],[15]],
@@ -50,7 +50,7 @@ export const BuiltinFuncs = function() {
50
50
  typedReturns: true,
51
51
  locals: [127,127,127,127,127,127,127],
52
52
  localNames: ["_this","_this#type","out","outPtr","thisPtr","thisLen","endPtr","chr","__length_setter_tmp"],
53
- data: [{"offset":0,"bytes":[3,0,0,0,60,0,98,0,62,0]}]
53
+ data: [{"offset":0,"bytes":[3,0,0,0,60,0,98,0,62,0]}],
54
54
  };
55
55
  this.__ByteString_prototype_bold = {
56
56
  wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'bytestring: __ByteString_prototype_bold/out', 'i8') * pageSize, 127),[34,2],[65,3],[106],[33,3],[32,0],[33,4],[32,0],[40,1,0],[33,5],[32,4],[32,5],[106],[33,6],[3,64],[32,4],[32,6],[72],[4,64],[32,4],[32,4],[65,1],[106],[33,4],[45,0,4],[33,7],[32,3],[32,3],[65,1],[106],[33,3],[32,7],[58,0,4],[12,1],[11],[11],[32,3],[65,60],[58,0,4],[32,3],[65,47],[58,0,5],[32,3],[65,226,0],[58,0,6],[32,3],[65,62],[58,0,7],[32,2],[32,5],[65,7],[106],[34,8],[54,1,0],[32,2],[65,18],[15]],
@@ -60,7 +60,7 @@ export const BuiltinFuncs = function() {
60
60
  typedReturns: true,
61
61
  locals: [127,127,127,127,127,127,127],
62
62
  localNames: ["_this","_this#type","out","outPtr","thisPtr","thisLen","endPtr","chr","__length_setter_tmp"],
63
- data: [{"offset":0,"bytes":[3,0,0,0,60,98,62]}]
63
+ data: [{"offset":0,"bytes":[3,0,0,0,60,98,62]}],
64
64
  };
65
65
  this.__String_prototype_fixed = {
66
66
  wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'string: __String_prototype_fixed/out', 'i16') * pageSize, 127),[34,2],[65,8],[106],[33,3],[32,0],[33,4],[32,0],[40,1,0],[33,5],[32,4],[32,5],[65,2],[108],[106],[33,6],[3,64],[32,4],[32,6],[72],[4,64],[32,4],[47,0,4],[33,7],[32,3],[32,7],[59,0,4],[32,4],[65,2],[106],[33,4],[32,3],[65,2],[106],[33,3],[12,1],[11],[11],[32,3],[65,60],[59,0,4],[32,3],[65,47],[59,0,6],[32,3],[65,244,0],[59,0,8],[32,3],[65,244,0],[59,0,10],[32,3],[65,62],[59,0,12],[32,2],[32,5],[65,9],[106],[34,8],[54,1,0],[32,2],[65,2],[15]],
@@ -70,7 +70,7 @@ export const BuiltinFuncs = function() {
70
70
  typedReturns: true,
71
71
  locals: [127,127,127,127,127,127,127],
72
72
  localNames: ["_this","_this#type","out","outPtr","thisPtr","thisLen","endPtr","chr","__length_setter_tmp"],
73
- data: [{"offset":0,"bytes":[4,0,0,0,60,0,116,0,116,0,62,0]}]
73
+ data: [{"offset":0,"bytes":[4,0,0,0,60,0,116,0,116,0,62,0]}],
74
74
  };
75
75
  this.__ByteString_prototype_fixed = {
76
76
  wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'bytestring: __ByteString_prototype_fixed/out', 'i8') * pageSize, 127),[34,2],[65,4],[106],[33,3],[32,0],[33,4],[32,0],[40,1,0],[33,5],[32,4],[32,5],[106],[33,6],[3,64],[32,4],[32,6],[72],[4,64],[32,4],[32,4],[65,1],[106],[33,4],[45,0,4],[33,7],[32,3],[32,3],[65,1],[106],[33,3],[32,7],[58,0,4],[12,1],[11],[11],[32,3],[65,60],[58,0,4],[32,3],[65,47],[58,0,5],[32,3],[65,244,0],[58,0,6],[32,3],[65,244,0],[58,0,7],[32,3],[65,62],[58,0,8],[32,2],[32,5],[65,9],[106],[34,8],[54,1,0],[32,2],[65,18],[15]],
@@ -80,7 +80,7 @@ export const BuiltinFuncs = function() {
80
80
  typedReturns: true,
81
81
  locals: [127,127,127,127,127,127,127],
82
82
  localNames: ["_this","_this#type","out","outPtr","thisPtr","thisLen","endPtr","chr","__length_setter_tmp"],
83
- data: [{"offset":0,"bytes":[4,0,0,0,60,116,116,62]}]
83
+ data: [{"offset":0,"bytes":[4,0,0,0,60,116,116,62]}],
84
84
  };
85
85
  this.__String_prototype_italics = {
86
86
  wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'string: __String_prototype_italics/out', 'i16') * pageSize, 127),[34,2],[65,6],[106],[33,3],[32,0],[33,4],[32,0],[40,1,0],[33,5],[32,4],[32,5],[65,2],[108],[106],[33,6],[3,64],[32,4],[32,6],[72],[4,64],[32,4],[47,0,4],[33,7],[32,3],[32,7],[59,0,4],[32,4],[65,2],[106],[33,4],[32,3],[65,2],[106],[33,3],[12,1],[11],[11],[32,3],[65,60],[59,0,4],[32,3],[65,47],[59,0,6],[32,3],[65,233,0],[59,0,8],[32,3],[65,62],[59,0,10],[32,2],[32,5],[65,7],[106],[34,8],[54,1,0],[32,2],[65,2],[15]],
@@ -90,7 +90,7 @@ export const BuiltinFuncs = function() {
90
90
  typedReturns: true,
91
91
  locals: [127,127,127,127,127,127,127],
92
92
  localNames: ["_this","_this#type","out","outPtr","thisPtr","thisLen","endPtr","chr","__length_setter_tmp"],
93
- data: [{"offset":0,"bytes":[3,0,0,0,60,0,105,0,62,0]}]
93
+ data: [{"offset":0,"bytes":[3,0,0,0,60,0,105,0,62,0]}],
94
94
  };
95
95
  this.__ByteString_prototype_italics = {
96
96
  wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'bytestring: __ByteString_prototype_italics/out', 'i8') * pageSize, 127),[34,2],[65,3],[106],[33,3],[32,0],[33,4],[32,0],[40,1,0],[33,5],[32,4],[32,5],[106],[33,6],[3,64],[32,4],[32,6],[72],[4,64],[32,4],[32,4],[65,1],[106],[33,4],[45,0,4],[33,7],[32,3],[32,3],[65,1],[106],[33,3],[32,7],[58,0,4],[12,1],[11],[11],[32,3],[65,60],[58,0,4],[32,3],[65,47],[58,0,5],[32,3],[65,233,0],[58,0,6],[32,3],[65,62],[58,0,7],[32,2],[32,5],[65,7],[106],[34,8],[54,1,0],[32,2],[65,18],[15]],
@@ -100,7 +100,7 @@ export const BuiltinFuncs = function() {
100
100
  typedReturns: true,
101
101
  locals: [127,127,127,127,127,127,127],
102
102
  localNames: ["_this","_this#type","out","outPtr","thisPtr","thisLen","endPtr","chr","__length_setter_tmp"],
103
- data: [{"offset":0,"bytes":[3,0,0,0,60,105,62]}]
103
+ data: [{"offset":0,"bytes":[3,0,0,0,60,105,62]}],
104
104
  };
105
105
  this.__String_prototype_small = {
106
106
  wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'string: __String_prototype_small/out', 'i16') * pageSize, 127),[34,2],[65,14],[106],[33,3],[32,0],[33,4],[32,0],[40,1,0],[33,5],[32,4],[32,5],[65,2],[108],[106],[33,6],[3,64],[32,4],[32,6],[72],[4,64],[32,4],[47,0,4],[33,7],[32,3],[32,7],[59,0,4],[32,4],[65,2],[106],[33,4],[32,3],[65,2],[106],[33,3],[12,1],[11],[11],[32,3],[65,60],[59,0,4],[32,3],[65,47],[59,0,6],[32,3],[65,243,0],[59,0,8],[32,3],[65,237,0],[59,0,10],[32,3],[65,225,0],[59,0,12],[32,3],[65,236,0],[59,0,14],[32,3],[65,236,0],[59,0,16],[32,3],[65,62],[59,0,18],[32,2],[32,5],[65,15],[106],[34,8],[54,1,0],[32,2],[65,2],[15]],
@@ -110,7 +110,7 @@ export const BuiltinFuncs = function() {
110
110
  typedReturns: true,
111
111
  locals: [127,127,127,127,127,127,127],
112
112
  localNames: ["_this","_this#type","out","outPtr","thisPtr","thisLen","endPtr","chr","__length_setter_tmp"],
113
- data: [{"offset":0,"bytes":[7,0,0,0,60,0,115,0,109,0,97,0,108,0,108,0,62,0]}]
113
+ data: [{"offset":0,"bytes":[7,0,0,0,60,0,115,0,109,0,97,0,108,0,108,0,62,0]}],
114
114
  };
115
115
  this.__ByteString_prototype_small = {
116
116
  wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'bytestring: __ByteString_prototype_small/out', 'i8') * pageSize, 127),[34,2],[65,7],[106],[33,3],[32,0],[33,4],[32,0],[40,1,0],[33,5],[32,4],[32,5],[106],[33,6],[3,64],[32,4],[32,6],[72],[4,64],[32,4],[32,4],[65,1],[106],[33,4],[45,0,4],[33,7],[32,3],[32,3],[65,1],[106],[33,3],[32,7],[58,0,4],[12,1],[11],[11],[32,3],[65,60],[58,0,4],[32,3],[65,47],[58,0,5],[32,3],[65,243,0],[58,0,6],[32,3],[65,237,0],[58,0,7],[32,3],[65,225,0],[58,0,8],[32,3],[65,236,0],[58,0,9],[32,3],[65,236,0],[58,0,10],[32,3],[65,62],[58,0,11],[32,2],[32,5],[65,15],[106],[34,8],[54,1,0],[32,2],[65,18],[15]],
@@ -120,7 +120,7 @@ export const BuiltinFuncs = function() {
120
120
  typedReturns: true,
121
121
  locals: [127,127,127,127,127,127,127],
122
122
  localNames: ["_this","_this#type","out","outPtr","thisPtr","thisLen","endPtr","chr","__length_setter_tmp"],
123
- data: [{"offset":0,"bytes":[7,0,0,0,60,115,109,97,108,108,62]}]
123
+ data: [{"offset":0,"bytes":[7,0,0,0,60,115,109,97,108,108,62]}],
124
124
  };
125
125
  this.__String_prototype_strike = {
126
126
  wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'string: __String_prototype_strike/out', 'i16') * pageSize, 127),[34,2],[65,16],[106],[33,3],[32,0],[33,4],[32,0],[40,1,0],[33,5],[32,4],[32,5],[65,2],[108],[106],[33,6],[3,64],[32,4],[32,6],[72],[4,64],[32,4],[47,0,4],[33,7],[32,3],[32,7],[59,0,4],[32,4],[65,2],[106],[33,4],[32,3],[65,2],[106],[33,3],[12,1],[11],[11],[32,3],[65,60],[59,0,4],[32,3],[65,47],[59,0,6],[32,3],[65,243,0],[59,0,8],[32,3],[65,244,0],[59,0,10],[32,3],[65,242,0],[59,0,12],[32,3],[65,233,0],[59,0,14],[32,3],[65,235,0],[59,0,16],[32,3],[65,229,0],[59,0,18],[32,3],[65,62],[59,0,20],[32,2],[32,5],[65,17],[106],[34,8],[54,1,0],[32,2],[65,2],[15]],
@@ -130,7 +130,7 @@ export const BuiltinFuncs = function() {
130
130
  typedReturns: true,
131
131
  locals: [127,127,127,127,127,127,127],
132
132
  localNames: ["_this","_this#type","out","outPtr","thisPtr","thisLen","endPtr","chr","__length_setter_tmp"],
133
- data: [{"offset":0,"bytes":[8,0,0,0,60,0,115,0,116,0,114,0,105,0,107,0,101,0,62,0]}]
133
+ data: [{"offset":0,"bytes":[8,0,0,0,60,0,115,0,116,0,114,0,105,0,107,0,101,0,62,0]}],
134
134
  };
135
135
  this.__ByteString_prototype_strike = {
136
136
  wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'bytestring: __ByteString_prototype_strike/out', 'i8') * pageSize, 127),[34,2],[65,8],[106],[33,3],[32,0],[33,4],[32,0],[40,1,0],[33,5],[32,4],[32,5],[106],[33,6],[3,64],[32,4],[32,6],[72],[4,64],[32,4],[32,4],[65,1],[106],[33,4],[45,0,4],[33,7],[32,3],[32,3],[65,1],[106],[33,3],[32,7],[58,0,4],[12,1],[11],[11],[32,3],[65,60],[58,0,4],[32,3],[65,47],[58,0,5],[32,3],[65,243,0],[58,0,6],[32,3],[65,244,0],[58,0,7],[32,3],[65,242,0],[58,0,8],[32,3],[65,233,0],[58,0,9],[32,3],[65,235,0],[58,0,10],[32,3],[65,229,0],[58,0,11],[32,3],[65,62],[58,0,12],[32,2],[32,5],[65,17],[106],[34,8],[54,1,0],[32,2],[65,18],[15]],
@@ -140,7 +140,7 @@ export const BuiltinFuncs = function() {
140
140
  typedReturns: true,
141
141
  locals: [127,127,127,127,127,127,127],
142
142
  localNames: ["_this","_this#type","out","outPtr","thisPtr","thisLen","endPtr","chr","__length_setter_tmp"],
143
- data: [{"offset":0,"bytes":[8,0,0,0,60,115,116,114,105,107,101,62]}]
143
+ data: [{"offset":0,"bytes":[8,0,0,0,60,115,116,114,105,107,101,62]}],
144
144
  };
145
145
  this.__String_prototype_sub = {
146
146
  wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'string: __String_prototype_sub/out', 'i16') * pageSize, 127),[34,2],[65,10],[106],[33,3],[32,0],[33,4],[32,0],[40,1,0],[33,5],[32,4],[32,5],[65,2],[108],[106],[33,6],[3,64],[32,4],[32,6],[72],[4,64],[32,4],[47,0,4],[33,7],[32,3],[32,7],[59,0,4],[32,4],[65,2],[106],[33,4],[32,3],[65,2],[106],[33,3],[12,1],[11],[11],[32,3],[65,60],[59,0,4],[32,3],[65,47],[59,0,6],[32,3],[65,243,0],[59,0,8],[32,3],[65,245,0],[59,0,10],[32,3],[65,226,0],[59,0,12],[32,3],[65,62],[59,0,14],[32,2],[32,5],[65,11],[106],[34,8],[54,1,0],[32,2],[65,2],[15]],
@@ -150,7 +150,7 @@ export const BuiltinFuncs = function() {
150
150
  typedReturns: true,
151
151
  locals: [127,127,127,127,127,127,127],
152
152
  localNames: ["_this","_this#type","out","outPtr","thisPtr","thisLen","endPtr","chr","__length_setter_tmp"],
153
- data: [{"offset":0,"bytes":[5,0,0,0,60,0,115,0,117,0,98,0,62,0]}]
153
+ data: [{"offset":0,"bytes":[5,0,0,0,60,0,115,0,117,0,98,0,62,0]}],
154
154
  };
155
155
  this.__ByteString_prototype_sub = {
156
156
  wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'bytestring: __ByteString_prototype_sub/out', 'i8') * pageSize, 127),[34,2],[65,5],[106],[33,3],[32,0],[33,4],[32,0],[40,1,0],[33,5],[32,4],[32,5],[106],[33,6],[3,64],[32,4],[32,6],[72],[4,64],[32,4],[32,4],[65,1],[106],[33,4],[45,0,4],[33,7],[32,3],[32,3],[65,1],[106],[33,3],[32,7],[58,0,4],[12,1],[11],[11],[32,3],[65,60],[58,0,4],[32,3],[65,47],[58,0,5],[32,3],[65,243,0],[58,0,6],[32,3],[65,245,0],[58,0,7],[32,3],[65,226,0],[58,0,8],[32,3],[65,62],[58,0,9],[32,2],[32,5],[65,11],[106],[34,8],[54,1,0],[32,2],[65,18],[15]],
@@ -160,7 +160,7 @@ export const BuiltinFuncs = function() {
160
160
  typedReturns: true,
161
161
  locals: [127,127,127,127,127,127,127],
162
162
  localNames: ["_this","_this#type","out","outPtr","thisPtr","thisLen","endPtr","chr","__length_setter_tmp"],
163
- data: [{"offset":0,"bytes":[5,0,0,0,60,115,117,98,62]}]
163
+ data: [{"offset":0,"bytes":[5,0,0,0,60,115,117,98,62]}],
164
164
  };
165
165
  this.__String_prototype_sup = {
166
166
  wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'string: __String_prototype_sup/out', 'i16') * pageSize, 127),[34,2],[65,10],[106],[33,3],[32,0],[33,4],[32,0],[40,1,0],[33,5],[32,4],[32,5],[65,2],[108],[106],[33,6],[3,64],[32,4],[32,6],[72],[4,64],[32,4],[47,0,4],[33,7],[32,3],[32,7],[59,0,4],[32,4],[65,2],[106],[33,4],[32,3],[65,2],[106],[33,3],[12,1],[11],[11],[32,3],[65,60],[59,0,4],[32,3],[65,47],[59,0,6],[32,3],[65,243,0],[59,0,8],[32,3],[65,245,0],[59,0,10],[32,3],[65,240,0],[59,0,12],[32,3],[65,62],[59,0,14],[32,2],[32,5],[65,11],[106],[34,8],[54,1,0],[32,2],[65,2],[15]],
@@ -170,7 +170,7 @@ export const BuiltinFuncs = function() {
170
170
  typedReturns: true,
171
171
  locals: [127,127,127,127,127,127,127],
172
172
  localNames: ["_this","_this#type","out","outPtr","thisPtr","thisLen","endPtr","chr","__length_setter_tmp"],
173
- data: [{"offset":0,"bytes":[5,0,0,0,60,0,115,0,117,0,112,0,62,0]}]
173
+ data: [{"offset":0,"bytes":[5,0,0,0,60,0,115,0,117,0,112,0,62,0]}],
174
174
  };
175
175
  this.__ByteString_prototype_sup = {
176
176
  wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'bytestring: __ByteString_prototype_sup/out', 'i8') * pageSize, 127),[34,2],[65,5],[106],[33,3],[32,0],[33,4],[32,0],[40,1,0],[33,5],[32,4],[32,5],[106],[33,6],[3,64],[32,4],[32,6],[72],[4,64],[32,4],[32,4],[65,1],[106],[33,4],[45,0,4],[33,7],[32,3],[32,3],[65,1],[106],[33,3],[32,7],[58,0,4],[12,1],[11],[11],[32,3],[65,60],[58,0,4],[32,3],[65,47],[58,0,5],[32,3],[65,243,0],[58,0,6],[32,3],[65,245,0],[58,0,7],[32,3],[65,240,0],[58,0,8],[32,3],[65,62],[58,0,9],[32,2],[32,5],[65,11],[106],[34,8],[54,1,0],[32,2],[65,18],[15]],
@@ -180,7 +180,7 @@ export const BuiltinFuncs = function() {
180
180
  typedReturns: true,
181
181
  locals: [127,127,127,127,127,127,127],
182
182
  localNames: ["_this","_this#type","out","outPtr","thisPtr","thisLen","endPtr","chr","__length_setter_tmp"],
183
- data: [{"offset":0,"bytes":[5,0,0,0,60,115,117,112,62]}]
183
+ data: [{"offset":0,"bytes":[5,0,0,0,60,115,117,112,62]}],
184
184
  };
185
185
  this.__String_prototype_trimLeft = {
186
186
  wasm: (scope, {builtin,}) => [[32,0],[65,2],[16, builtin('__String_prototype_trimStart')],[34,2],[15]],
@@ -299,6 +299,16 @@ export const BuiltinFuncs = function() {
299
299
  locals: [],
300
300
  localNames: ["_this","_this#type"],
301
301
  };
302
+ this.__Array_prototype_forEach = {
303
+ wasm: (scope, {}) => [[32,0],[252,3],[40,1,0],[184],[33,4],[68,0,0,0,0,0,0,0,0],[33,5],[3,64],[32,5],[32,4],[99],[4,64],[32,5],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,6],[43,0,4],[32,6],[45,0,12],[33,7],[65,0],[33,8],[33,9],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[32,7],[33,10],[33,11],[32,0],[65,16],[33,12],[33,13],[32,2],[252,3],[33,14],[2,124],[2,64],[2,64],[2,64],[2,64],[32,14],[65,2],[108],[47,0,128,128,12,"read_argc"],[14,4,0,1,2,3,0],[11],[32,14],[17,0,0],[33,7],[12,3],[11],[32,9],[32,8],[32,14],[17,1,0],[33,7],[12,2],[11],[32,9],[32,8],[32,11],[32,10],[32,14],[17,2,0],[33,7],[12,1],[11],[32,9],[32,8],[32,11],[32,10],[32,13],[32,12],[32,14],[17,3,0],[33,7],[11],[26],[12,1],[11],[11],[68,0,0,0,0,0,0,0,0],[65,3],[15]],
304
+ params: [124,127,124,127],
305
+ typedParams: true,
306
+ returns: [124,127],
307
+ typedReturns: true,
308
+ locals: [124,124,127,127,127,124,127,124,127,124,127],
309
+ localNames: ["_this","_this#type","callbackFn","callbackFn#type","len","i","#loadArray_offset","#last_type","#indirect_arg0_type","#indirect_arg0_val","#indirect_arg1_type","#indirect_arg1_val","#indirect_arg2_type","#indirect_arg2_val","#indirect_func"],
310
+ table: true
311
+ };
302
312
  this.btoa = {
303
313
  wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'bytestring: btoa/keyStr', 'i8') * pageSize, 127),[34,2],[33,3],[32,0],[40,1,0],[33,4],...number(allocPage(scope, 'bytestring: btoa/output', 'i8') * pageSize, 127),[34,5],[65,4],[32,4],[65,3],[109],[32,4],[65,3],[111],[69],[69],[106],[108],[34,6],[54,1,0],[32,0],[33,7],[32,5],[33,8],[32,7],[32,4],[106],[33,9],[65,0],[33,10],[3,64],[32,7],[32,9],[72],[4,64],[32,7],[32,7],[65,1],[106],[33,7],[45,0,4],[33,11],[32,7],[32,9],[72],[4,127],[32,7],[32,7],[65,1],[106],[33,7],[45,0,4],[65,0],[33,13],[5],[65,127],[65,0],[33,13],[11],[33,12],[32,7],[32,9],[72],[4,127],[32,7],[32,7],[65,1],[106],[33,7],[45,0,4],[65,0],[33,13],[5],[65,127],[65,0],[33,13],[11],[33,14],[32,11],[65,2],[117],[33,15],[32,11],[65,3],[113],[65,4],[116],[32,12],[65,127],[70],[4,127],[65,0],[65,0],[33,13],[5],[32,12],[65,4],[117],[65,0],[33,13],[11],[114],[33,16],[32,12],[65,15],[113],[65,2],[116],[32,14],[65,127],[70],[4,127],[65,0],[65,0],[33,13],[5],[32,14],[65,6],[117],[65,0],[33,13],[11],[114],[33,17],[32,14],[65,63],[113],[33,18],[32,12],[65,127],[70],[4,64],[65,192,0],[33,17],[65,192,0],[33,18],[5],[32,14],[65,127],[70],[4,64],[65,192,0],[33,18],[11],[11],[32,8],[32,8],[65,1],[106],[33,8],[32,3],[32,15],[106],[45,0,4],[58,0,4],[32,8],[32,8],[65,1],[106],[33,8],[32,3],[32,16],[106],[45,0,4],[58,0,4],[32,8],[32,8],[65,1],[106],[33,8],[32,3],[32,17],[106],[45,0,4],[58,0,4],[32,8],[32,8],[65,1],[106],[33,8],[32,3],[32,18],[106],[45,0,4],[58,0,4],[12,1],[11],[11],[32,5],[15]],
304
314
  params: [127,127],
@@ -307,7 +317,7 @@ export const BuiltinFuncs = function() {
307
317
  returnType: 18,
308
318
  locals: [127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127],
309
319
  localNames: ["input","input#type","keyStr","keyStrPtr","len","output","__length_setter_tmp","i","j","endPtr","endPtr#type","chr1","chr2","#last_type","chr3","enc1","enc2","enc3","enc4"],
310
- data: [{"offset":0,"bytes":[65,0,0,0,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47,61]}]
320
+ data: [{"offset":0,"bytes":[65,0,0,0,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47,61]}],
311
321
  };
312
322
  this.__Boolean_prototype_toString = {
313
323
  wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'bytestring: __Boolean_prototype_toString/out', 'i8') * pageSize, 124),[33,2],[32,0],[252,3],[4,64],[32,2],[252,3],[34,3],[65,4],[54,1,0],[32,3],[65,244,0],[58,0,4],[32,3],[65,242,0],[58,0,5],[32,3],[65,245,0],[58,0,6],[32,3],[65,229,0],[58,0,7],[32,3],[184],[33,2],[5],[32,2],[252,3],[34,3],[65,5],[54,1,0],[32,3],[65,230,0],[58,0,4],[32,3],[65,225,0],[58,0,5],[32,3],[65,236,0],[58,0,6],[32,3],[65,243,0],[58,0,7],[32,3],[65,229,0],[58,0,8],[32,3],[184],[33,2],[11],[32,2],[65,18],[15]],
@@ -335,7 +345,7 @@ export const BuiltinFuncs = function() {
335
345
  returnType: 18,
336
346
  locals: [127,127,127,127,127,127,127,127,127,127,127],
337
347
  localNames: ["bytes","bytesPtr","a","aEndPtr","output","i","j","endPtr","byte","lower","upper"],
338
- data: [{"offset":0,"bytes":[16,0,0,0,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46]},{"offset":65536,"bytes":[36,0,0,0,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45]}]
348
+ data: [{"offset":0,"bytes":[16,0,0,0,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46]},{"offset":65536,"bytes":[36,0,0,0,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45]}],
339
349
  };
340
350
  this.__ecma262_Day = {
341
351
  wasm: (scope, {builtin,}) => [[32,0],[68,0,0,0,0,112,153,148,65],[163],[16, builtin('__Math_floor')],[15]],
@@ -570,7 +580,7 @@ export const BuiltinFuncs = function() {
570
580
  returnType: 18,
571
581
  locals: [124,124,124,124,124,124],
572
582
  localNames: ["tv","tv#type","weekday","lut","out","__length_setter_tmp","outPtr","lutPtr"],
573
- data: [{"offset":0,"bytes":[21,0,0,0,83,117,110,77,111,110,84,117,101,87,101,100,84,104,117,70,114,105,83,97,116]}]
583
+ data: [{"offset":0,"bytes":[21,0,0,0,83,117,110,77,111,110,84,117,101,87,101,100,84,104,117,70,114,105,83,97,116]}],
574
584
  };
575
585
  this.__ecma262_MonthName = {
576
586
  wasm: (scope, {allocPage,builtin,}) => [[32,0],[65,0],[16, builtin('__ecma262_MonthFromTime')],[33,2],...number(allocPage(scope, 'bytestring: __ecma262_MonthName/lut', 'i8') * pageSize, 124),[33,3],...number(allocPage(scope, 'bytestring: __ecma262_MonthName/out', 'i8') * pageSize, 124),[34,4],[252,3],[68,0,0,0,0,0,0,8,64],[34,5],[252,3],[54,1,0],[32,4],[33,6],[32,3],[32,2],[68,0,0,0,0,0,0,8,64],[162],[160],[33,7],[32,6],[32,6],[68,0,0,0,0,0,0,240,63],[160],[33,6],[252,2],[32,7],[32,7],[68,0,0,0,0,0,0,240,63],[160],[33,7],[252,2],[45,0,4],[58,0,4],[32,6],[32,6],[68,0,0,0,0,0,0,240,63],[160],[33,6],[252,2],[32,7],[32,7],[68,0,0,0,0,0,0,240,63],[160],[33,7],[252,2],[45,0,4],[58,0,4],[32,6],[252,2],[32,7],[252,2],[45,0,4],[58,0,4],[32,4],[15]],
@@ -580,7 +590,7 @@ export const BuiltinFuncs = function() {
580
590
  returnType: 18,
581
591
  locals: [124,124,124,124,124,124],
582
592
  localNames: ["tv","tv#type","month","lut","out","__length_setter_tmp","outPtr","lutPtr"],
583
- data: [{"offset":0,"bytes":[36,0,0,0,74,97,110,70,101,98,77,97,114,65,112,114,77,97,121,74,117,110,74,117,108,65,117,103,83,101,112,79,99,116,78,111,118,68,101,99]}]
593
+ data: [{"offset":0,"bytes":[36,0,0,0,74,97,110,70,101,98,77,97,114,65,112,114,77,97,121,74,117,110,74,117,108,65,117,103,83,101,112,79,99,116,78,111,118,68,101,99]}],
584
594
  };
585
595
  this.__ecma262_ParseMonthName = {
586
596
  wasm: (scope, {}) => [[32,0],[252,2],[45,0,4],[183],[34,2],[68,0,0,0,0,0,128,82,64],[97],[4,64],[32,0],[252,2],[45,0,5],[183],[34,3],[68,0,0,0,0,0,64,88,64],[97],[4,64],[68,0,0,0,0,0,0,0,0],[15],[11],[32,3],[68,0,0,0,0,0,64,93,64],[97],[4,64],[32,0],[252,2],[45,0,6],[183],[34,4],[68,0,0,0,0,0,128,91,64],[97],[4,64],[68,0,0,0,0,0,0,20,64],[15],[11],[32,4],[68,0,0,0,0,0,0,91,64],[97],[4,64],[68,0,0,0,0,0,0,24,64],[15],[11],[11],[11],[32,2],[68,0,0,0,0,0,64,83,64],[97],[4,64],[32,0],[252,2],[45,0,5],[183],[34,3],[68,0,0,0,0,0,64,88,64],[97],[4,64],[32,0],[252,2],[45,0,6],[183],[34,4],[68,0,0,0,0,0,128,92,64],[97],[4,64],[68,0,0,0,0,0,0,0,64],[15],[11],[32,4],[68,0,0,0,0,0,64,94,64],[97],[4,64],[68,0,0,0,0,0,0,16,64],[15],[11],[11],[11],[32,2],[68,0,0,0,0,0,64,80,64],[97],[4,64],[32,0],[252,2],[45,0,5],[183],[34,3],[68,0,0,0,0,0,0,92,64],[97],[4,64],[68,0,0,0,0,0,0,8,64],[15],[11],[32,3],[68,0,0,0,0,0,64,93,64],[97],[4,64],[68,0,0,0,0,0,0,28,64],[15],[11],[11],[32,2],[68,0,0,0,0,0,128,81,64],[97],[4,64],[68,0,0,0,0,0,0,240,63],[15],[11],[32,2],[68,0,0,0,0,0,192,84,64],[97],[4,64],[68,0,0,0,0,0,0,32,64],[15],[11],[32,2],[68,0,0,0,0,0,192,83,64],[97],[4,64],[68,0,0,0,0,0,0,34,64],[15],[11],[32,2],[68,0,0,0,0,0,128,83,64],[97],[4,64],[68,0,0,0,0,0,0,36,64],[15],[11],[32,2],[68,0,0,0,0,0,0,81,64],[97],[4,64],[68,0,0,0,0,0,0,38,64],[15],[11],[68,0,0,0,0,0,0,240,191],[15]],
@@ -1031,7 +1041,7 @@ export const BuiltinFuncs = function() {
1031
1041
  typedReturns: true,
1032
1042
  locals: [124],
1033
1043
  localNames: ["tv","tv#type","out"],
1034
- data: [{"offset":0,"bytes":[11,0,0,0,43,48,48,48,48,32,40,85,84,67,41]}]
1044
+ data: [{"offset":0,"bytes":[11,0,0,0,43,48,48,48,48,32,40,85,84,67,41]}],
1035
1045
  };
1036
1046
  this.__ecma262_ToDateString = {
1037
1047
  wasm: (scope, {allocPage,builtin,}) => [...number(allocPage(scope, 'bytestring: __ecma262_ToDateString/out', 'i8') * pageSize, 124),[34,2],[252,3],[68,0,0,0,0,0,0,0,0],[34,3],[252,3],[54,1,0],[32,0],[16, builtin('__Number_isNaN')],[252,3],[4,64],[32,2],[252,3],[34,4],[65,12],[54,1,0],[32,4],[65,201,0],[58,0,4],[32,4],[65,238,0],[58,0,5],[32,4],[65,246,0],[58,0,6],[32,4],[65,225,0],[58,0,7],[32,4],[65,236,0],[58,0,8],[32,4],[65,233,0],[58,0,9],[32,4],[65,228,0],[58,0,10],[32,4],[65,32],[58,0,11],[32,4],[65,196,0],[58,0,12],[32,4],[65,225,0],[58,0,13],[32,4],[65,244,0],[58,0,14],[32,4],[65,229,0],[58,0,15],[32,4],[184],[34,2],[65,18],[15],[11],[32,0],[65,0],[16, builtin('__ecma262_LocalTime')],[33,5],[32,2],[65,18],[32,5],[65,0],[16, builtin('__ecma262_DateString')],[65,18],[16, builtin('__Porffor_bytestring_appendStr')],[26],[32,2],[65,18],[68,0,0,0,0,0,0,64,64],[65,0],[16, builtin('__Porffor_bytestring_appendChar')],[26],[32,2],[65,18],[32,5],[65,0],[16, builtin('__ecma262_TimeString')],[65,18],[16, builtin('__Porffor_bytestring_appendStr')],[26],[32,2],[65,18],[32,0],[65,0],[16, builtin('__ecma262_TimeZoneString')],[34,6],[16, builtin('__Porffor_bytestring_appendStr')],[26],[32,2],[65,18],[15]],
@@ -1275,7 +1285,7 @@ export const BuiltinFuncs = function() {
1275
1285
  returnType: 18,
1276
1286
  locals: [127,127,127,127,127,127,127,127,127,127,127,127,127],
1277
1287
  localNames: ["input","input#type","lut","len","outLength","i","endPtr","chr","output","__length_setter_tmp","j","lower","upper","#makearray_pointer_tmp","nibble"],
1278
- data: [{"offset":0,"bytes":[128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0]}]
1288
+ data: [{"offset":0,"bytes":[128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0]}],
1279
1289
  };
1280
1290
  this.__Function_prototype_toString = {
1281
1291
  wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'bytestring: __Function_prototype_toString/out', 'i8') * pageSize, 124),[34,2],[65,18],[15]],
@@ -1285,7 +1295,7 @@ export const BuiltinFuncs = function() {
1285
1295
  typedReturns: true,
1286
1296
  locals: [124],
1287
1297
  localNames: ["_this","_this#type","out"],
1288
- data: [{"offset":0,"bytes":[14,0,0,0,102,117,110,99,116,105,111,110,32,40,41,32,123,125]}]
1298
+ data: [{"offset":0,"bytes":[14,0,0,0,102,117,110,99,116,105,111,110,32,40,41,32,123,125]}],
1289
1299
  };
1290
1300
  this.parseInt = {
1291
1301
  wasm: (scope, {builtin,}) => [[32,2],[65,0],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,0,0],[98],[4,64],[68,0,0,0,0,0,0,36,64],[33,2],[11],[32,2],[68,0,0,0,0,0,0,0,0],[97],[4,64],[68,0,0,0,0,0,0,36,64],[33,2],[11],[32,2],[68,0,0,0,0,0,0,0,64],[99],[34,4],[69],[4,127],[32,2],[68,0,0,0,0,0,0,66,64],[100],[65,1],[33,5],[5],[32,4],[65,1],[33,5],[11],[4,64],[68,0,0,0,0,0,0,248,127],[15],[11],[68,0,0,0,0,0,0,77,64],[33,6],[32,2],[68,0,0,0,0,0,0,36,64],[99],[4,64],[68,0,0,0,0,0,0,72,64],[32,2],[160],[33,6],[11],[68,0,0,0,0,0,0,248,127],[33,7],[32,0],[34,8],[252,2],[40,0,0],[183],[33,9],[32,8],[33,10],[68,0,0,0,0,0,0,0,0],[33,11],[32,0],[32,1],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,50,64],[97],[4,64],[32,10],[32,9],[160],[33,12],[32,10],[252,2],[45,0,4],[183],[34,13],[68,0,0,0,0,0,128,69,64],[97],[4,64],[32,10],[68,0,0,0,0,0,0,240,63],[160],[33,10],[11],[32,13],[68,0,0,0,0,0,128,70,64],[97],[4,64],[68,0,0,0,0,0,0,240,63],[33,11],[32,10],[68,0,0,0,0,0,0,240,63],[160],[33,10],[11],[32,13],[68,0,0,0,0,0,0,72,64],[97],[4,64],[32,10],[68,0,0,0,0,0,0,240,63],[160],[252,2],[45,0,4],[183],[34,14],[68,0,0,0,0,0,0,94,64],[97],[34,4],[69],[4,127],[32,14],[68,0,0,0,0,0,0,86,64],[97],[65,1],[33,5],[5],[32,4],[65,1],[33,5],[11],[4,64],[32,10],[68,0,0,0,0,0,0,0,64],[160],[33,10],[68,0,0,0,0,0,0,48,64],[33,2],[11],[11],[3,64],[32,10],[32,12],[99],[4,64],[32,10],[32,10],[68,0,0,0,0,0,0,240,63],[160],[33,10],[252,2],[45,0,4],[183],[34,15],[68,0,0,0,0,0,0,72,64],[102],[34,4],[4,127],[32,15],[32,6],[99],[65,1],[33,5],[5],[32,4],[65,1],[33,5],[11],[4,64],[32,7],[16, builtin('__Number_isNaN')],[252,3],[4,64],[68,0,0,0,0,0,0,0,0],[33,7],[11],[32,7],[32,2],[162],[34,7],[32,15],[68,0,0,0,0,0,0,72,64],[161],[160],[33,7],[5],[32,2],[68,0,0,0,0,0,0,36,64],[100],[4,64],[32,15],[68,0,0,0,0,0,64,88,64],[102],[34,4],[4,127],[32,15],[68,0,0,0,0,0,192,85,64],[32,2],[160],[99],[65,1],[33,5],[5],[32,4],[65,1],[33,5],[11],[4,64],[32,7],[16, builtin('__Number_isNaN')],[252,3],[4,64],[68,0,0,0,0,0,0,0,0],[33,7],[11],[32,7],[32,2],[162],[34,7],[32,15],[68,0,0,0,0,0,192,85,64],[161],[160],[33,7],[5],[32,15],[68,0,0,0,0,0,64,80,64],[102],[34,4],[4,127],[32,15],[68,0,0,0,0,0,128,75,64],[32,2],[160],[99],[65,1],[33,5],[5],[32,4],[65,1],[33,5],[11],[4,64],[32,7],[16, builtin('__Number_isNaN')],[252,3],[4,64],[68,0,0,0,0,0,0,0,0],[33,7],[11],[32,7],[32,2],[162],[34,7],[32,15],[68,0,0,0,0,0,128,75,64],[161],[160],[33,7],[5],[32,11],[252,3],[4,64],[32,7],[154],[15],[11],[32,7],[15],[11],[11],[5],[32,11],[252,3],[4,64],[32,7],[154],[15],[11],[32,7],[15],[11],[11],[12,1],[11],[11],[32,11],[252,3],[4,64],[32,7],[154],[15],[11],[32,7],[15],[11],[32,10],[32,9],[68,0,0,0,0,0,0,0,64],[162],[160],[33,12],[32,10],[252,2],[47,0,4],[183],[34,13],[68,0,0,0,0,0,128,69,64],[97],[4,64],[32,10],[68,0,0,0,0,0,0,0,64],[160],[33,10],[11],[32,13],[68,0,0,0,0,0,128,70,64],[97],[4,64],[68,0,0,0,0,0,0,240,63],[33,11],[32,10],[68,0,0,0,0,0,0,0,64],[160],[33,10],[11],[32,13],[68,0,0,0,0,0,0,72,64],[97],[4,64],[32,10],[68,0,0,0,0,0,0,0,64],[160],[252,2],[47,0,4],[183],[34,14],[68,0,0,0,0,0,0,94,64],[97],[34,4],[69],[4,127],[32,14],[68,0,0,0,0,0,0,86,64],[97],[65,1],[33,5],[5],[32,4],[65,1],[33,5],[11],[4,64],[32,10],[68,0,0,0,0,0,0,16,64],[160],[33,10],[68,0,0,0,0,0,0,48,64],[33,2],[11],[11],[3,64],[32,10],[32,12],[99],[4,64],[32,10],[252,2],[47,0,4],[183],[33,15],[32,10],[68,0,0,0,0,0,0,0,64],[160],[33,10],[32,15],[68,0,0,0,0,0,0,72,64],[102],[34,4],[4,127],[32,15],[32,6],[99],[65,1],[33,5],[5],[32,4],[65,1],[33,5],[11],[4,64],[32,7],[16, builtin('__Number_isNaN')],[252,3],[4,64],[68,0,0,0,0,0,0,0,0],[33,7],[11],[32,7],[32,2],[162],[34,7],[32,15],[68,0,0,0,0,0,0,72,64],[161],[160],[33,7],[5],[32,2],[68,0,0,0,0,0,0,36,64],[100],[4,64],[32,15],[68,0,0,0,0,0,64,88,64],[102],[34,4],[4,127],[32,15],[68,0,0,0,0,0,192,85,64],[32,2],[160],[99],[65,1],[33,5],[5],[32,4],[65,1],[33,5],[11],[4,64],[32,7],[16, builtin('__Number_isNaN')],[252,3],[4,64],[68,0,0,0,0,0,0,0,0],[33,7],[11],[32,7],[32,2],[162],[34,7],[32,15],[68,0,0,0,0,0,192,85,64],[161],[160],[33,7],[5],[32,15],[68,0,0,0,0,0,64,80,64],[102],[34,4],[4,127],[32,15],[68,0,0,0,0,0,128,75,64],[32,2],[160],[99],[65,1],[33,5],[5],[32,4],[65,1],[33,5],[11],[4,64],[32,7],[16, builtin('__Number_isNaN')],[252,3],[4,64],[68,0,0,0,0,0,0,0,0],[33,7],[11],[32,7],[32,2],[162],[34,7],[32,15],[68,0,0,0,0,0,128,75,64],[161],[160],[33,7],[5],[32,11],[252,3],[4,64],[32,7],[154],[15],[11],[32,7],[15],[11],[11],[5],[32,11],[252,3],[4,64],[32,7],[154],[15],[11],[32,7],[15],[11],[11],[12,1],[11],[11],[32,11],[252,3],[4,64],[32,7],[154],[15],[11],[32,7],[15]],
@@ -1340,7 +1350,7 @@ export const BuiltinFuncs = function() {
1340
1350
  typedReturns: true,
1341
1351
  locals: [124],
1342
1352
  localNames: ["_this","_this#type","out"],
1343
- data: [{"offset":0,"bytes":[15,0,0,0,91,111,98,106,101,99,116,32,79,98,106,101,99,116,93]}]
1353
+ data: [{"offset":0,"bytes":[15,0,0,0,91,111,98,106,101,99,116,32,79,98,106,101,99,116,93]}],
1344
1354
  };
1345
1355
  this.__Porffor_allocate = {
1346
1356
  wasm: (scope, {}) => [[65,1],[64,0],[26],[63,0],[65,1],[107],[65,128,128,4],[108],[184],[15]],
@@ -1458,7 +1468,7 @@ export const BuiltinFuncs = function() {
1458
1468
  typedReturns: true,
1459
1469
  locals: [127,127],
1460
1470
  localNames: ["code","code#type","out","#makearray_pointer_tmp"],
1461
- data: [{"offset":0,"bytes":[1,0,0,0,46]}]
1471
+ data: [{"offset":0,"bytes":[1,0,0,0,46]}],
1462
1472
  };
1463
1473
  this.__String_prototype_toUpperCase = {
1464
1474
  wasm: (scope, {allocPage,}) => [[32,0],[40,1,0],[33,2],...number(allocPage(scope, 'string: __String_prototype_toUpperCase/out', 'i16') * pageSize, 127),[34,3],[32,2],[54,0,0],[32,0],[33,4],[32,3],[33,5],[32,4],[32,2],[65,2],[108],[106],[33,6],[3,64],[32,4],[32,6],[72],[4,64],[32,4],[47,0,4],[33,7],[32,4],[65,2],[106],[33,4],[32,7],[65,225,0],[78],[4,64],[32,7],[65,250,0],[76],[4,64],[32,7],[65,32],[107],[33,7],[11],[11],[32,5],[32,7],[59,0,4],[32,5],[65,2],[106],[33,5],[12,1],[11],[11],[32,3],[65,2],[15]],
@@ -18,7 +18,7 @@ const compile = async (file, [ _funcs, _globals ]) => {
18
18
  first = source.slice(0, source.indexOf('\n'));
19
19
  }
20
20
 
21
- let args = ['--bytestring', '--todo-time=compile', '--no-indirect-calls', '--no-treeshake-wasm-imports', '--no-rm-unused-types', '--scoped-page-names', '--funsafe-no-unlikely-proto-checks', '--fast-length', '--parse-types', '--opt-types'];
21
+ let args = ['--bytestring', '--todo-time=compile', '--no-treeshake-wasm-imports', '--no-rm-unused-types', '--scoped-page-names', '--funsafe-no-unlikely-proto-checks', '--fast-length', '--parse-types', '--opt-types'];
22
22
  if (first.startsWith('// @porf')) {
23
23
  args = args.concat(first.slice('// @porf '.length).split(' '));
24
24
  }
@@ -111,8 +111,9 @@ ${funcs.map(x => {
111
111
  ${x.returnType != null ? `returnType: ${JSON.stringify(x.returnType)}` : 'typedReturns: true'},
112
112
  locals: ${JSON.stringify(Object.values(x.locals).slice(x.params.length).map(x => x.type))},
113
113
  localNames: ${JSON.stringify(Object.keys(x.locals))},
114
- ${x.data && x.data.length > 0 ? ` data: ${JSON.stringify(x.data)}` : ''}
115
- };`.replaceAll('\n\n', '\n').replaceAll('\n\n', '\n')
114
+ ${x.data && x.data.length > 0 ? ` data: ${JSON.stringify(x.data)},` : ''}
115
+ ${x.table ? ` table: true` : ''}
116
+ };`.replaceAll('\n\n', '\n').replaceAll('\n\n', '\n').replaceAll('\n\n', '\n');
116
117
  }).join('\n')}
117
118
  };`;
118
119
  };
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.14.0-b481bfc5f",
4
+ "version": "0.14.0-c6edfd328",
5
5
  "author": "CanadaHonk",
6
6
  "license": "MIT",
7
7
  "scripts": {