porffor 0.41.7 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -121,9 +121,10 @@ export default (funcs, globals, tags, pages, data, noTreeshake = false) => {
121
121
 
122
122
  const nameSection = Prefs.d ? customSection('name', encodeNames(funcs)) : [];
123
123
 
124
+ const directFuncs = funcs.filter(x => !x.indirect);
124
125
  const tableSection = !funcs.table ? [] : createSection(
125
126
  Section.table,
126
- encodeVector([ [ Reftype.funcref, 0x00, ...unsignedLEB128(funcs.length) ] ])
127
+ encodeVector([ [ Reftype.funcref, 0x00, ...unsignedLEB128(directFuncs.length) ] ])
127
128
  );
128
129
  time('table section');
129
130
 
@@ -132,7 +133,7 @@ export default (funcs, globals, tags, pages, data, noTreeshake = false) => {
132
133
  encodeVector([ [
133
134
  0x00,
134
135
  Opcodes.i32_const, 0, Opcodes.end,
135
- ...encodeVector(funcs.map(x => unsignedLEB128((x.wrapperFunc ?? x).asmIndex)))
136
+ ...encodeVector(directFuncs.map(x => unsignedLEB128((x.wrapperFunc ?? x).asmIndex)))
136
137
  ] ])
137
138
  );
138
139
  time('element section');
@@ -145,8 +146,8 @@ export default (funcs, globals, tags, pages, data, noTreeshake = false) => {
145
146
 
146
147
  // generate func lut data
147
148
  const bytes = [];
148
- for (let i = 0; i < funcs.length; i++) {
149
- const func = funcs[i];
149
+ for (let i = 0; i < directFuncs.length; i++) {
150
+ const func = directFuncs[i];
150
151
  let name = func.name;
151
152
 
152
153
  // userland exposed .length
@@ -167,7 +168,6 @@ export default (funcs, globals, tags, pages, data, noTreeshake = false) => {
167
168
  if (func.constr) flags |= 0b10;
168
169
  bytes.push(flags);
169
170
 
170
- if (name.startsWith('#indirect_')) name = name.slice(10);
171
171
  if (name.startsWith('#')) name = '';
172
172
 
173
173
  // eg: __String_prototype_toLowerCase -> toLowerCase