@ai-ecoverse/slicc-kernel 1.48.3 → 1.49.0

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,8 @@ 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",
9168
9170
  "fd-renumber",
9169
9171
  "fd-promote",
9170
9172
  "fd-open-tty",
@@ -9781,6 +9783,11 @@ var WasmProcess = class {
9781
9783
  case "dl-log":
9782
9784
  if (req.append) this.dlLog.push(req.append);
9783
9785
  return { ok: true, kind: "json", json: this.dlLog.slice(req.from) };
9786
+ case "dl-closure":
9787
+ return { ok: true, kind: "json", json: this.allocateClosure(req.floor) };
9788
+ case "dl-closure-free":
9789
+ this.freeClosure(req.index);
9790
+ return { ok: true, kind: "void" };
9784
9791
  case "sig-mask":
9785
9792
  this.caught = req.caught;
9786
9793
  this.ignored = req.ignored;
@@ -9817,6 +9824,18 @@ var WasmProcess = class {
9817
9824
  }
9818
9825
  alarm;
9819
9826
  dlLog = [];
9827
+ closures = { next: 0, free: [], live: /* @__PURE__ */ new Set() };
9828
+ allocateClosure(floor) {
9829
+ const index = this.closures.free.pop() ?? Math.max(floor, this.closures.next);
9830
+ this.closures.next = Math.max(this.closures.next, index + 1);
9831
+ this.closures.live.add(index);
9832
+ this.dlLog.push({ kind: "closure", index });
9833
+ return index;
9834
+ }
9835
+ freeClosure(index) {
9836
+ if (!this.closures.live.delete(index)) throw new KernelError("EINVAL");
9837
+ this.closures.free.push(index);
9838
+ }
9820
9839
  asyncOps = new AsyncOps(
9821
9840
  (req, cancelled) => this.syscall(req, cancelled),
9822
9841
  () => this.options.onAsync?.()
@@ -11992,6 +12011,7 @@ var Launcher = class {
11992
12011
  module,
11993
12012
  ...memory ? { memory } : {},
11994
12013
  foreign,
12014
+ path: target.wasm,
11995
12015
  ...names ? { names } : {},
11996
12016
  ...imports !== void 0 ? { imports } : {},
11997
12017
  ...target.preopenRoot ? { preopenRoot: true } : {}