@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
|
@@ -9900,12 +9900,22 @@ var init_wasix_linker = __esm({
|
|
|
9900
9900
|
if (this.mainPath === void 0) return false;
|
|
9901
9901
|
if (path === this.mainPath) return true;
|
|
9902
9902
|
const real = this.host.real;
|
|
9903
|
-
|
|
9903
|
+
if (real === void 0) return false;
|
|
9904
|
+
try {
|
|
9905
|
+
return real(path) === real(this.mainPath);
|
|
9906
|
+
} catch {
|
|
9907
|
+
return false;
|
|
9908
|
+
}
|
|
9904
9909
|
}
|
|
9905
9910
|
open(name2, cwd, ldPath) {
|
|
9906
9911
|
const path = this.locate(name2, cwd, ldPath);
|
|
9907
9912
|
if (this.isMain(path)) return 0;
|
|
9908
|
-
|
|
9913
|
+
this.indices?.lock();
|
|
9914
|
+
try {
|
|
9915
|
+
return this.load(path, cwd, ldPath).handle;
|
|
9916
|
+
} finally {
|
|
9917
|
+
this.indices?.unlock();
|
|
9918
|
+
}
|
|
9909
9919
|
}
|
|
9910
9920
|
symbol(handle, name2) {
|
|
9911
9921
|
const found = handle === 0 ? this.find(name2) : this.findIn(this.module(handle), name2, /* @__PURE__ */ new Set());
|
|
@@ -9927,15 +9937,17 @@ var init_wasix_linker = __esm({
|
|
|
9927
9937
|
allocateClosure() {
|
|
9928
9938
|
const index2 = this.indices.allocate(this.table.length);
|
|
9929
9939
|
growTable(this.table, index2 + 1);
|
|
9940
|
+
this.live.add(index2);
|
|
9930
9941
|
return index2;
|
|
9931
9942
|
}
|
|
9932
9943
|
freeClosure(index2) {
|
|
9933
9944
|
this.indices?.free(index2);
|
|
9945
|
+
this.live.delete(index2);
|
|
9934
9946
|
this.table.set(index2, null);
|
|
9935
9947
|
}
|
|
9948
|
+
live = /* @__PURE__ */ new Set();
|
|
9936
9949
|
prepareClosure(record) {
|
|
9937
|
-
if (record.index
|
|
9938
|
-
throw new DlError(`closure ${record.index}: no such slot`);
|
|
9950
|
+
if (!this.live.has(record.index)) throw new DlError(`closure ${record.index}: not allocated`);
|
|
9939
9951
|
const full = { kind: "closure-prepare", ...record };
|
|
9940
9952
|
this.install(full);
|
|
9941
9953
|
this.publisher?.(full);
|
|
@@ -9952,15 +9964,23 @@ var init_wasix_linker = __esm({
|
|
|
9952
9964
|
this.table.set(record.index, fn);
|
|
9953
9965
|
this.types.set(fn, sig);
|
|
9954
9966
|
}
|
|
9967
|
+
reserveLoad(size) {
|
|
9968
|
+
return this.indices?.load(this.table.length, size) ?? {
|
|
9969
|
+
base: this.table.length,
|
|
9970
|
+
handle: this.nextHandle++
|
|
9971
|
+
};
|
|
9972
|
+
}
|
|
9955
9973
|
reserve(size) {
|
|
9956
9974
|
return this.indices?.reserve(this.table.length, size) ?? this.table.length;
|
|
9957
9975
|
}
|
|
9958
9976
|
replay(record) {
|
|
9959
9977
|
if (record.kind === "closure") {
|
|
9960
9978
|
growTable(this.table, record.index + 1);
|
|
9979
|
+
this.live.add(record.index);
|
|
9961
9980
|
return;
|
|
9962
9981
|
}
|
|
9963
9982
|
if (record.kind === "closure-free") {
|
|
9983
|
+
this.live.delete(record.index);
|
|
9964
9984
|
if (record.index < this.table.length) this.table.set(record.index, null);
|
|
9965
9985
|
return;
|
|
9966
9986
|
}
|
|
@@ -9970,7 +9990,8 @@ var init_wasix_linker = __esm({
|
|
|
9970
9990
|
}
|
|
9971
9991
|
if (record.kind === "load") {
|
|
9972
9992
|
if (this.modules.has(record.handle)) return;
|
|
9973
|
-
this.instantiate(record.path, this.moduleAt(record.path), record, false);
|
|
9993
|
+
const linked = this.instantiate(record.path, this.moduleAt(record.path), record, false);
|
|
9994
|
+
linked.needed.push(...record.needed ?? []);
|
|
9974
9995
|
this.nextHandle = Math.max(this.nextHandle, record.handle + 1);
|
|
9975
9996
|
return;
|
|
9976
9997
|
}
|
|
@@ -10020,13 +10041,14 @@ var init_wasix_linker = __esm({
|
|
|
10020
10041
|
(n) => this.load(this.locate(n, cwd, search), cwd, ldPath).handle
|
|
10021
10042
|
);
|
|
10022
10043
|
const memoryBase = this.allocate(info.memorySize, 2 ** info.memoryAlign);
|
|
10023
|
-
const tableBase = this.
|
|
10044
|
+
const { base: tableBase, handle } = this.reserveLoad(info.tableSize);
|
|
10024
10045
|
const record = {
|
|
10025
10046
|
kind: "load",
|
|
10026
|
-
handle
|
|
10047
|
+
handle,
|
|
10027
10048
|
path,
|
|
10028
10049
|
memoryBase,
|
|
10029
|
-
tableBase
|
|
10050
|
+
tableBase,
|
|
10051
|
+
...needed.length > 0 ? { needed } : {}
|
|
10030
10052
|
};
|
|
10031
10053
|
const linked = this.instantiate(path, module, record, true);
|
|
10032
10054
|
linked.needed.push(...needed);
|
|
@@ -10084,7 +10106,8 @@ var init_wasix_linker = __esm({
|
|
|
10084
10106
|
linked.instance = new WebAssembly.Instance(module, imports);
|
|
10085
10107
|
this.types.register(() => this.host.read(path), linked.instance, this.table, at.tableBase);
|
|
10086
10108
|
this.modules.set(at.handle, linked);
|
|
10087
|
-
this.byPath.
|
|
10109
|
+
const first = this.byPath.get(path);
|
|
10110
|
+
if (!first || at.handle < first.handle) this.byPath.set(path, linked);
|
|
10088
10111
|
for (const resolve of pending) resolve();
|
|
10089
10112
|
if (init) {
|
|
10090
10113
|
call(linked.instance, "__wasm_apply_data_relocs");
|
|
@@ -10764,6 +10787,7 @@ var init_wasix_host = __esm({
|
|
|
10764
10787
|
return {
|
|
10765
10788
|
dlopen: (p, pl, _flags, buf, len, lp, ll, out) => {
|
|
10766
10789
|
if (p === 0) {
|
|
10790
|
+
if (!this.linker) return failed4("not a dynamically-linked program", buf, len);
|
|
10767
10791
|
mem.view().setUint32(out, MAIN_HANDLE, true);
|
|
10768
10792
|
return E.SUCCESS;
|
|
10769
10793
|
}
|
|
@@ -10780,7 +10804,7 @@ var init_wasix_host = __esm({
|
|
|
10780
10804
|
(l) => l.symbol(handle === MAIN_HANDLE ? 0 : handle, this.str(s, sl)),
|
|
10781
10805
|
(v) => void mem.view().setUint32(out, v, true)
|
|
10782
10806
|
),
|
|
10783
|
-
dl_invalid_handle: (handle) => handle === MAIN_HANDLE || handle !== 0 &&
|
|
10807
|
+
dl_invalid_handle: (handle) => this.linker && (handle === MAIN_HANDLE || handle !== 0 && !this.linker.invalid(handle)) ? E.SUCCESS : E.NOEXEC
|
|
10784
10808
|
};
|
|
10785
10809
|
}
|
|
10786
10810
|
threadImports() {
|
|
@@ -10945,6 +10969,7 @@ var init_wasm_names = __esm({
|
|
|
10945
10969
|
var wasi_runtime_exports = {};
|
|
10946
10970
|
__export(wasi_runtime_exports, {
|
|
10947
10971
|
FALLBACK_MAXIMUM_PAGES: () => FALLBACK_MAXIMUM_PAGES,
|
|
10972
|
+
LinkSync: () => LinkSync,
|
|
10948
10973
|
captureBacktraces: () => captureBacktraces,
|
|
10949
10974
|
createImportedMemory: () => createImportedMemory,
|
|
10950
10975
|
runWasiProcess: () => runWasiProcess,
|
|
@@ -11117,7 +11142,7 @@ async function instantiate(host, module, memory, threads, {
|
|
|
11117
11142
|
thread
|
|
11118
11143
|
),
|
|
11119
11144
|
(req) => host.o.kernel.call(req),
|
|
11120
|
-
threads
|
|
11145
|
+
threads
|
|
11121
11146
|
) : void 0;
|
|
11122
11147
|
if (sync) {
|
|
11123
11148
|
({ preview1, wasix } = sync.guard(preview1, wasix));
|
|
@@ -11429,32 +11454,59 @@ var init_wasi_runtime = __esm({
|
|
|
11429
11454
|
linker;
|
|
11430
11455
|
call;
|
|
11431
11456
|
ids;
|
|
11432
|
-
|
|
11457
|
+
owner;
|
|
11458
|
+
constructor(linker, call2, threads) {
|
|
11433
11459
|
this.linker = linker;
|
|
11434
11460
|
this.call = call2;
|
|
11435
|
-
this.ids = ids;
|
|
11461
|
+
this.ids = threads?.ids;
|
|
11462
|
+
this.owner = threads?.tid ?? 0;
|
|
11436
11463
|
linker.publisher = (record) => this.publish(record);
|
|
11437
11464
|
linker.indices = {
|
|
11438
11465
|
reserve: (floor, size) => this.call({ op: "dl-reserve", floor, size }),
|
|
11466
|
+
load: (floor, size) => this.call({ op: "dl-load-reserve", floor, size }),
|
|
11467
|
+
lock: () => {
|
|
11468
|
+
this.call({ op: "dl-lock", owner: this.owner });
|
|
11469
|
+
try {
|
|
11470
|
+
this.catchUp();
|
|
11471
|
+
} catch (e) {
|
|
11472
|
+
this.call({ op: "dl-unlock", owner: this.owner });
|
|
11473
|
+
throw e;
|
|
11474
|
+
}
|
|
11475
|
+
},
|
|
11476
|
+
unlock: () => this.call({ op: "dl-unlock", owner: this.owner }),
|
|
11439
11477
|
allocate: (floor) => {
|
|
11440
11478
|
const index2 = this.call({ op: "dl-closure", floor });
|
|
11441
11479
|
this.catchUp();
|
|
11480
|
+
this.bump();
|
|
11442
11481
|
return index2;
|
|
11443
11482
|
},
|
|
11444
|
-
free: (index2) =>
|
|
11483
|
+
free: (index2) => {
|
|
11484
|
+
this.call({ op: "dl-closure-free", index: index2 });
|
|
11485
|
+
this.bump();
|
|
11486
|
+
}
|
|
11445
11487
|
};
|
|
11446
11488
|
}
|
|
11489
|
+
bump() {
|
|
11490
|
+
if (this.ids) Atomics.add(this.ids, DL_GEN, 1);
|
|
11491
|
+
}
|
|
11447
11492
|
publish(record) {
|
|
11448
11493
|
const since = this.call({ op: "dl-log", append: record, from: this.count });
|
|
11449
11494
|
for (const r of since.slice(0, -1)) this.linker.replay(r);
|
|
11450
11495
|
this.count += since.length;
|
|
11451
|
-
|
|
11496
|
+
this.bump();
|
|
11497
|
+
this.catchUp();
|
|
11452
11498
|
}
|
|
11453
11499
|
catchUp() {
|
|
11454
|
-
|
|
11455
|
-
|
|
11456
|
-
|
|
11457
|
-
|
|
11500
|
+
for (; ; ) {
|
|
11501
|
+
const gen = this.ids ? Atomics.load(this.ids, DL_GEN) : 0;
|
|
11502
|
+
const since = this.call({ op: "dl-log", from: this.count });
|
|
11503
|
+
for (const r of since) this.linker.replay(r);
|
|
11504
|
+
this.count += since.length;
|
|
11505
|
+
if (!this.ids || Atomics.load(this.ids, DL_GEN) === gen) {
|
|
11506
|
+
this.gen = gen;
|
|
11507
|
+
return;
|
|
11508
|
+
}
|
|
11509
|
+
}
|
|
11458
11510
|
}
|
|
11459
11511
|
guard(preview1, wasix) {
|
|
11460
11512
|
const ids = this.ids;
|