@ai-ecoverse/slicc-kernel 1.102.2 → 1.102.4

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/dist/node.js CHANGED
@@ -7303,7 +7303,8 @@ var GEN = 0;
7303
7303
  var RING = 1;
7304
7304
  var RING_SIZE = 4096;
7305
7305
  var SLOT = 2;
7306
- var CHANGES_BYTES = (RING + RING_SIZE * SLOT) * 4;
7306
+ var DIRTY = RING + RING_SIZE * SLOT;
7307
+ var CHANGES_BYTES = (DIRTY + 1) * 4;
7307
7308
  function changeHash(path) {
7308
7309
  let h = 2166136261;
7309
7310
  for (let i = 0; i < path.length; i++) {
@@ -7328,6 +7329,9 @@ var FileChanges = class {
7328
7329
  this.sab = sab;
7329
7330
  this.view = new Int32Array(sab);
7330
7331
  }
7332
+ dirtied(delta) {
7333
+ Atomics.add(this.view, DIRTY, delta);
7334
+ }
7331
7335
  publish(...paths) {
7332
7336
  for (const path of paths) {
7333
7337
  const g = Atomics.add(this.view, GEN, 1) + 1 | 0;
@@ -11129,7 +11133,7 @@ var PATH_OPS = new Set(SYNC_FS_OPS);
11129
11133
  var EARLY_WHOLE_FILE = 64 * 1024;
11130
11134
 
11131
11135
  // src/version.ts
11132
- var KERNEL_VERSION = true ? "1.102.2" : "0.0.0-dev";
11136
+ var KERNEL_VERSION = true ? "1.102.4" : "0.0.0-dev";
11133
11137
  var OS_RELEASE = "6.0.0-slicc";
11134
11138
  function procVersion() {
11135
11139
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -14674,6 +14678,15 @@ var VfsNode = class {
14674
14678
  orphaned;
14675
14679
  id;
14676
14680
  onDirty;
14681
+ onDirtyState;
14682
+ counted = false;
14683
+ recount() {
14684
+ if (!this.onDirtyState) return;
14685
+ const on = this.dirty && !this.orphaned;
14686
+ if (on === this.counted) return;
14687
+ this.counted = on;
14688
+ this.onDirtyState?.(on);
14689
+ }
14677
14690
  constructor(fs, path, contents2, orphaned = false, dirty = false, pin) {
14678
14691
  this.fs = fs;
14679
14692
  this.pin = pin;
@@ -14823,6 +14836,7 @@ var VfsNode = class {
14823
14836
  }
14824
14837
  markDirty() {
14825
14838
  this.dirty = true;
14839
+ this.recount();
14826
14840
  if (!this.orphaned) this.onDirty?.();
14827
14841
  if (this.writeBack !== void 0 || this.orphaned) return;
14828
14842
  const delay = Math.max(WRITEBACK_MS, this.writeBackCost * WRITEBACK_COST_FACTOR);
@@ -14850,6 +14864,8 @@ var VfsNode = class {
14850
14864
  } catch (err) {
14851
14865
  this.dirty = true;
14852
14866
  throw err;
14867
+ } finally {
14868
+ this.recount();
14853
14869
  }
14854
14870
  this.writeBackCost = performance.now() - started;
14855
14871
  }
@@ -14860,6 +14876,7 @@ var VfsNodes = class {
14860
14876
  byId = /* @__PURE__ */ new Map();
14861
14877
  keepsOnDisk = false;
14862
14878
  changed;
14879
+ dirtied;
14863
14880
  fs;
14864
14881
  entries;
14865
14882
  onClosed;
@@ -14943,6 +14960,7 @@ var VfsNodes = class {
14943
14960
  }
14944
14961
  orphan(node) {
14945
14962
  node.orphaned = true;
14963
+ node.recount();
14946
14964
  this.forget(node);
14947
14965
  }
14948
14966
  dropName(path, node) {
@@ -14997,6 +15015,8 @@ var VfsNodes = class {
14997
15015
  create(path, id2, node) {
14998
15016
  this.reshaped();
14999
15017
  node.onDirty = () => this.changed?.(node.path);
15018
+ node.onDirtyState = (on) => this.dirtied?.(on ? 1 : -1);
15019
+ node.recount();
15000
15020
  this.byPath.set(path, node);
15001
15021
  if (id2 !== void 0) this.know(node, id2);
15002
15022
  return node;
@@ -22316,6 +22336,7 @@ var Launcher = class {
22316
22336
  }
22317
22337
  processChain(fs, nodes, unlinked) {
22318
22338
  nodes.changed = (path) => this.changes.publish(path);
22339
+ nodes.dirtied = (delta) => this.changes.dirtied(delta);
22319
22340
  return unlinked.wrap(keepingOpen(fs, nodes, (path) => this.changes.publish(path)));
22320
22341
  }
22321
22342
  async starting(argv, dir, account, tag) {