@ai-ecoverse/slicc-kernel 1.102.3 → 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.
@@ -8273,7 +8273,8 @@ var GEN = 0;
8273
8273
  var RING = 1;
8274
8274
  var RING_SIZE = 4096;
8275
8275
  var SLOT = 2;
8276
- var CHANGES_BYTES = (RING + RING_SIZE * SLOT) * 4;
8276
+ var DIRTY = RING + RING_SIZE * SLOT;
8277
+ var CHANGES_BYTES = (DIRTY + 1) * 4;
8277
8278
  function changeHash(path) {
8278
8279
  let h = 2166136261;
8279
8280
  for (let i = 0; i < path.length; i++) {
@@ -8298,6 +8299,9 @@ var FileChanges = class {
8298
8299
  this.sab = sab;
8299
8300
  this.view = new Int32Array(sab);
8300
8301
  }
8302
+ dirtied(delta) {
8303
+ Atomics.add(this.view, DIRTY, delta);
8304
+ }
8301
8305
  publish(...paths) {
8302
8306
  for (const path of paths) {
8303
8307
  const g = Atomics.add(this.view, GEN, 1) + 1 | 0;
@@ -12136,7 +12140,7 @@ var PATH_OPS = new Set(SYNC_FS_OPS);
12136
12140
  var EARLY_WHOLE_FILE = 64 * 1024;
12137
12141
 
12138
12142
  // src/version.ts
12139
- var KERNEL_VERSION = true ? "1.102.3" : "0.0.0-dev";
12143
+ var KERNEL_VERSION = true ? "1.102.4" : "0.0.0-dev";
12140
12144
  var OS_RELEASE = "6.0.0-slicc";
12141
12145
  function procVersion() {
12142
12146
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -15017,6 +15021,15 @@ var VfsNode = class {
15017
15021
  orphaned;
15018
15022
  id;
15019
15023
  onDirty;
15024
+ onDirtyState;
15025
+ counted = false;
15026
+ recount() {
15027
+ if (!this.onDirtyState) return;
15028
+ const on = this.dirty && !this.orphaned;
15029
+ if (on === this.counted) return;
15030
+ this.counted = on;
15031
+ this.onDirtyState?.(on);
15032
+ }
15020
15033
  constructor(fs, path, contents2, orphaned = false, dirty = false, pin) {
15021
15034
  this.fs = fs;
15022
15035
  this.pin = pin;
@@ -15166,6 +15179,7 @@ var VfsNode = class {
15166
15179
  }
15167
15180
  markDirty() {
15168
15181
  this.dirty = true;
15182
+ this.recount();
15169
15183
  if (!this.orphaned) this.onDirty?.();
15170
15184
  if (this.writeBack !== void 0 || this.orphaned) return;
15171
15185
  const delay = Math.max(WRITEBACK_MS, this.writeBackCost * WRITEBACK_COST_FACTOR);
@@ -15193,6 +15207,8 @@ var VfsNode = class {
15193
15207
  } catch (err) {
15194
15208
  this.dirty = true;
15195
15209
  throw err;
15210
+ } finally {
15211
+ this.recount();
15196
15212
  }
15197
15213
  this.writeBackCost = performance.now() - started;
15198
15214
  }
@@ -15203,6 +15219,7 @@ var VfsNodes = class {
15203
15219
  byId = /* @__PURE__ */ new Map();
15204
15220
  keepsOnDisk = false;
15205
15221
  changed;
15222
+ dirtied;
15206
15223
  fs;
15207
15224
  entries;
15208
15225
  onClosed;
@@ -15286,6 +15303,7 @@ var VfsNodes = class {
15286
15303
  }
15287
15304
  orphan(node) {
15288
15305
  node.orphaned = true;
15306
+ node.recount();
15289
15307
  this.forget(node);
15290
15308
  }
15291
15309
  dropName(path, node) {
@@ -15340,6 +15358,8 @@ var VfsNodes = class {
15340
15358
  create(path, id2, node) {
15341
15359
  this.reshaped();
15342
15360
  node.onDirty = () => this.changed?.(node.path);
15361
+ node.onDirtyState = (on) => this.dirtied?.(on ? 1 : -1);
15362
+ node.recount();
15343
15363
  this.byPath.set(path, node);
15344
15364
  if (id2 !== void 0) this.know(node, id2);
15345
15365
  return node;
@@ -22556,6 +22576,7 @@ var Launcher = class {
22556
22576
  }
22557
22577
  processChain(fs, nodes, unlinked) {
22558
22578
  nodes.changed = (path) => this.changes.publish(path);
22579
+ nodes.dirtied = (delta) => this.changes.dirtied(delta);
22559
22580
  return unlinked.wrap(keepingOpen(fs, nodes, (path) => this.changes.publish(path)));
22560
22581
  }
22561
22582
  async starting(argv, dir, account, tag) {