@ai-ecoverse/slicc-kernel 1.124.1 → 1.124.3

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.
@@ -1082,6 +1082,12 @@ var init_changes = __esm({
1082
1082
  function syncCallCount() {
1083
1083
  return calls;
1084
1084
  }
1085
+ function lookedOutside() {
1086
+ looks++;
1087
+ }
1088
+ function syncEpoch() {
1089
+ return calls + looks;
1090
+ }
1085
1091
  function createSyncSabTransport(sab, port2, deps = {}) {
1086
1092
  const views = sabViews(sab);
1087
1093
  const { header, window } = views;
@@ -1320,7 +1326,7 @@ function createSyncFsSabBridge(transport, opts = {}) {
1320
1326
  statfs: (path = "/") => parseSyncFsUsage(json2({ op: "statfs", path }, path))
1321
1327
  };
1322
1328
  }
1323
- var PATH_OPS, calls, SPIN_MS, SPIN_STRIDE, SPIN_STRIDES, SPIN_CORES, spinning, SPIN_CAP_MS;
1329
+ var PATH_OPS, calls, looks, SPIN_MS, SPIN_STRIDE, SPIN_STRIDES, SPIN_CORES, spinning, SPIN_CAP_MS;
1324
1330
  var init_sync_sab_bridge = __esm({
1325
1331
  "src/realm/sync-sab-bridge.ts"() {
1326
1332
  "use strict";
@@ -1330,6 +1336,7 @@ var init_sync_sab_bridge = __esm({
1330
1336
  init_sync_sab_wire();
1331
1337
  PATH_OPS = new Set(SYNC_FS_OPS);
1332
1338
  calls = 0;
1339
+ looks = 0;
1333
1340
  SPIN_MS = 0.06;
1334
1341
  SPIN_STRIDE = 128;
1335
1342
  SPIN_STRIDES = 256;
@@ -1485,6 +1492,10 @@ function linkedStates(bridgeOf) {
1485
1492
  const holder = (node) => opens.get(node.live) ?? node;
1486
1493
  return { opening: opening2, sharedWith, know, idOf: idOf4, holder };
1487
1494
  }
1495
+ function freshState(stat) {
1496
+ const base = { len: 0, loaded: false, dirty: false, openCount: 0 };
1497
+ return stat ? { stat, statAt: syncCallCount(), seenAt: syncEpoch(), ...base } : base;
1498
+ }
1488
1499
  function createHelpers(Fs, ops) {
1489
1500
  const bridgeOf = (node) => node.mount.opts.bridge;
1490
1501
  const fileIo = (node) => pinnedIo(bridgeOf(node), node.live.handle);
@@ -1524,10 +1535,6 @@ function createHelpers(Fs, ops) {
1524
1535
  if (err.errno !== wasiErrno("ENOSYS")) throw err;
1525
1536
  }
1526
1537
  }
1527
- function freshState(stat) {
1528
- const statAt = syncCallCount();
1529
- return { ...stat ? { stat, statAt } : {}, len: 0, loaded: false, dirty: false, openCount: 0 };
1530
- }
1531
1538
  function makeNode(parent, name2, st) {
1532
1539
  const node = Fs.createNode(parent, name2, modeFromStat(st, exactIn(parent)), 0);
1533
1540
  node.node_ops = ops.node;
@@ -1542,7 +1549,7 @@ function createHelpers(Fs, ops) {
1542
1549
  }
1543
1550
  if (!cachedStat(node.live, Fs.isDir(node.mode), bridgeOf(node).changes)) {
1544
1551
  const st = call2(() => bridgeOf(node).lstat(liveNodePath(linked.holder(node))));
1545
- Object.assign(node.live, { stat: st, statAt: syncCallCount() });
1552
+ Object.assign(node.live, { stat: st, statAt: syncCallCount(), seenAt: syncEpoch() });
1546
1553
  node.mode = modeFromStat(st, exactIn(node));
1547
1554
  }
1548
1555
  return node.live.stat;
@@ -2267,7 +2274,7 @@ function guardKeptNodes(Fs, handled) {
2267
2274
  }
2268
2275
  function outdated(node, view, before) {
2269
2276
  const s = node.live;
2270
- if (view.foreign() && s.openCount === 0 && !s.dirty && node !== node.mount.root && !node.mounted)
2277
+ if (view.foreign() && s.seenAt !== syncEpoch() && s.openCount === 0 && !s.dirty && node !== node.mount.root && !node.mounted)
2271
2278
  return true;
2272
2279
  if (s.named === void 0) {
2273
2280
  s.named = before;
@@ -2603,7 +2610,7 @@ var KERNEL_VERSION, OS_RELEASE;
2603
2610
  var init_version = __esm({
2604
2611
  "src/version.ts"() {
2605
2612
  "use strict";
2606
- KERNEL_VERSION = true ? "1.124.1" : "0.0.0-dev";
2613
+ KERNEL_VERSION = true ? "1.124.3" : "0.0.0-dev";
2607
2614
  OS_RELEASE = "6.0.0-slicc";
2608
2615
  }
2609
2616
  });
@@ -5583,7 +5590,11 @@ var init_procfs = __esm({
5583
5590
  osrelease: `${OS_RELEASE}
5584
5591
  `,
5585
5592
  ostype: "Linux\n",
5586
- slicc_wasm_memories: (listing) => `${listing.wasm?.live ?? 0} ${listing.wasm?.ceiling ?? 0}
5593
+ slicc_wasm_memories: (listing) => `${listing.wasm?.live ?? 0} ${listing.wasm?.ceiling ?? 0} ${listing.wasm?.source ?? "none"}
5594
+ `,
5595
+ slicc_shared_root: (listing) => `${listing.peers ?? 0}
5596
+ `,
5597
+ slicc_fs_calls: (listing) => `${listing.fsCalls ?? 0}
5587
5598
  `
5588
5599
  }
5589
5600
  };
@@ -6018,7 +6029,7 @@ async function runWasmProcess(init, port2, deps = {}) {
6018
6029
  ppid: () => identify(transport, init).ppid,
6019
6030
  poll: () => void signals.interrupt()
6020
6031
  });
6021
- return WebAssembly.instantiate(init.program.module, imports);
6032
+ return WebAssembly.instantiate(init.program.module, watchOutside(imports));
6022
6033
  }).then((instance) => {
6023
6034
  memory = wasmMemory(instance, imports);
6024
6035
  port2.postMessage({ type: WASM_PROCESS_READY });
@@ -6187,7 +6198,20 @@ function runMain(running, init) {
6187
6198
  return status2;
6188
6199
  }
6189
6200
  }
6190
- var FS_OPS, O_RDONLY2, O_WRONLY3, O_RDWR3, O_ACCMODE5, O_DIRECTORY2, accessMode, PLACED, GLUE_TRAILER, evaluateGlue, EVAL_BLOCKED;
6201
+ function watchOutside(imports) {
6202
+ for (const space of Object.values(imports)) {
6203
+ for (const [name2, value2] of Object.entries(space)) {
6204
+ if (!OUTSIDE.has(name2) || typeof value2 !== "function") continue;
6205
+ const look = value2;
6206
+ space[name2] = (...args) => {
6207
+ lookedOutside();
6208
+ return look(...args);
6209
+ };
6210
+ }
6211
+ }
6212
+ return imports;
6213
+ }
6214
+ var FS_OPS, O_RDONLY2, O_WRONLY3, O_RDWR3, O_ACCMODE5, O_DIRECTORY2, accessMode, PLACED, GLUE_TRAILER, evaluateGlue, EVAL_BLOCKED, OUTSIDE;
6191
6215
  var init_process_runtime = __esm({
6192
6216
  "src/process/process-runtime.ts"() {
6193
6217
  "use strict";
@@ -6294,6 +6318,13 @@ var init_process_runtime = __esm({
6294
6318
  run(module);
6295
6319
  };
6296
6320
  EVAL_BLOCKED = "the wasm realm evaluates the program's Emscripten glue, and this page's CSP forbids eval (no 'unsafe-eval')";
6321
+ OUTSIDE = /* @__PURE__ */ new Set([
6322
+ "clock_time_get",
6323
+ "emscripten_date_now",
6324
+ "emscripten_get_now",
6325
+ "random_get",
6326
+ "getentropy"
6327
+ ]);
6297
6328
  }
6298
6329
  });
6299
6330