porffor 0.58.2 → 0.58.3
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 +3 -2
- package/compiler/index.js +17 -9
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/runtime/index.js +1 -1
package/compiler/codegen.js
CHANGED
@@ -1760,7 +1760,7 @@ const getNodeType = (scope, node) => {
|
|
1760
1760
|
const out = typeof ret === 'number' ? [ number(ret, Valtype.i32) ] : ret;
|
1761
1761
|
if (guess != null) out.guess = typeof guess === 'number' ? [ number(guess, Valtype.i32) ] : guess;
|
1762
1762
|
|
1763
|
-
typeUsed(scope, knownType(scope, out));
|
1763
|
+
if (!node._doNotMarkTypeUsed) typeUsed(scope, knownType(scope, out));
|
1764
1764
|
return out;
|
1765
1765
|
};
|
1766
1766
|
|
@@ -2595,7 +2595,8 @@ const generateCall = (scope, decl, _global, _name, unusedValue = false) => {
|
|
2595
2595
|
args = args.slice(0, paramCount - 1);
|
2596
2596
|
args.push({
|
2597
2597
|
type: 'ArrayExpression',
|
2598
|
-
elements: restArgs
|
2598
|
+
elements: restArgs,
|
2599
|
+
_doNotMarkTypeUsed: true
|
2599
2600
|
});
|
2600
2601
|
}
|
2601
2602
|
}
|
package/compiler/index.js
CHANGED
@@ -253,11 +253,19 @@ export default (code, module = undefined) => {
|
|
253
253
|
const compiler = (Prefs.compiler ?? process.env.CC ?? 'cc').split(' ');
|
254
254
|
const cO = Prefs._cO ?? 'O3';
|
255
255
|
|
256
|
-
const
|
257
|
-
|
256
|
+
const args = [
|
257
|
+
...compiler,
|
258
|
+
'-xc', '-', // use stdin as c source in
|
259
|
+
'-o', outFile ?? (process.platform === 'win32' ? 'out.exe' : 'out'), // set path for output
|
258
260
|
|
259
|
-
|
260
|
-
|
261
|
+
// default cc args, always
|
262
|
+
'-lm', // link math.h
|
263
|
+
'-fno-exceptions', // disable exceptions
|
264
|
+
'-fno-ident', '-ffunction-sections', '-fdata-sections', // remove unneeded binary sections
|
265
|
+
'-' + cO
|
266
|
+
];
|
267
|
+
|
268
|
+
if (Prefs.clangFast) args.push('-flto=thin', '-march=native', '-ffast-math', '-fno-asynchronous-unwind-tables');
|
261
269
|
|
262
270
|
if (Prefs.s) args.push('-s');
|
263
271
|
|
@@ -269,12 +277,12 @@ export default (code, module = undefined) => {
|
|
269
277
|
if (logProgress) progressStart(`compiling C to native (using ${compiler})...`);
|
270
278
|
const t5 = performance.now();
|
271
279
|
|
272
|
-
fs.writeFileSync(tmpfile, c);
|
273
|
-
|
274
280
|
// obvious command escape is obvious
|
275
|
-
execSync(args.join(' '), {
|
276
|
-
|
277
|
-
|
281
|
+
execSync(args.join(' '), {
|
282
|
+
stdio: [ 'pipe', 'inherit', 'inherit' ],
|
283
|
+
input: c,
|
284
|
+
encoding: 'utf8'
|
285
|
+
});
|
278
286
|
|
279
287
|
if (logProgress) progressStart(`compiled C to native (using ${compiler})`, t5);
|
280
288
|
|
package/jsr.json
CHANGED
package/package.json
CHANGED