@ai-ecoverse/slicc-kernel 1.166.4 → 1.166.5

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.
@@ -7489,7 +7489,7 @@ var init_version = __esm({
7489
7489
  "src/version.ts"() {
7490
7490
  "use strict";
7491
7491
  init_captured_globals();
7492
- KERNEL_VERSION = true ? "1.166.4" : "0.0.0-dev";
7492
+ KERNEL_VERSION = true ? "1.166.5" : "0.0.0-dev";
7493
7493
  OS_RELEASE = "6.0.0-slicc";
7494
7494
  }
7495
7495
  });
@@ -10257,7 +10257,7 @@ function errnoOf(err) {
10257
10257
  const errno2 = err?.errno;
10258
10258
  return typeof errno2 === "number" ? errno2 : wasiErrno("EIO");
10259
10259
  }
10260
- function sizeOf(Fs, stream) {
10260
+ function sizeOf2(Fs, stream) {
10261
10261
  const st = Fs.fstat?.(stream.fd);
10262
10262
  return st?.size ?? 0;
10263
10263
  }
@@ -10288,7 +10288,7 @@ function refused2(kind, flags) {
10288
10288
  return kind === "write" && access === O_RDONLY || kind === "read" && access === O_WRONLY4;
10289
10289
  }
10290
10290
  function baseOf2(Fs, stream) {
10291
- return (whence) => whence === SEEK_CUR3 ? stream.position : whence === SEEK_END3 ? sizeOf(Fs, stream) : 0;
10291
+ return (whence) => whence === SEEK_CUR3 ? stream.position : whence === SEEK_END3 ? sizeOf2(Fs, stream) : 0;
10292
10292
  }
10293
10293
  function recordLock(fcntl, deps) {
10294
10294
  return (fd, cmd, varargs) => {
@@ -19146,7 +19146,7 @@ function fillMemory(memory, copy2) {
19146
19146
  if (pages2 > 0) memory.grow(pages2);
19147
19147
  new capturedUint8Array(memory.buffer).set(copy2);
19148
19148
  }
19149
- function sizeOf2(main) {
19149
+ function sizeOf3(main) {
19150
19150
  return () => main.memory?.buffer.byteLength ?? 0;
19151
19151
  }
19152
19152
  function memoryOf(instance, imported2) {
@@ -19375,7 +19375,7 @@ async function runWasiProcess(init, port3) {
19375
19375
  call: kernelCall,
19376
19376
  say,
19377
19377
  gate
19378
- } = kernelOf(init, port3, signals, sizeOf2(main));
19378
+ } = kernelOf(init, port3, signals, sizeOf3(main));
19379
19379
  const id = identify(transport, init);
19380
19380
  const stats = init.env.SLICC_WASI_STATS === "1" ? new WasiStats() : void 0;
19381
19381
  const call3 = stats ? timedCalls(stats, kernelCall) : kernelCall;
@@ -19437,7 +19437,7 @@ async function runWasiProcess(init, port3) {
19437
19437
  });
19438
19438
  restoreExportedMemory(instance, memory, init);
19439
19439
  main.memory = memoryOf(instance, memory);
19440
- publishMemory(init.sab, sizeOf2(main)());
19440
+ publishMemory(init.sab, sizeOf3(main)());
19441
19441
  port3.postMessage({ type: WASM_PROCESS_READY });
19442
19442
  signals.bind(instance.exports);
19443
19443
  if (importsSigactionHook(module2)) signals.useHook();
@@ -19862,6 +19862,17 @@ function programScript(name2, hash) {
19862
19862
  }
19863
19863
  var SOURCE_NAMES = 4096;
19864
19864
  var sourceNames = new capturedSet();
19865
+ var setDelete = capturedSet.prototype.delete;
19866
+ var setValues = capturedSet.prototype.values;
19867
+ var sizeOf = capturedObject.getOwnPropertyDescriptor(capturedSet.prototype, "size")?.get;
19868
+ var nextOf = capturedObject.getPrototypeOf(new capturedSet().values()).next;
19869
+ function noteName(name2) {
19870
+ if (apply(setDelete, sourceNames, [name2]) !== true && apply(sizeOf, sourceNames, []) >= SOURCE_NAMES) {
19871
+ const oldest = apply(nextOf, apply(setValues, sourceNames, []), []);
19872
+ apply(setDelete, sourceNames, [oldest.value]);
19873
+ }
19874
+ apply(setAdd, sourceNames, [name2]);
19875
+ }
19865
19876
  function programName(name2) {
19866
19877
  return apply(startsWith, name2, ["data:"]) === true || apply(setHas, programNames, [name2]) === true || apply(setHas, sourceNames, [name2]) === true;
19867
19878
  }
@@ -19873,7 +19884,7 @@ function noteSourceUrls(trace) {
19873
19884
  if (typeof origin !== "string" || evalAt(origin)) continue;
19874
19885
  const name2 = apply(nameOf, site, []);
19875
19886
  if (typeof name2 !== "string" || apply(setHas, ownNames, [name2]) === true) continue;
19876
- if (sourceNames.size < SOURCE_NAMES) apply(setAdd, sourceNames, [name2]);
19887
+ noteName(name2);
19877
19888
  }
19878
19889
  }
19879
19890
  function rootOrigin(origin) {