@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.
@@ -846,7 +846,7 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
846
846
  symlink: (target, link) => mutating(() => bridge.symlink(target, link), ...entry(link)),
847
847
  chmod: (p, mode) => rewriting(p, () => bridge.chmod(p, mode)),
848
848
  utimes: (p, a, m, now2) => rewriting(p, () => bridge.utimes(p, a, m, now2)),
849
- lutimes: (p, a, m, now2) => mutating(() => bridge.lutimes(p, a, m, now2), p),
849
+ lutimes: (p, a, m, now2) => mutating(() => bridge.lutimes(p, a, m, now2)),
850
850
  ...bridge.hold ? { hold: bridge.hold.bind(bridge) } : {},
851
851
  ...bridge.access ? { access: bridge.access.bind(bridge) } : {},
852
852
  ...bridge.kept ? { kept: bridge.kept.bind(bridge) } : {},
@@ -887,7 +887,7 @@ function pinnedIo(bridge, handle, rewriting) {
887
887
  } : {}
888
888
  };
889
889
  }
890
- var WasiError, FileBuffer, LocalFile, MAX_LINKS, MISS_TTL_MS, FS_GEN, CRED_GEN, RING, RING_SIZE, SLOT, SHARED_IDS_BYTES, StatCache;
890
+ var WasiError, FileBuffer, LocalFile, MAX_LINKS, MISS_TTL_MS, CACHE_CAP, FS_GEN, CRED_GEN, RING, RING_SIZE, SLOT, SHARED_IDS_BYTES, StatCache;
891
891
  var init_wasi_files = __esm({
892
892
  "src/process/wasi/wasi-files.ts"() {
893
893
  "use strict";
@@ -1108,6 +1108,7 @@ var init_wasi_files = __esm({
1108
1108
  };
1109
1109
  MAX_LINKS = 40;
1110
1110
  MISS_TTL_MS = 20;
1111
+ CACHE_CAP = 8192;
1111
1112
  FS_GEN = 4;
1112
1113
  CRED_GEN = 5;
1113
1114
  RING = 8;
@@ -1119,6 +1120,7 @@ var init_wasi_files = __esm({
1119
1120
  lstats = /* @__PURE__ */ new Map();
1120
1121
  byHash = /* @__PURE__ */ new Map();
1121
1122
  byIno = /* @__PURE__ */ new Map();
1123
+ missed = /* @__PURE__ */ new Map();
1122
1124
  shared;
1123
1125
  seen;
1124
1126
  constructor(shared) {
@@ -1126,7 +1128,14 @@ var init_wasi_files = __esm({
1126
1128
  this.seen = shared ? Atomics.load(shared, FS_GEN) : 0;
1127
1129
  }
1128
1130
  put(map, path, entry) {
1131
+ if (this.stats.size + this.lstats.size + this.byHash.size + this.byIno.size >= CACHE_CAP)
1132
+ this.clear();
1129
1133
  map.set(path, entry);
1134
+ if ("until" in entry) {
1135
+ const paths = this.missed.get(map) ?? /* @__PURE__ */ new Set();
1136
+ paths.add(path);
1137
+ this.missed.set(map, paths);
1138
+ }
1130
1139
  if (!this.shared) return;
1131
1140
  index(this.byHash, pathHash(path), path);
1132
1141
  const ino = inoKey(entry);
@@ -1153,12 +1162,21 @@ var init_wasi_files = __esm({
1153
1162
  this.lstats.delete(path);
1154
1163
  }
1155
1164
  mutated(paths, ino = 0) {
1156
- this.clear();
1157
- if (!this.shared) return;
1158
1165
  const key = ino % 4294967296 | 0;
1166
+ if (paths.length === 0 || !this.shared) this.clear();
1167
+ if (!this.shared) return;
1159
1168
  for (const [i, hash] of (paths.length > 0 ? paths.map(pathHash) : [0]).entries()) {
1160
- this.seen = this.publish(this.shared, hash, i === 0 ? key : 0);
1169
+ const g = this.publish(this.shared, hash, i === 0 ? key : 0);
1170
+ if (paths.length > 0) this.replay(g - 1);
1171
+ this.seen = g;
1161
1172
  }
1173
+ if (paths.length === 0) return;
1174
+ for (const [i, path] of paths.entries()) {
1175
+ this.stats.delete(path);
1176
+ this.lstats.delete(path);
1177
+ this.drop(pathHash(path), i === 0 ? key : 0);
1178
+ }
1179
+ this.forgetMisses();
1162
1180
  }
1163
1181
  inoOf(path, look) {
1164
1182
  if (!this.shared) return 0;
@@ -1206,7 +1224,14 @@ var init_wasi_files = __esm({
1206
1224
  this.byHash.delete(hash);
1207
1225
  if (ino !== 0) this.byIno.delete(ino);
1208
1226
  }
1227
+ forgetMisses() {
1228
+ for (const [map, paths] of this.missed) {
1229
+ for (const path of paths) if ("until" in (map.get(path) ?? {})) map.delete(path);
1230
+ }
1231
+ this.missed.clear();
1232
+ }
1209
1233
  clear() {
1234
+ this.missed.clear();
1210
1235
  this.stats.clear();
1211
1236
  this.lstats.clear();
1212
1237
  this.byHash.clear();
@@ -5006,7 +5031,7 @@ var KERNEL_VERSION, OS_RELEASE;
5006
5031
  var init_version = __esm({
5007
5032
  "src/version.ts"() {
5008
5033
  "use strict";
5009
- KERNEL_VERSION = true ? "1.107.0" : "0.0.0-dev";
5034
+ KERNEL_VERSION = true ? "1.107.1" : "0.0.0-dev";
5010
5035
  OS_RELEASE = "6.0.0-slicc";
5011
5036
  }
5012
5037
  });