@ai-ecoverse/slicc-kernel 1.49.0 → 1.49.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.
@@ -9262,7 +9262,7 @@ var init_wasix_linker = __esm({
9262
9262
  slots = /* @__PURE__ */ new Map();
9263
9263
  nextHandle = 1;
9264
9264
  publisher;
9265
- closures;
9265
+ indices;
9266
9266
  types = new FuncTypes();
9267
9267
  memory;
9268
9268
  host;
@@ -9348,21 +9348,26 @@ var init_wasix_linker = __esm({
9348
9348
  return out;
9349
9349
  }
9350
9350
  allocateClosure() {
9351
- const index2 = this.closures.allocate(
9352
- this.table.length
9353
- );
9351
+ const index2 = this.indices.allocate(this.table.length);
9354
9352
  growTable(this.table, index2 + 1);
9355
9353
  return index2;
9356
9354
  }
9357
9355
  freeClosure(index2) {
9358
- this.closures?.free(index2);
9356
+ this.indices?.free(index2);
9359
9357
  this.table.set(index2, null);
9360
9358
  }
9359
+ reserve(size) {
9360
+ return this.indices?.reserve(this.table.length, size) ?? this.table.length;
9361
+ }
9361
9362
  replay(record) {
9362
9363
  if (record.kind === "closure") {
9363
9364
  growTable(this.table, record.index + 1);
9364
9365
  return;
9365
9366
  }
9367
+ if (record.kind === "closure-free") {
9368
+ if (record.index < this.table.length) this.table.set(record.index, null);
9369
+ return;
9370
+ }
9366
9371
  if (record.kind === "load") {
9367
9372
  if (this.modules.has(record.handle)) return;
9368
9373
  this.instantiate(record.path, this.moduleAt(record.path), record, false);
@@ -9415,7 +9420,7 @@ var init_wasix_linker = __esm({
9415
9420
  (n) => this.load(this.locate(n, cwd, search), cwd, ldPath).handle
9416
9421
  );
9417
9422
  const memoryBase = this.allocate(info.memorySize, 2 ** info.memoryAlign);
9418
- const tableBase = this.table.length;
9423
+ const tableBase = this.reserve(info.tableSize);
9419
9424
  const record = {
9420
9425
  kind: "load",
9421
9426
  handle: this.nextHandle++,
@@ -9539,8 +9544,8 @@ var init_wasix_linker = __esm({
9539
9544
  slot(fn, handle, name) {
9540
9545
  const known = this.slots.get(fn);
9541
9546
  if (known !== void 0) return known;
9542
- const index2 = this.table.length;
9543
- this.table.grow(1);
9547
+ const index2 = this.reserve(1);
9548
+ growTable(this.table, index2 + 1);
9544
9549
  this.table.set(index2, fn);
9545
9550
  this.slots.set(fn, index2);
9546
9551
  this.publisher?.({ kind: "slot", index: index2, handle, name });
@@ -9548,9 +9553,9 @@ var init_wasix_linker = __esm({
9548
9553
  }
9549
9554
  allocate(size, alignment) {
9550
9555
  if (size === 0) return 0;
9551
- const base = align(this.memory.buffer.byteLength, Math.max(alignment, 16));
9552
- growTo(this.memory, base + size);
9553
- return base;
9556
+ const to = Math.max(alignment, 16);
9557
+ const pages2 = Math.ceil((size + (to > PAGE2 ? to : 0)) / PAGE2);
9558
+ return align(this.memory.grow(pages2) * PAGE2, to);
9554
9559
  }
9555
9560
  };
9556
9561
  }
@@ -10786,7 +10791,8 @@ var init_wasi_runtime = __esm({
10786
10791
  this.call = call2;
10787
10792
  this.ids = ids;
10788
10793
  linker.publisher = (record) => this.publish(record);
10789
- linker.closures = {
10794
+ linker.indices = {
10795
+ reserve: (floor, size) => this.call({ op: "dl-reserve", floor, size }),
10790
10796
  allocate: (floor) => {
10791
10797
  const index2 = this.call({ op: "dl-closure", floor });
10792
10798
  this.catchUp();
@@ -10847,7 +10853,6 @@ var NODE_GLOBALS = [
10847
10853
  ];
10848
10854
  var NODE_SLOTS = [
10849
10855
  "process",
10850
- "Buffer",
10851
10856
  "global",
10852
10857
  "setImmediate",
10853
10858
  "clearImmediate"