porffor 0.49.3 → 0.49.5

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.
@@ -55,7 +55,7 @@ const funcRef = func => {
55
55
  [ Opcodes.const, 'funcref', func.name ]
56
56
  ];
57
57
 
58
- const wrapperArgc = Prefs.indirectWrapperArgc ?? 8;
58
+ const wrapperArgc = Prefs.indirectWrapperArgc ?? 10;
59
59
  if (!func.wrapperFunc) {
60
60
  const locals = {}, params = [];
61
61
  for (let i = 0; i < wrapperArgc + 2; i++) {
@@ -2408,7 +2408,7 @@ const generateCall = (scope, decl, _global, _name, unusedValue = false) => {
2408
2408
  funcs.table = true;
2409
2409
  scope.table = true;
2410
2410
 
2411
- const wrapperArgc = Prefs.indirectWrapperArgc ?? 8;
2411
+ const wrapperArgc = Prefs.indirectWrapperArgc ?? 10;
2412
2412
  const underflow = wrapperArgc - args.length;
2413
2413
  for (let i = 0; i < underflow; i++) args.push(DEFAULT_VALUE());
2414
2414
 
package/compiler/wrap.js CHANGED
@@ -384,7 +384,7 @@ export default (source, module = undefined, customImports = {}, print = str => p
384
384
 
385
385
  const backtrace = (funcInd, blobOffset) => {
386
386
  if (funcInd == null || blobOffset == null ||
387
- Number.isNaN(funcInd) || Number.isNaN(blobOffset)) return false;
387
+ Number.isNaN(funcInd) || Number.isNaN(blobOffset) || Prefs.backtrace === false) return false;
388
388
 
389
389
  // convert blob offset -> function wasm offset
390
390
  const func = funcs.find(x => x.asmIndex === funcInd);
@@ -500,15 +500,10 @@ export default (source, module = undefined, customImports = {}, print = str => p
500
500
  continue;
501
501
  }
502
502
 
503
- const name = x === 'm' ? 'main' : x;
504
- const func = funcs.find(x => x.name === name);
505
-
506
- const exp = instance.exports[x];
507
- exports[func.name] = exp;
508
-
509
- exports[func.name] = function() {
503
+ const wasm = instance.exports[x];
504
+ exports[x === 'm' ? 'main' : x] = function() {
510
505
  try {
511
- const ret = exp.apply(this, arguments);
506
+ const ret = wasm.apply(this, arguments);
512
507
  if (ret == null) return undefined;
513
508
 
514
509
  if (rawValues) return { value: ret[0], type: ret[1], js: porfToJSValue({ memory, funcs, pages }, ret[0], ret[1]) };
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.49.3",
4
+ "version": "0.49.5",
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.49.3';
3
+ globalThis.version = '0.49.5';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {