porffor 0.55.31 → 0.55.32
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/bun.lock +36 -0
- package/compiler/2c.js +3 -4
- package/compiler/index.js +2 -5
- package/package.json +2 -2
- package/runner/index.js +1 -1
package/bun.lock
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
{
|
2
|
+
"lockfileVersion": 1,
|
3
|
+
"workspaces": {
|
4
|
+
"": {
|
5
|
+
"name": "porffor",
|
6
|
+
"dependencies": {
|
7
|
+
"acorn": "^8.14.0",
|
8
|
+
"node-repl-polyfill": "github:CanadaHonk/node-repl-polyfill",
|
9
|
+
},
|
10
|
+
"optionalDependencies": {
|
11
|
+
"@babel/parser": "^7.24.4",
|
12
|
+
"hermes-parser": "^0.18.2",
|
13
|
+
"meriyah": "^4.3.9",
|
14
|
+
},
|
15
|
+
},
|
16
|
+
},
|
17
|
+
"packages": {
|
18
|
+
"@babel/helper-string-parser": ["@babel/helper-string-parser@7.25.9", "", {}, "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA=="],
|
19
|
+
|
20
|
+
"@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.25.9", "", {}, "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ=="],
|
21
|
+
|
22
|
+
"@babel/parser": ["@babel/parser@7.26.9", "", { "dependencies": { "@babel/types": "^7.26.9" }, "bin": "./bin/babel-parser.js" }, "sha512-81NWa1njQblgZbQHxWHpxxCzNsa3ZwvFqpUg7P+NNUU6f3UU2jBEg4OlF/J6rl8+PQGh1q6/zWScd001YwcA5A=="],
|
23
|
+
|
24
|
+
"@babel/types": ["@babel/types@7.26.9", "", { "dependencies": { "@babel/helper-string-parser": "^7.25.9", "@babel/helper-validator-identifier": "^7.25.9" } }, "sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw=="],
|
25
|
+
|
26
|
+
"acorn": ["acorn@8.14.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA=="],
|
27
|
+
|
28
|
+
"hermes-estree": ["hermes-estree@0.18.2", "", {}, "sha512-KoLsoWXJ5o81nit1wSyEZnWUGy9cBna9iYMZBR7skKh7okYAYKqQ9/OczwpMHn/cH0hKDyblulGsJ7FknlfVxQ=="],
|
29
|
+
|
30
|
+
"hermes-parser": ["hermes-parser@0.18.2", "", { "dependencies": { "hermes-estree": "0.18.2" } }, "sha512-1eQfvib+VPpgBZ2zYKQhpuOjw1tH+Emuib6QmjkJWJMhyjM8xnXMvA+76o9LhF0zOAJDZgPfQhg43cyXEyl5Ew=="],
|
31
|
+
|
32
|
+
"meriyah": ["meriyah@4.5.0", "", {}, "sha512-Rbiu0QPIxTXgOXwiIpRVJfZRQ2FWyfzYrOGBs9SN5RbaXg1CN5ELn/plodwWwluX93yzc4qO/bNIen1ThGFCxw=="],
|
33
|
+
|
34
|
+
"node-repl-polyfill": ["node-repl-polyfill@github:CanadaHonk/node-repl-polyfill#8d8a080", {}, "CanadaHonk-node-repl-polyfill-8d8a080"],
|
35
|
+
}
|
36
|
+
}
|
package/compiler/2c.js
CHANGED
@@ -217,7 +217,7 @@ export default ({ funcs, globals, tags, data, exceptions, pages }) => {
|
|
217
217
|
|
218
218
|
if (pages.size > 0) {
|
219
219
|
includes.set('stdlib.h', true);
|
220
|
-
prepend.set('_memory', `char* _memory; u32 _memoryPages = ${pages.size};\n`);
|
220
|
+
prepend.set('_memory', `char* _memory; u32 _memoryPages = ${Math.ceil((pages.size * pageSize) / PageSize)};\n`);
|
221
221
|
prependMain.set('_initMemory', `_memory = malloc(_memoryPages * ${PageSize});\n`);
|
222
222
|
if (Prefs['2cMemcpy']) includes.set('string.h', true);
|
223
223
|
}
|
@@ -850,7 +850,7 @@ _time_out = _time.tv_nsec / 1000000. + _time.tv_sec * 1000.;`);
|
|
850
850
|
const id = localTmpId++;
|
851
851
|
line(`const u32 _oldPages${id} = _memoryPages`);
|
852
852
|
line(`_memoryPages += ${vals.pop()}`);
|
853
|
-
line(`_memory = realloc(_memory, _memoryPages * ${
|
853
|
+
line(`_memory = realloc(_memory, _memoryPages * ${PageSize})`);
|
854
854
|
vals.push(`_oldPages${id}`);
|
855
855
|
break;
|
856
856
|
}
|
@@ -860,7 +860,7 @@ _time_out = _time.tv_nsec / 1000000. + _time.tv_sec * 1000.;`);
|
|
860
860
|
const name = invOpcodes[i[0]];
|
861
861
|
const func = CMemFuncs[i[0]];
|
862
862
|
if (!prepend.has(name)) {
|
863
|
-
prepend.set(name,
|
863
|
+
prepend.set(name, `${func.returns || 'void'} ${name}(i32 align, i32 offset, ${func.args.map((x, i) => `${func.argTypes[i]} ${x}`).join(', ')}) {\n ${func.c.replaceAll('\n', '\n ')}\n}\n`);
|
864
864
|
}
|
865
865
|
|
866
866
|
const immediates = [ i[1], read_unsignedLEB128(i.slice(2)) ];
|
@@ -911,7 +911,6 @@ _time_out = _time.tv_nsec / 1000000. + _time.tv_sec * 1000.;`);
|
|
911
911
|
}
|
912
912
|
|
913
913
|
const shouldInline = false;
|
914
|
-
|
915
914
|
return `${!typedReturns ? (returns ? CValtype[f.returns[0]] : 'void') : 'struct ReturnValue'} ${shouldInline ? 'inline ' : ''}${ffiFuncs[f.name] ? '(*' : ''}${sanitize(f.name)}${ffiFuncs[f.name] ? ')' : ''}(${rawParams(f).map((x, i) => `${CValtype[x]} ${invLocals[i]}`).join(', ')});`;
|
916
915
|
}).join('\n'));
|
917
916
|
|
package/compiler/index.js
CHANGED
@@ -243,15 +243,12 @@ export default (code, module = undefined) => {
|
|
243
243
|
if (target === 'native') {
|
244
244
|
outFile ??= Prefs.native ? './porffor_tmp' : file.split('/').at(-1).split('.')[0];
|
245
245
|
|
246
|
-
|
246
|
+
const compiler = (Prefs.compiler ?? 'clang').split(' ');
|
247
247
|
const cO = Prefs._cO ?? 'O3';
|
248
248
|
|
249
|
-
if (compiler === 'zig') compiler = [ 'zig', 'cc' ];
|
250
|
-
else compiler = [ compiler ];
|
251
|
-
|
252
249
|
const tmpfile = 'porffor_tmp.c';
|
253
250
|
const args = [ ...compiler, tmpfile, '-o', outFile ?? (process.platform === 'win32' ? 'out.exe' : 'out'), '-' + cO ];
|
254
|
-
if (compiler.includes('clang')) args.push('-flto=thin', '-march=native', '-ffast-math', '-fno-exceptions', '-fno-ident', '-fno-asynchronous-unwind-tables', '-ffunction-sections', '-fdata-sections');
|
251
|
+
if (compiler.includes('clang')) args.push('-lm', '-flto=thin', '-march=native', '-ffast-math', '-fno-exceptions', '-fno-ident', '-fno-asynchronous-unwind-tables', '-ffunction-sections', '-fdata-sections');
|
255
252
|
if (Prefs.s) args.push('-s');
|
256
253
|
|
257
254
|
if (logProgress) progressStart('compiling Wasm to C...');
|
package/package.json
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
{
|
2
2
|
"name": "porffor",
|
3
3
|
"description": "An ahead-of-time JavaScript compiler",
|
4
|
-
"version": "0.55.
|
4
|
+
"version": "0.55.32",
|
5
5
|
"author": "Oliver Medhurst <honk@goose.icu>",
|
6
6
|
"license": "MIT",
|
7
7
|
"scripts": {},
|
8
8
|
"dependencies": {
|
9
9
|
"acorn": "^8.14.0",
|
10
|
-
"node-repl-polyfill": "
|
10
|
+
"node-repl-polyfill": "github:CanadaHonk/node-repl-polyfill"
|
11
11
|
},
|
12
12
|
"optionalDependencies": {
|
13
13
|
"@babel/parser": "^7.24.4",
|