@ai-ecoverse/slicc-kernel 1.124.9 → 1.124.10

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.
@@ -2624,7 +2624,7 @@ var KERNEL_VERSION, OS_RELEASE;
2624
2624
  var init_version = __esm({
2625
2625
  "src/version.ts"() {
2626
2626
  "use strict";
2627
- KERNEL_VERSION = true ? "1.124.9" : "0.0.0-dev";
2627
+ KERNEL_VERSION = true ? "1.124.10" : "0.0.0-dev";
2628
2628
  OS_RELEASE = "6.0.0-slicc";
2629
2629
  }
2630
2630
  });
@@ -6589,7 +6589,7 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
6589
6589
  const { stats, lstats } = cache;
6590
6590
  const view = bridge.changes;
6591
6591
  const live = (miss, path) => miss.until > now() && (view === void 0 || miss.gen === void 0 || !view.changedSince(miss.gen, path).changed);
6592
- const seenAt = /* @__PURE__ */ new Map();
6592
+ const seen = new SeenAt(view, lstats);
6593
6593
  const gone = (path) => {
6594
6594
  for (let at = path.lastIndexOf("/"); at > 0; at = path.lastIndexOf("/", at - 1)) {
6595
6595
  const up = path.slice(0, at);
@@ -6605,13 +6605,14 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
6605
6605
  if (blind || view?.foreign()) return get();
6606
6606
  cache.fresh();
6607
6607
  let hit = map.get(path);
6608
+ if (hit !== void 0 && !("until" in hit) && seen.changed(map, path)) hit = void 0;
6608
6609
  if (hit === void 0 || "until" in hit && !live(hit, path)) {
6609
6610
  const missing2 = gone(path);
6610
6611
  if (missing2) throw missing2.error;
6611
6612
  const gen = view?.now();
6612
6613
  try {
6613
6614
  hit = get();
6614
- if (gen !== void 0 && map === lstats) seenAt.set(path, gen);
6615
+ if (gen !== void 0) seen.saw(map, path, gen);
6615
6616
  } catch (e) {
6616
6617
  hit = {
6617
6618
  error: e,
@@ -6664,18 +6665,23 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
6664
6665
  readFile: (p) => bridge.readFile(p),
6665
6666
  readdir: (p) => bridge.readdir(p),
6666
6667
  readdirStat: (p) => {
6668
+ const gen = view?.now();
6667
6669
  const list = bridge.readdirStat(p);
6668
6670
  const base = p === "/" ? "" : p;
6669
6671
  for (const [name2, st] of list) {
6670
6672
  if (!st || blind) continue;
6671
- cache.put(lstats, `${base}/${name2}`, st);
6672
- if (!st.isSymbolicLink) cache.put(stats, `${base}/${name2}`, st);
6673
+ const at = `${base}/${name2}`;
6674
+ cache.put(lstats, at, st);
6675
+ if (gen !== void 0) seen.saw(lstats, at, gen);
6676
+ if (st.isSymbolicLink) continue;
6677
+ cache.put(stats, at, st);
6678
+ if (gen !== void 0) seen.saw(stats, at, gen);
6673
6679
  }
6674
6680
  return list;
6675
6681
  },
6676
6682
  readlink: (p) => {
6677
6683
  const known = blind ? void 0 : (cache.fresh(), lstats.get(p));
6678
- const gen = seenAt.get(p);
6684
+ const gen = seen.lstat(p);
6679
6685
  const current = view !== void 0 && gen !== void 0 && !view.changedSince(gen, p).changed;
6680
6686
  if (known && current && !("until" in known) && !known.isSymbolicLink) {
6681
6687
  throw syncError("EINVAL", `'${p}' is not a symbolic link`);
@@ -6746,7 +6752,7 @@ function pinnedIo2(bridge, handle, rewriting) {
6746
6752
  } : {}
6747
6753
  };
6748
6754
  }
6749
- var WasiError, FileBuffer, LocalFile, MAX_LINKS, MISS_TTL_MS, CACHE_CAP, FS_GEN, CRED_GEN, RING2, RING_SIZE2, SLOT2, FD_RING, FD_RING_SIZE, SHARED_IDS_BYTES, StatCache;
6755
+ var WasiError, FileBuffer, LocalFile, MAX_LINKS, MISS_TTL_MS, CACHE_CAP, FS_GEN, CRED_GEN, RING2, RING_SIZE2, SLOT2, FD_RING, FD_RING_SIZE, SHARED_IDS_BYTES, StatCache, SEEN_CAP, SeenAt;
6750
6756
  var init_wasi_files = __esm({
6751
6757
  "src/process/wasi/wasi-files.ts"() {
6752
6758
  "use strict";
@@ -7105,6 +7111,37 @@ var init_wasi_files = __esm({
7105
7111
  this.byIno.clear();
7106
7112
  }
7107
7113
  };
7114
+ SEEN_CAP = 4096;
7115
+ SeenAt = class {
7116
+ view;
7117
+ lstats;
7118
+ links = /* @__PURE__ */ new Map();
7119
+ stats = /* @__PURE__ */ new Map();
7120
+ constructor(view, lstats) {
7121
+ this.view = view;
7122
+ this.lstats = lstats;
7123
+ }
7124
+ of(map) {
7125
+ return map === this.lstats ? this.links : this.stats;
7126
+ }
7127
+ lstat(path) {
7128
+ return this.links.get(path);
7129
+ }
7130
+ saw(map, path, gen) {
7131
+ const seen = this.of(map);
7132
+ if (seen.size >= SEEN_CAP) seen.clear();
7133
+ seen.set(path, gen);
7134
+ }
7135
+ changed(map, path) {
7136
+ if (this.view === void 0) return false;
7137
+ const seen = this.of(map);
7138
+ const gen = seen.get(path);
7139
+ if (gen === void 0) return true;
7140
+ const since = this.view.changedSince(gen, path);
7141
+ if (!since.changed) seen.set(path, since.now);
7142
+ return since.changed;
7143
+ }
7144
+ };
7108
7145
  }
7109
7146
  });
7110
7147