@ai-ecoverse/slicc-kernel 1.107.0 → 1.107.1

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.
@@ -2491,7 +2491,7 @@ var KERNEL_VERSION, OS_RELEASE;
2491
2491
  var init_version = __esm({
2492
2492
  "src/version.ts"() {
2493
2493
  "use strict";
2494
- KERNEL_VERSION = true ? "1.107.0" : "0.0.0-dev";
2494
+ KERNEL_VERSION = true ? "1.107.1" : "0.0.0-dev";
2495
2495
  OS_RELEASE = "6.0.0-slicc";
2496
2496
  }
2497
2497
  });
@@ -6395,7 +6395,7 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
6395
6395
  symlink: (target, link) => mutating(() => bridge.symlink(target, link), ...entry(link)),
6396
6396
  chmod: (p, mode) => rewriting(p, () => bridge.chmod(p, mode)),
6397
6397
  utimes: (p, a, m, now2) => rewriting(p, () => bridge.utimes(p, a, m, now2)),
6398
- lutimes: (p, a, m, now2) => mutating(() => bridge.lutimes(p, a, m, now2), p),
6398
+ lutimes: (p, a, m, now2) => mutating(() => bridge.lutimes(p, a, m, now2)),
6399
6399
  ...bridge.hold ? { hold: bridge.hold.bind(bridge) } : {},
6400
6400
  ...bridge.access ? { access: bridge.access.bind(bridge) } : {},
6401
6401
  ...bridge.kept ? { kept: bridge.kept.bind(bridge) } : {},
@@ -6436,7 +6436,7 @@ function pinnedIo2(bridge, handle, rewriting) {
6436
6436
  } : {}
6437
6437
  };
6438
6438
  }
6439
- var WasiError, FileBuffer, LocalFile, MAX_LINKS, MISS_TTL_MS, FS_GEN, CRED_GEN, RING2, RING_SIZE2, SLOT2, SHARED_IDS_BYTES, StatCache;
6439
+ var WasiError, FileBuffer, LocalFile, MAX_LINKS, MISS_TTL_MS, CACHE_CAP, FS_GEN, CRED_GEN, RING2, RING_SIZE2, SLOT2, SHARED_IDS_BYTES, StatCache;
6440
6440
  var init_wasi_files = __esm({
6441
6441
  "src/process/wasi/wasi-files.ts"() {
6442
6442
  "use strict";
@@ -6657,6 +6657,7 @@ var init_wasi_files = __esm({
6657
6657
  };
6658
6658
  MAX_LINKS = 40;
6659
6659
  MISS_TTL_MS = 20;
6660
+ CACHE_CAP = 8192;
6660
6661
  FS_GEN = 4;
6661
6662
  CRED_GEN = 5;
6662
6663
  RING2 = 8;
@@ -6668,6 +6669,7 @@ var init_wasi_files = __esm({
6668
6669
  lstats = /* @__PURE__ */ new Map();
6669
6670
  byHash = /* @__PURE__ */ new Map();
6670
6671
  byIno = /* @__PURE__ */ new Map();
6672
+ missed = /* @__PURE__ */ new Map();
6671
6673
  shared;
6672
6674
  seen;
6673
6675
  constructor(shared) {
@@ -6675,7 +6677,14 @@ var init_wasi_files = __esm({
6675
6677
  this.seen = shared ? Atomics.load(shared, FS_GEN) : 0;
6676
6678
  }
6677
6679
  put(map, path, entry) {
6680
+ if (this.stats.size + this.lstats.size + this.byHash.size + this.byIno.size >= CACHE_CAP)
6681
+ this.clear();
6678
6682
  map.set(path, entry);
6683
+ if ("until" in entry) {
6684
+ const paths = this.missed.get(map) ?? /* @__PURE__ */ new Set();
6685
+ paths.add(path);
6686
+ this.missed.set(map, paths);
6687
+ }
6679
6688
  if (!this.shared) return;
6680
6689
  index(this.byHash, pathHash(path), path);
6681
6690
  const ino = inoKey(entry);
@@ -6702,12 +6711,21 @@ var init_wasi_files = __esm({
6702
6711
  this.lstats.delete(path);
6703
6712
  }
6704
6713
  mutated(paths, ino = 0) {
6705
- this.clear();
6706
- if (!this.shared) return;
6707
6714
  const key = ino % 4294967296 | 0;
6715
+ if (paths.length === 0 || !this.shared) this.clear();
6716
+ if (!this.shared) return;
6708
6717
  for (const [i, hash] of (paths.length > 0 ? paths.map(pathHash) : [0]).entries()) {
6709
- this.seen = this.publish(this.shared, hash, i === 0 ? key : 0);
6718
+ const g = this.publish(this.shared, hash, i === 0 ? key : 0);
6719
+ if (paths.length > 0) this.replay(g - 1);
6720
+ this.seen = g;
6710
6721
  }
6722
+ if (paths.length === 0) return;
6723
+ for (const [i, path] of paths.entries()) {
6724
+ this.stats.delete(path);
6725
+ this.lstats.delete(path);
6726
+ this.drop(pathHash(path), i === 0 ? key : 0);
6727
+ }
6728
+ this.forgetMisses();
6711
6729
  }
6712
6730
  inoOf(path, look) {
6713
6731
  if (!this.shared) return 0;
@@ -6755,7 +6773,14 @@ var init_wasi_files = __esm({
6755
6773
  this.byHash.delete(hash);
6756
6774
  if (ino !== 0) this.byIno.delete(ino);
6757
6775
  }
6776
+ forgetMisses() {
6777
+ for (const [map, paths] of this.missed) {
6778
+ for (const path of paths) if ("until" in (map.get(path) ?? {})) map.delete(path);
6779
+ }
6780
+ this.missed.clear();
6781
+ }
6758
6782
  clear() {
6783
+ this.missed.clear();
6759
6784
  this.stats.clear();
6760
6785
  this.lstats.clear();
6761
6786
  this.byHash.clear();