@ai-ecoverse/slicc-kernel 1.102.2 → 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.
@@ -1018,7 +1018,7 @@ function normal(path) {
1018
1018
  }
1019
1019
  return `/${parts.join("/")}`;
1020
1020
  }
1021
- var GEN, RING, RING_SIZE, SLOT, CHANGES_BYTES, ChangeView;
1021
+ var GEN, RING, RING_SIZE, SLOT, DIRTY, CHANGES_BYTES, ChangeView;
1022
1022
  var init_changes = __esm({
1023
1023
  "src/fs/changes.ts"() {
1024
1024
  "use strict";
@@ -1026,7 +1026,8 @@ var init_changes = __esm({
1026
1026
  RING = 1;
1027
1027
  RING_SIZE = 4096;
1028
1028
  SLOT = 2;
1029
- CHANGES_BYTES = (RING + RING_SIZE * SLOT) * 4;
1029
+ DIRTY = RING + RING_SIZE * SLOT;
1030
+ CHANGES_BYTES = (DIRTY + 1) * 4;
1030
1031
  ChangeView = class {
1031
1032
  view;
1032
1033
  constructor(sab) {
@@ -1035,6 +1036,9 @@ var init_changes = __esm({
1035
1036
  now() {
1036
1037
  return Atomics.load(this.view, GEN);
1037
1038
  }
1039
+ clean() {
1040
+ return this.view.length > DIRTY && Atomics.load(this.view, DIRTY) === 0;
1041
+ }
1038
1042
  changedSince(seen, path) {
1039
1043
  const now = Atomics.load(this.view, GEN);
1040
1044
  const distance = now - seen >>> 0;
@@ -2480,7 +2484,7 @@ var KERNEL_VERSION, OS_RELEASE;
2480
2484
  var init_version = __esm({
2481
2485
  "src/version.ts"() {
2482
2486
  "use strict";
2483
- KERNEL_VERSION = true ? "1.102.2" : "0.0.0-dev";
2487
+ KERNEL_VERSION = true ? "1.102.4" : "0.0.0-dev";
2484
2488
  OS_RELEASE = "6.0.0-slicc";
2485
2489
  }
2486
2490
  });
@@ -7398,7 +7402,7 @@ var init_wasi_fds = __esm({
7398
7402
  }
7399
7403
  flushPath(path) {
7400
7404
  for (const [p, buffer] of this.buffers) if (within(p, path)) buffer.flush();
7401
- if (this.shared) this.kernel.call({ op: "fd-path-flush", path });
7405
+ if (this.shared && !this.fs.changes?.clean()) this.kernel.call({ op: "fd-path-flush", path });
7402
7406
  }
7403
7407
  holdsUnder(path) {
7404
7408
  for (const p of this.buffers.keys()) if (within(p, path)) return true;
@@ -12438,7 +12442,7 @@ async function instantiate(host, module, memory, threads, {
12438
12442
  return { instance, driver, linkedStack: sync?.linker.stackPointer };
12439
12443
  }
12440
12444
  function bindLinker(host, sync, instance, at) {
12441
- sync.linker.bindMain(instance, !at.thread);
12445
+ sync.linker.bindMain(instance, !at.thread && !at.forked);
12442
12446
  if (at.path !== void 0) sync.linker.mainPath = at.path;
12443
12447
  host.linkedTls = () => sync.linker.tlsBases();
12444
12448
  host.linkedModules = () => sync.linker.compiled();