porffor 0.60.6 → 0.60.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.
package/compiler/2c.js CHANGED
@@ -429,6 +429,7 @@ export default ({ funcs, globals, data, pages }) => {
429
429
  for (const name in symbols) {
430
430
  line(`*(void**)(&${name}) = dlsym(_dl, "${name}")`);
431
431
  ffiFuncs[name] = symbols[name];
432
+ cified.add(name, true);
432
433
  }
433
434
 
434
435
  continue;
@@ -642,9 +643,13 @@ extern ${importFunc.returns.length > 0 ? CValtype[importFunc.returns[0]] : 'void
642
643
 
643
644
  case 'time': {
644
645
  const id = tmpId++;
645
- line(`time_t _time_t${id}`);
646
- line(`time(&_time_t${id})`);
647
- line(`f64 _time_out${id} = (f64)_time_t${id} * 1000.0`);
646
+ platformSpecific(`
647
+ time_t _time_t${id};
648
+ time(&_time_t${id});
649
+ f64 _time_out${id} = (f64)_time_t${id} * 1000.0;`, `
650
+ struct timespec _ts${id};
651
+ clock_gettime(CLOCK_REALTIME, &_ts${id});
652
+ f64 _time_out${id} = (f64)_ts${id}.tv_sec * 1000.0 + (f64)_ts${id}.tv_nsec / 1.0e6;`);
648
653
  vals.push(`_time_out${id}`);
649
654
 
650
655
  includes.set('time.h', true);
@@ -2638,7 +2638,8 @@ const generateCall = (scope, decl, _global, _name, unusedValue = false) => {
2638
2638
  args.push({
2639
2639
  type: 'ArrayExpression',
2640
2640
  elements: restArgs,
2641
- _doNotMarkTypeUsed: true
2641
+ _doNotMarkTypeUsed: true,
2642
+ _staticAlloc: func.internal
2642
2643
  });
2643
2644
  }
2644
2645
  }
@@ -5594,7 +5595,7 @@ const generateArray = (scope, decl, global = false, name = '$undeclared', static
5594
5595
  const out = [];
5595
5596
  let pointer;
5596
5597
 
5597
- if (staticAlloc) {
5598
+ if (staticAlloc || decl._staticAlloc) {
5598
5599
  const uniqueName = name === '$undeclared' ? name + uniqId() : name;
5599
5600
 
5600
5601
  const ptr = allocPage({ scope, pages }, uniqueName);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "porffor",
3
3
  "description": "An ahead-of-time JavaScript compiler",
4
- "version": "0.60.6",
4
+ "version": "0.60.7",
5
5
  "author": "Oliver Medhurst <honk@goose.icu>",
6
6
  "license": "MIT",
7
7
  "scripts": {},
package/runtime/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import fs from 'node:fs';
3
- globalThis.version = '0.60.6';
3
+ globalThis.version = '0.60.7';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {
File without changes