@ai-ecoverse/slicc-kernel 1.189.0 → 1.189.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.
@@ -9071,7 +9071,7 @@ function satisfies(version, range2) {
9071
9071
  }
9072
9072
 
9073
9073
  // src/version.ts
9074
- var KERNEL_VERSION = true ? "1.189.0" : "0.0.0-dev";
9074
+ var KERNEL_VERSION = true ? "1.189.1" : "0.0.0-dev";
9075
9075
  var OS_RELEASE = "6.0.0-slicc";
9076
9076
  function procVersion() {
9077
9077
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -15535,6 +15535,35 @@ function statOf2(attr2, path, mount) {
15535
15535
  } : {}
15536
15536
  };
15537
15537
  }
15538
+ var Gathered = class {
15539
+ bytes = new Uint8Array(0);
15540
+ owned = false;
15541
+ size;
15542
+ length = 0;
15543
+ constructor(size) {
15544
+ this.size = size;
15545
+ }
15546
+ add(chunk2) {
15547
+ const need2 = this.length + chunk2.length;
15548
+ if (this.length === 0) {
15549
+ this.bytes = chunk2;
15550
+ } else {
15551
+ if (!this.owned || this.bytes.length < need2) {
15552
+ const grown = new Uint8Array(
15553
+ Math.max(this.size, need2, this.owned ? this.bytes.length * 2 : 0)
15554
+ );
15555
+ grown.set(this.bytes.subarray(0, this.length));
15556
+ this.bytes = grown;
15557
+ this.owned = true;
15558
+ }
15559
+ this.bytes.set(chunk2, this.length);
15560
+ }
15561
+ this.length = need2;
15562
+ }
15563
+ get whole() {
15564
+ return this.length === this.bytes.length ? this.bytes : this.bytes.subarray(0, this.length);
15565
+ }
15566
+ };
15538
15567
  function concat4(chunks, total) {
15539
15568
  if (chunks.length === 1 && chunks[0]?.length === total) return chunks[0];
15540
15569
  const out = new Uint8Array(total);
@@ -16027,25 +16056,23 @@ var MountFs = class _MountFs {
16027
16056
  }
16028
16057
  const fh = await this.open(mount, rel2, false);
16029
16058
  const chunk2 = mount.caps.maxIo ?? DEFAULT_IO;
16030
- const chunks = [];
16031
- let total = 0;
16059
+ const out = new Gathered(attr2.size);
16032
16060
  try {
16033
16061
  for (; ; ) {
16034
16062
  const bytes = await mount.conn.call({
16035
16063
  op: "read",
16036
16064
  fh,
16037
- offset: total,
16065
+ offset: out.length,
16038
16066
  size: chunk2
16039
16067
  });
16040
16068
  if (bytes.length === 0) break;
16041
- chunks.push(bytes);
16042
- total += bytes.length;
16043
- if (bytes.length < chunk2 && total >= attr2.size) break;
16069
+ out.add(bytes);
16070
+ if (bytes.length < chunk2 && out.length >= attr2.size) break;
16044
16071
  }
16045
16072
  } finally {
16046
16073
  await mount.conn.call({ op: "release", fh });
16047
16074
  }
16048
- return concat4(chunks, total);
16075
+ return out.whole;
16049
16076
  }
16050
16077
  async writeFile(path, content, owner, redirects = 0) {
16051
16078
  const real = await this.follow(path, 0, true);
@@ -36393,7 +36420,7 @@ var Launcher = class {
36393
36420
  const foreign = foreignImports(bytes);
36394
36421
  const libc = libcVersionOf(bytes);
36395
36422
  const named = customSectionsOf(bytes, "name").length > 0;
36396
- const compiled = this.compile ? await this.compile(bytes, key) : await WebAssembly.compile(bytes);
36423
+ const compiled = this.compile ? await this.compile(bytes, key, this.sourceOf(path)) : await WebAssembly.compile(bytes);
36397
36424
  if (libc !== void 0) this.libcs.set(compiled, libc);
36398
36425
  return {
36399
36426
  value: { module: compiled, ...memory ? { memory } : {}, foreign, named },
@@ -36505,10 +36532,20 @@ var Launcher = class {
36505
36532
  );
36506
36533
  }
36507
36534
  reread(target, read) {
36535
+ this.forgetCompiled(target.wasm);
36536
+ return read();
36537
+ }
36538
+ forgetCompiled(path) {
36508
36539
  for (const key of this.compiled.keys()) {
36509
- if (key.startsWith(`${target.wasm}:`)) this.compiled.delete(key);
36540
+ if (key.startsWith(`${path}:`) || key.startsWith(`${path}\0`)) this.compiled.delete(key);
36510
36541
  }
36511
- return read();
36542
+ }
36543
+ sourceOf(path) {
36544
+ return {
36545
+ path,
36546
+ read: () => this.base.readFileBuffer(path),
36547
+ stale: () => this.forgetCompiled(path)
36548
+ };
36512
36549
  }
36513
36550
  exeId(target) {
36514
36551
  if (target.abi !== "wasi" || (target.copy ?? target.glue) !== target.wasm) {