@ai-ecoverse/slicc-kernel 1.54.3 → 1.54.4
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/README.md +1 -1
- package/dist/kernel-worker.js +111 -25
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +71 -19
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +111 -25
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +71 -19
- package/dist/process-worker.js.map +2 -2
- package/package.json +1 -1
package/dist/process-worker.js
CHANGED
|
@@ -7987,12 +7987,22 @@ var init_wasix_linker = __esm({
|
|
|
7987
7987
|
if (this.mainPath === void 0) return false;
|
|
7988
7988
|
if (path === this.mainPath) return true;
|
|
7989
7989
|
const real = this.host.real;
|
|
7990
|
-
|
|
7990
|
+
if (real === void 0) return false;
|
|
7991
|
+
try {
|
|
7992
|
+
return real(path) === real(this.mainPath);
|
|
7993
|
+
} catch {
|
|
7994
|
+
return false;
|
|
7995
|
+
}
|
|
7991
7996
|
}
|
|
7992
7997
|
open(name2, cwd, ldPath) {
|
|
7993
7998
|
const path = this.locate(name2, cwd, ldPath);
|
|
7994
7999
|
if (this.isMain(path)) return 0;
|
|
7995
|
-
|
|
8000
|
+
this.indices?.lock();
|
|
8001
|
+
try {
|
|
8002
|
+
return this.load(path, cwd, ldPath).handle;
|
|
8003
|
+
} finally {
|
|
8004
|
+
this.indices?.unlock();
|
|
8005
|
+
}
|
|
7996
8006
|
}
|
|
7997
8007
|
symbol(handle, name2) {
|
|
7998
8008
|
const found = handle === 0 ? this.find(name2) : this.findIn(this.module(handle), name2, /* @__PURE__ */ new Set());
|
|
@@ -8014,15 +8024,17 @@ var init_wasix_linker = __esm({
|
|
|
8014
8024
|
allocateClosure() {
|
|
8015
8025
|
const index2 = this.indices.allocate(this.table.length);
|
|
8016
8026
|
growTable(this.table, index2 + 1);
|
|
8027
|
+
this.live.add(index2);
|
|
8017
8028
|
return index2;
|
|
8018
8029
|
}
|
|
8019
8030
|
freeClosure(index2) {
|
|
8020
8031
|
this.indices?.free(index2);
|
|
8032
|
+
this.live.delete(index2);
|
|
8021
8033
|
this.table.set(index2, null);
|
|
8022
8034
|
}
|
|
8035
|
+
live = /* @__PURE__ */ new Set();
|
|
8023
8036
|
prepareClosure(record) {
|
|
8024
|
-
if (record.index
|
|
8025
|
-
throw new DlError(`closure ${record.index}: no such slot`);
|
|
8037
|
+
if (!this.live.has(record.index)) throw new DlError(`closure ${record.index}: not allocated`);
|
|
8026
8038
|
const full = { kind: "closure-prepare", ...record };
|
|
8027
8039
|
this.install(full);
|
|
8028
8040
|
this.publisher?.(full);
|
|
@@ -8039,15 +8051,23 @@ var init_wasix_linker = __esm({
|
|
|
8039
8051
|
this.table.set(record.index, fn);
|
|
8040
8052
|
this.types.set(fn, sig);
|
|
8041
8053
|
}
|
|
8054
|
+
reserveLoad(size) {
|
|
8055
|
+
return this.indices?.load(this.table.length, size) ?? {
|
|
8056
|
+
base: this.table.length,
|
|
8057
|
+
handle: this.nextHandle++
|
|
8058
|
+
};
|
|
8059
|
+
}
|
|
8042
8060
|
reserve(size) {
|
|
8043
8061
|
return this.indices?.reserve(this.table.length, size) ?? this.table.length;
|
|
8044
8062
|
}
|
|
8045
8063
|
replay(record) {
|
|
8046
8064
|
if (record.kind === "closure") {
|
|
8047
8065
|
growTable(this.table, record.index + 1);
|
|
8066
|
+
this.live.add(record.index);
|
|
8048
8067
|
return;
|
|
8049
8068
|
}
|
|
8050
8069
|
if (record.kind === "closure-free") {
|
|
8070
|
+
this.live.delete(record.index);
|
|
8051
8071
|
if (record.index < this.table.length) this.table.set(record.index, null);
|
|
8052
8072
|
return;
|
|
8053
8073
|
}
|
|
@@ -8057,7 +8077,8 @@ var init_wasix_linker = __esm({
|
|
|
8057
8077
|
}
|
|
8058
8078
|
if (record.kind === "load") {
|
|
8059
8079
|
if (this.modules.has(record.handle)) return;
|
|
8060
|
-
this.instantiate(record.path, this.moduleAt(record.path), record, false);
|
|
8080
|
+
const linked = this.instantiate(record.path, this.moduleAt(record.path), record, false);
|
|
8081
|
+
linked.needed.push(...record.needed ?? []);
|
|
8061
8082
|
this.nextHandle = Math.max(this.nextHandle, record.handle + 1);
|
|
8062
8083
|
return;
|
|
8063
8084
|
}
|
|
@@ -8107,13 +8128,14 @@ var init_wasix_linker = __esm({
|
|
|
8107
8128
|
(n) => this.load(this.locate(n, cwd, search), cwd, ldPath).handle
|
|
8108
8129
|
);
|
|
8109
8130
|
const memoryBase = this.allocate(info.memorySize, 2 ** info.memoryAlign);
|
|
8110
|
-
const tableBase = this.
|
|
8131
|
+
const { base: tableBase, handle } = this.reserveLoad(info.tableSize);
|
|
8111
8132
|
const record = {
|
|
8112
8133
|
kind: "load",
|
|
8113
|
-
handle
|
|
8134
|
+
handle,
|
|
8114
8135
|
path,
|
|
8115
8136
|
memoryBase,
|
|
8116
|
-
tableBase
|
|
8137
|
+
tableBase,
|
|
8138
|
+
...needed.length > 0 ? { needed } : {}
|
|
8117
8139
|
};
|
|
8118
8140
|
const linked = this.instantiate(path, module, record, true);
|
|
8119
8141
|
linked.needed.push(...needed);
|
|
@@ -8171,7 +8193,8 @@ var init_wasix_linker = __esm({
|
|
|
8171
8193
|
linked.instance = new WebAssembly.Instance(module, imports);
|
|
8172
8194
|
this.types.register(() => this.host.read(path), linked.instance, this.table, at.tableBase);
|
|
8173
8195
|
this.modules.set(at.handle, linked);
|
|
8174
|
-
this.byPath.
|
|
8196
|
+
const first = this.byPath.get(path);
|
|
8197
|
+
if (!first || at.handle < first.handle) this.byPath.set(path, linked);
|
|
8175
8198
|
for (const resolve of pending) resolve();
|
|
8176
8199
|
if (init) {
|
|
8177
8200
|
call(linked.instance, "__wasm_apply_data_relocs");
|
|
@@ -8851,6 +8874,7 @@ var init_wasix_host = __esm({
|
|
|
8851
8874
|
return {
|
|
8852
8875
|
dlopen: (p, pl, _flags, buf, len, lp, ll, out) => {
|
|
8853
8876
|
if (p === 0) {
|
|
8877
|
+
if (!this.linker) return failed4("not a dynamically-linked program", buf, len);
|
|
8854
8878
|
mem.view().setUint32(out, MAIN_HANDLE, true);
|
|
8855
8879
|
return E.SUCCESS;
|
|
8856
8880
|
}
|
|
@@ -8867,7 +8891,7 @@ var init_wasix_host = __esm({
|
|
|
8867
8891
|
(l) => l.symbol(handle === MAIN_HANDLE ? 0 : handle, this.str(s, sl)),
|
|
8868
8892
|
(v) => void mem.view().setUint32(out, v, true)
|
|
8869
8893
|
),
|
|
8870
|
-
dl_invalid_handle: (handle) => handle === MAIN_HANDLE || handle !== 0 &&
|
|
8894
|
+
dl_invalid_handle: (handle) => this.linker && (handle === MAIN_HANDLE || handle !== 0 && !this.linker.invalid(handle)) ? E.SUCCESS : E.NOEXEC
|
|
8871
8895
|
};
|
|
8872
8896
|
}
|
|
8873
8897
|
threadImports() {
|
|
@@ -9032,6 +9056,7 @@ var init_wasm_names = __esm({
|
|
|
9032
9056
|
var wasi_runtime_exports = {};
|
|
9033
9057
|
__export(wasi_runtime_exports, {
|
|
9034
9058
|
FALLBACK_MAXIMUM_PAGES: () => FALLBACK_MAXIMUM_PAGES,
|
|
9059
|
+
LinkSync: () => LinkSync,
|
|
9035
9060
|
captureBacktraces: () => captureBacktraces,
|
|
9036
9061
|
createImportedMemory: () => createImportedMemory,
|
|
9037
9062
|
runWasiProcess: () => runWasiProcess,
|
|
@@ -9204,7 +9229,7 @@ async function instantiate(host, module, memory, threads, {
|
|
|
9204
9229
|
thread
|
|
9205
9230
|
),
|
|
9206
9231
|
(req) => host.o.kernel.call(req),
|
|
9207
|
-
threads
|
|
9232
|
+
threads
|
|
9208
9233
|
) : void 0;
|
|
9209
9234
|
if (sync) {
|
|
9210
9235
|
({ preview1, wasix } = sync.guard(preview1, wasix));
|
|
@@ -9516,32 +9541,59 @@ var init_wasi_runtime = __esm({
|
|
|
9516
9541
|
linker;
|
|
9517
9542
|
call;
|
|
9518
9543
|
ids;
|
|
9519
|
-
|
|
9544
|
+
owner;
|
|
9545
|
+
constructor(linker, call2, threads) {
|
|
9520
9546
|
this.linker = linker;
|
|
9521
9547
|
this.call = call2;
|
|
9522
|
-
this.ids = ids;
|
|
9548
|
+
this.ids = threads?.ids;
|
|
9549
|
+
this.owner = threads?.tid ?? 0;
|
|
9523
9550
|
linker.publisher = (record) => this.publish(record);
|
|
9524
9551
|
linker.indices = {
|
|
9525
9552
|
reserve: (floor, size) => this.call({ op: "dl-reserve", floor, size }),
|
|
9553
|
+
load: (floor, size) => this.call({ op: "dl-load-reserve", floor, size }),
|
|
9554
|
+
lock: () => {
|
|
9555
|
+
this.call({ op: "dl-lock", owner: this.owner });
|
|
9556
|
+
try {
|
|
9557
|
+
this.catchUp();
|
|
9558
|
+
} catch (e) {
|
|
9559
|
+
this.call({ op: "dl-unlock", owner: this.owner });
|
|
9560
|
+
throw e;
|
|
9561
|
+
}
|
|
9562
|
+
},
|
|
9563
|
+
unlock: () => this.call({ op: "dl-unlock", owner: this.owner }),
|
|
9526
9564
|
allocate: (floor) => {
|
|
9527
9565
|
const index2 = this.call({ op: "dl-closure", floor });
|
|
9528
9566
|
this.catchUp();
|
|
9567
|
+
this.bump();
|
|
9529
9568
|
return index2;
|
|
9530
9569
|
},
|
|
9531
|
-
free: (index2) =>
|
|
9570
|
+
free: (index2) => {
|
|
9571
|
+
this.call({ op: "dl-closure-free", index: index2 });
|
|
9572
|
+
this.bump();
|
|
9573
|
+
}
|
|
9532
9574
|
};
|
|
9533
9575
|
}
|
|
9576
|
+
bump() {
|
|
9577
|
+
if (this.ids) Atomics.add(this.ids, DL_GEN, 1);
|
|
9578
|
+
}
|
|
9534
9579
|
publish(record) {
|
|
9535
9580
|
const since = this.call({ op: "dl-log", append: record, from: this.count });
|
|
9536
9581
|
for (const r of since.slice(0, -1)) this.linker.replay(r);
|
|
9537
9582
|
this.count += since.length;
|
|
9538
|
-
|
|
9583
|
+
this.bump();
|
|
9584
|
+
this.catchUp();
|
|
9539
9585
|
}
|
|
9540
9586
|
catchUp() {
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9587
|
+
for (; ; ) {
|
|
9588
|
+
const gen = this.ids ? Atomics.load(this.ids, DL_GEN) : 0;
|
|
9589
|
+
const since = this.call({ op: "dl-log", from: this.count });
|
|
9590
|
+
for (const r of since) this.linker.replay(r);
|
|
9591
|
+
this.count += since.length;
|
|
9592
|
+
if (!this.ids || Atomics.load(this.ids, DL_GEN) === gen) {
|
|
9593
|
+
this.gen = gen;
|
|
9594
|
+
return;
|
|
9595
|
+
}
|
|
9596
|
+
}
|
|
9545
9597
|
}
|
|
9546
9598
|
guard(preview1, wasix) {
|
|
9547
9599
|
const ids = this.ids;
|