@ai-ecoverse/slicc-kernel 1.48.3 → 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.
package/dist/node.js CHANGED
@@ -9165,6 +9165,9 @@ var SYSCALL_OPS = /* @__PURE__ */ new Set([
9165
9165
  "proc-cred",
9166
9166
  "proc-setcred",
9167
9167
  "dl-log",
9168
+ "dl-closure",
9169
+ "dl-closure-free",
9170
+ "dl-reserve",
9168
9171
  "fd-renumber",
9169
9172
  "fd-promote",
9170
9173
  "fd-open-tty",
@@ -9781,6 +9784,13 @@ var WasmProcess = class {
9781
9784
  case "dl-log":
9782
9785
  if (req.append) this.dlLog.push(req.append);
9783
9786
  return { ok: true, kind: "json", json: this.dlLog.slice(req.from) };
9787
+ case "dl-closure":
9788
+ return { ok: true, kind: "json", json: this.allocateClosure(req.floor) };
9789
+ case "dl-closure-free":
9790
+ this.freeClosure(req.index);
9791
+ return { ok: true, kind: "void" };
9792
+ case "dl-reserve":
9793
+ return { ok: true, kind: "json", json: this.reserveSlots(req.floor, req.size) };
9784
9794
  case "sig-mask":
9785
9795
  this.caught = req.caught;
9786
9796
  this.ignored = req.ignored;
@@ -9817,6 +9827,24 @@ var WasmProcess = class {
9817
9827
  }
9818
9828
  alarm;
9819
9829
  dlLog = [];
9830
+ closures = { next: 0, free: [], live: /* @__PURE__ */ new Set() };
9831
+ allocateClosure(floor) {
9832
+ const index = this.closures.free.pop() ?? Math.max(floor, this.closures.next);
9833
+ this.closures.next = Math.max(this.closures.next, index + 1);
9834
+ this.closures.live.add(index);
9835
+ this.dlLog.push({ kind: "closure", index });
9836
+ return index;
9837
+ }
9838
+ freeClosure(index) {
9839
+ if (!this.closures.live.delete(index)) throw new KernelError("EINVAL");
9840
+ this.closures.free.push(index);
9841
+ this.dlLog.push({ kind: "closure-free", index });
9842
+ }
9843
+ reserveSlots(floor, size) {
9844
+ const base = Math.max(floor, this.closures.next);
9845
+ this.closures.next = base + size;
9846
+ return base;
9847
+ }
9820
9848
  asyncOps = new AsyncOps(
9821
9849
  (req, cancelled) => this.syscall(req, cancelled),
9822
9850
  () => this.options.onAsync?.()
@@ -11992,6 +12020,7 @@ var Launcher = class {
11992
12020
  module,
11993
12021
  ...memory ? { memory } : {},
11994
12022
  foreign,
12023
+ path: target.wasm,
11995
12024
  ...names ? { names } : {},
11996
12025
  ...imports !== void 0 ? { imports } : {},
11997
12026
  ...target.preopenRoot ? { preopenRoot: true } : {}