porffor 0.20.5 → 0.20.7

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.
@@ -24,7 +24,7 @@ const compile = async (file, _funcs) => {
24
24
  first = source.slice(0, source.indexOf('\n'));
25
25
  }
26
26
 
27
- let args = ['--bytestring', '--todo-time=compile', '--truthy=no_nan_negative', '--no-treeshake-wasm-imports', '--no-rm-unused-types', '--scoped-page-names', '--funsafe-no-unlikely-proto-checks', '--fast-length', '--parse-types', '--opt-types'];
27
+ let args = ['--bytestring', '--todo-time=compile', '--truthy=no_nan_negative', '--no-treeshake-wasm-imports', '--no-rm-unused-types', '--scoped-page-names', '--funsafe-no-unlikely-proto-checks', '--fast-length', '--fast-object', '--parse-types', '--opt-types'];
28
28
  if (first.startsWith('// @porf')) {
29
29
  args = first.slice('// @porf '.length).split(' ').concat(args);
30
30
  }
package/compiler/types.js CHANGED
@@ -1,27 +1,21 @@
1
+ export const TYPE_FLAGS = {
2
+ parity: 0b10000000,
3
+ length: 0b01000000,
4
+ };
5
+
1
6
  export const TYPES = {
2
7
  empty: 0x00,
3
8
  number: 0x01,
4
9
  boolean: 0x02,
5
- string: 0x03,
6
- undefined: 0x04,
7
- object: 0x05,
10
+ string: 0x03 | TYPE_FLAGS.length,
11
+ bigint: 0x04,
12
+ symbol: 0x05,
8
13
  function: 0x06,
9
- symbol: 0x07,
10
- bigint: 0x08
11
- };
14
+ object: 0x07,
12
15
 
13
- // flags
14
- export const TYPE_FLAGS = {
15
- // iterable: 0b10000000,
16
- parity: 0b10000000,
17
- length: 0b01000000,
16
+ undefined: 0x00 | TYPE_FLAGS.parity,
18
17
  };
19
18
 
20
- // TYPES.string |= TYPE_FLAGS.iterable;
21
- TYPES.string |= TYPE_FLAGS.length;
22
-
23
- TYPES.undefined = TYPES.empty | TYPE_FLAGS.parity;
24
-
25
19
  export const TYPE_NAMES = {
26
20
  [TYPES.empty]: 'empty',
27
21
  [TYPES.number]: 'Number',
package/compiler/wrap.js CHANGED
@@ -379,7 +379,7 @@ export default (source, flags = [ 'module' ], customImports = {}, print = str =>
379
379
  }
380
380
  });
381
381
  } catch (e) {
382
- if (!process.argv.includes('-i')) throw e;
382
+ if (!Prefs.d) throw e;
383
383
  if (!(e instanceof WebAssembly.CompileError)) throw e;
384
384
 
385
385
  const funcInd = parseInt(e.message.match(/function #([0-9]+)/)?.[1]);
@@ -393,7 +393,7 @@ export default (source, flags = [ 'module' ], customImports = {}, print = str =>
393
393
  if (Prefs.profileCompiler) console.log(`instantiated in ${times[1].toFixed(2)}ms`);
394
394
 
395
395
  const exports = {};
396
- const rawValues = process.argv.includes('-i');
396
+ const rawValues = Prefs.d;
397
397
 
398
398
  const exceptTag = instance.exports['0'], memory = instance.exports['$'];
399
399
  for (const x in instance.exports) {
@@ -474,7 +474,7 @@ export default (source, flags = [ 'module' ], customImports = {}, print = str =>
474
474
  }
475
475
 
476
476
  if (e instanceof WebAssembly.RuntimeError) {
477
- if (!process.argv.includes('-i')) throw e;
477
+ if (!Prefs.d) throw e;
478
478
 
479
479
  const match = e.stack.match(/wasm-function\[([0-9]+)\]:([0-9a-z]+)/) ?? [];
480
480
  const funcInd = parseInt(match[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.20.5+5eec03d30",
4
+ "version": "0.20.7+2834584b7",
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.20.5+5eec03d30';
3
+ globalThis.version = '0.20.7+2834584b7';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {
@@ -147,7 +147,7 @@ try {
147
147
  } catch (e) {
148
148
  // if (cache) process.stdout.write(cache);
149
149
  let out = e;
150
- if (!process.argv.includes('-i') && Object.getPrototypeOf(e).message != null) out = `${e.constructor.name}${e.message != null ? `: ${e.message}` : ''}`;
150
+ if (!process.argv.includes('-d') && Object.getPrototypeOf(e).message != null) out = `${e.constructor.name}${e.message != null ? `: ${e.message}` : ''}`;
151
151
  console.error(out);
152
152
  }
153
153