porffor 0.18.18 → 0.18.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiler/codegen.js +5 -3
- package/compiler/generated_builtins.js +2147 -3656
- package/compiler/precompile.js +6 -9
- package/package.json +1 -1
- package/runner/index.js +1 -1
package/compiler/precompile.js
CHANGED
@@ -111,15 +111,12 @@ export const BuiltinFuncs = function() {
|
|
111
111
|
${funcs.map(x => {
|
112
112
|
const wasm = JSON.stringify(x.wasm.filter(x => x.length && x[0] != null)).replace(/\["alloc","(.*?)","(.*?)",(.*?)\]/g, (_, reason, type, valtype) => `...number(allocPage(scope, '${reason}', '${type}') * pageSize, ${valtype})`).replace(/\[16,"(.*?)"]/g, (_, name) => `[16, builtin('${name}')]`).replace(/\["throw","(.*?)","(.*?)"\]/g, (_, constructor, message) => `...internalThrow(scope, '${constructor}', \`${message}\`)`);
|
113
113
|
return ` this.${x.name} = {
|
114
|
-
wasm: (scope, {${wasm.includes('allocPage(') ? 'allocPage,' : ''}${wasm.includes('builtin(') ? 'builtin,' : ''}${wasm.includes('internalThrow(') ? 'internalThrow,' : ''}}) => ${wasm},
|
115
|
-
params: ${JSON.stringify(x.params)},
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
localNames: ${JSON.stringify(Object.keys(x.locals))},
|
121
|
-
${x.data && x.data.length > 0 ? ` data: ${JSON.stringify(x.data)},` : ''}
|
122
|
-
${x.table ? ` table: true,` : ''}${x.constr ? ` constr: true,` : ''}${x.hasRestArgument ? ` hasRestArgument: true,` : ''}
|
114
|
+
wasm: (scope, {${`${wasm.includes('allocPage(') ? 'allocPage,' : ''}${wasm.includes('builtin(') ? 'builtin,' : ''}${wasm.includes('internalThrow(') ? 'internalThrow,' : ''}`.slice(0, -1)}}) => ${wasm},
|
115
|
+
params: ${JSON.stringify(x.params)}, typedParams: 1,
|
116
|
+
returns: ${JSON.stringify(x.returns)}, ${x.returnType != null ? `returnType: ${JSON.stringify(x.returnType)}` : 'typedReturns: 1'},
|
117
|
+
locals: ${JSON.stringify(Object.values(x.locals).slice(x.params.length).map(x => x.type))}, localNames: ${JSON.stringify(Object.keys(x.locals))},
|
118
|
+
${x.data && x.data.length > 0 ? ` data: [${x.data.map(x => `[${x.offset ?? 'null'},[${x.bytes.join(',')}]]`).join(',')}],` : ''}
|
119
|
+
${x.table ? ` table: 1,` : ''}${x.constr ? ` constr: 1,` : ''}${x.hasRestArgument ? ` hasRestArgument: 1,` : ''}
|
123
120
|
};`.replaceAll('\n\n', '\n').replaceAll('\n\n', '\n').replaceAll('\n\n', '\n');
|
124
121
|
}).join('\n')}
|
125
122
|
};`;
|
package/package.json
CHANGED