@ai-ecoverse/slicc-kernel 1.160.2 → 1.160.3
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 +1 -1
- package/dist/node-driver-worker.js.map +2 -2
- package/dist/node-process-worker.js +98 -96
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +73 -7
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +1 -1
- package/dist/types/node.d.ts +9 -1
- package/package.json +2 -2
|
@@ -2207,8 +2207,8 @@ function createSyncFsSabBridge(transport, opts = {}) {
|
|
|
2207
2207
|
};
|
|
2208
2208
|
const io = (id) => ({
|
|
2209
2209
|
readFile: (path) => bytes({ op: "read", path, ...id }, path),
|
|
2210
|
-
writeFile: (path,
|
|
2211
|
-
changing({ op: "write", path, body:
|
|
2210
|
+
writeFile: (path, data2, open) => {
|
|
2211
|
+
changing({ op: "write", path, body: data2, ...open ? { mode: 1 } : {}, ...id }, path);
|
|
2212
2212
|
},
|
|
2213
2213
|
pread: (path, offset, length, version) => bytes({ op: "pread", path, offset, length, ...version ? { version } : {}, ...id }, path),
|
|
2214
2214
|
pwrite: (path, offset, body, transfer) => {
|
|
@@ -3116,12 +3116,12 @@ function streamFile(fd, path, io, access) {
|
|
|
3116
3116
|
},
|
|
3117
3117
|
read: (position, length) => readAsync(position, length),
|
|
3118
3118
|
readInto: readingIntoAsync((position, length) => readAsync(position, length)),
|
|
3119
|
-
async write(position,
|
|
3119
|
+
async write(position, data2) {
|
|
3120
3120
|
index2(position, "write");
|
|
3121
3121
|
live();
|
|
3122
3122
|
allowed(access.write, "write");
|
|
3123
|
-
await io.write(fd,
|
|
3124
|
-
return
|
|
3123
|
+
await io.write(fd, data2);
|
|
3124
|
+
return data2.length;
|
|
3125
3125
|
},
|
|
3126
3126
|
async truncate(size) {
|
|
3127
3127
|
live();
|
|
@@ -3155,12 +3155,12 @@ function streamSyncFile(fd, path, io, access) {
|
|
|
3155
3155
|
},
|
|
3156
3156
|
read: (position, length) => readSync(position, length),
|
|
3157
3157
|
readInto: readingInto((position, length) => readSync(position, length)),
|
|
3158
|
-
write(position,
|
|
3158
|
+
write(position, data2) {
|
|
3159
3159
|
index2(position, "write");
|
|
3160
3160
|
live();
|
|
3161
3161
|
allowed(access.write, "write");
|
|
3162
|
-
io.write(fd,
|
|
3163
|
-
return
|
|
3162
|
+
io.write(fd, data2);
|
|
3163
|
+
return data2.length;
|
|
3164
3164
|
},
|
|
3165
3165
|
truncate(size) {
|
|
3166
3166
|
live();
|
|
@@ -4572,12 +4572,12 @@ var init_wasi_memory = __esm({
|
|
|
4572
4572
|
}
|
|
4573
4573
|
return out;
|
|
4574
4574
|
}
|
|
4575
|
-
scatter(ptr, count,
|
|
4575
|
+
scatter(ptr, count, data2) {
|
|
4576
4576
|
let at = 0;
|
|
4577
4577
|
for (const [base, len] of this.iovecs(ptr, count)) {
|
|
4578
|
-
if (at >=
|
|
4579
|
-
const n = capturedMath.min(len,
|
|
4580
|
-
this.bytes(base, n).set(
|
|
4578
|
+
if (at >= data2.length) break;
|
|
4579
|
+
const n = capturedMath.min(len, data2.length - at);
|
|
4580
|
+
this.bytes(base, n).set(data2.subarray(at, at + n));
|
|
4581
4581
|
at += n;
|
|
4582
4582
|
}
|
|
4583
4583
|
return at;
|
|
@@ -4980,8 +4980,8 @@ function wasixEpollImports(host) {
|
|
|
4980
4980
|
kernelFd(fd, "EPERM");
|
|
4981
4981
|
if (how !== "del" && event === 0) throw new WasiError("EINVAL");
|
|
4982
4982
|
const events = event === 0 ? 0 : mem.view().getUint32(event, true);
|
|
4983
|
-
const
|
|
4984
|
-
call3({ op: "epoll-ctl", epfd, how, fd, events, data });
|
|
4983
|
+
const data2 = event === 0 ? [] : [...mem.bytes(event + DATA_OFFSET, DATA_SIZE)];
|
|
4984
|
+
call3({ op: "epoll-ctl", epfd, how, fd, events, data: data2 });
|
|
4985
4985
|
},
|
|
4986
4986
|
epoll_wait: (epfd, ptr, maxevents, timeout, out) => {
|
|
4987
4987
|
mem.view().setUint32(out, 0, true);
|
|
@@ -6111,12 +6111,12 @@ var init_wasi_host = __esm({
|
|
|
6111
6111
|
return {
|
|
6112
6112
|
fd_write: (fd, iovs, n, out) => void mem.view().setUint32(out, this.write(fd, mem.gather(iovs, n)), true),
|
|
6113
6113
|
fd_read: (fd, iovs, n, out) => {
|
|
6114
|
-
const
|
|
6115
|
-
mem.view().setUint32(out, mem.scatter(iovs, n,
|
|
6114
|
+
const data2 = this.read(fd, mem.capacity(iovs, n));
|
|
6115
|
+
mem.view().setUint32(out, mem.scatter(iovs, n, data2), true);
|
|
6116
6116
|
},
|
|
6117
6117
|
fd_pread: (fd, iovs, n, at, out) => {
|
|
6118
|
-
const
|
|
6119
|
-
mem.view().setUint32(out, mem.scatter(iovs, n,
|
|
6118
|
+
const data2 = this.positional(fd, "read").pread(mem.capacity(iovs, n), capturedNumber(at));
|
|
6119
|
+
mem.view().setUint32(out, mem.scatter(iovs, n, data2), true);
|
|
6120
6120
|
},
|
|
6121
6121
|
fd_pwrite: (fd, iovs, n, at, out) => void mem.view().setUint32(
|
|
6122
6122
|
out,
|
|
@@ -6287,8 +6287,8 @@ var init_wasi_host = __esm({
|
|
|
6287
6287
|
}
|
|
6288
6288
|
const peek = (riflags & RIFLAGS.PEEK) !== 0;
|
|
6289
6289
|
const want = mem.capacity(iovs, n);
|
|
6290
|
-
const
|
|
6291
|
-
mem.view().setUint32(outLen, mem.scatter(iovs, n,
|
|
6290
|
+
const data2 = (riflags & RIFLAGS.WAITALL) !== 0 && !peek ? this.recvAll(fd, want, e.nonblock) : o.kernel.sys.read(fd, capturedMath.min(want, MAX_READ), { nonblock: e.nonblock, peek });
|
|
6291
|
+
mem.view().setUint32(outLen, mem.scatter(iovs, n, data2), true);
|
|
6292
6292
|
mem.view().setUint16(outFlags, 0, true);
|
|
6293
6293
|
},
|
|
6294
6294
|
sock_send: (fd, iovs, n, _flags, out) => {
|
|
@@ -6399,12 +6399,12 @@ var init_wasi_host = __esm({
|
|
|
6399
6399
|
kernelStat(fd) {
|
|
6400
6400
|
return this.o.kernel.call({ op: "fd-vfs-stat", fd });
|
|
6401
6401
|
}
|
|
6402
|
-
write(fd,
|
|
6403
|
-
if (this.muted?.(fd,
|
|
6402
|
+
write(fd, data2) {
|
|
6403
|
+
if (this.muted?.(fd, data2)) return data2.length;
|
|
6404
6404
|
const e = this.fds.get(fd);
|
|
6405
6405
|
if (e.type === "kernel") {
|
|
6406
6406
|
try {
|
|
6407
|
-
const n = this.o.kernel.sys.write(fd,
|
|
6407
|
+
const n = this.o.kernel.sys.write(fd, data2, { nonblock: e.nonblock });
|
|
6408
6408
|
return this.fds.kind(fd, e) === "file" ? this.changed(fd, e, n) : n;
|
|
6409
6409
|
} catch (err) {
|
|
6410
6410
|
const broken = err.code === "EPIPE";
|
|
@@ -6415,10 +6415,10 @@ var init_wasi_host = __esm({
|
|
|
6415
6415
|
if (e.type === "device") {
|
|
6416
6416
|
this.interrupted?.();
|
|
6417
6417
|
if (e.access === "read") throw new WasiError("EBADF");
|
|
6418
|
-
if (e.device === "full" &&
|
|
6419
|
-
return
|
|
6418
|
+
if (e.device === "full" && data2.length > 0) throw new WasiError("ENOSPC");
|
|
6419
|
+
return data2.length;
|
|
6420
6420
|
}
|
|
6421
|
-
return this.file(fd, "write").write(
|
|
6421
|
+
return this.file(fd, "write").write(data2);
|
|
6422
6422
|
}
|
|
6423
6423
|
brokenPipe() {
|
|
6424
6424
|
let action;
|
|
@@ -7365,7 +7365,7 @@ var init_version = __esm({
|
|
|
7365
7365
|
"src/version.ts"() {
|
|
7366
7366
|
"use strict";
|
|
7367
7367
|
init_captured_globals();
|
|
7368
|
-
KERNEL_VERSION = true ? "1.160.
|
|
7368
|
+
KERNEL_VERSION = true ? "1.160.3" : "0.0.0-dev";
|
|
7369
7369
|
OS_RELEASE = "6.0.0-slicc";
|
|
7370
7370
|
}
|
|
7371
7371
|
});
|
|
@@ -7589,10 +7589,10 @@ function restoreMode(lane, { terminal, fd, termios }) {
|
|
|
7589
7589
|
lane({ op: "tty-set", fd: opened2, termios });
|
|
7590
7590
|
lane({ op: "fd-close", fd: opened2 });
|
|
7591
7591
|
}
|
|
7592
|
-
function writeOut(lane, fd,
|
|
7592
|
+
function writeOut(lane, fd, data2) {
|
|
7593
7593
|
let at = 0;
|
|
7594
|
-
while (at <
|
|
7595
|
-
const body =
|
|
7594
|
+
while (at < data2.length) {
|
|
7595
|
+
const body = data2.subarray(at, at + MAX_IO);
|
|
7596
7596
|
const r = lane({ op: "fd-write", fd, body });
|
|
7597
7597
|
if (!r.ok && r.errno === "EINTR") continue;
|
|
7598
7598
|
if (!r.ok) return false;
|
|
@@ -10662,13 +10662,13 @@ function useFileMmap(Fs, deps) {
|
|
|
10662
10662
|
if (stream.stream_ops.mmap && kfd === void 0 || !memalign || !memory || length <= 0 || shared || (stream.flags & O_ACCMODE3) === O_WRONLY5 || !Fs.isFile(stream.node.mode)) {
|
|
10663
10663
|
return mmap.call(fs, stream, length, position, prot, flags);
|
|
10664
10664
|
}
|
|
10665
|
-
const
|
|
10665
|
+
const data2 = staging(Fs, length);
|
|
10666
10666
|
let done = 0;
|
|
10667
10667
|
try {
|
|
10668
|
-
if (kfd !== void 0) done = readInto(deps.sys, kfd,
|
|
10668
|
+
if (kfd !== void 0) done = readInto(deps.sys, kfd, data2, position);
|
|
10669
10669
|
else {
|
|
10670
10670
|
for (let got = 1; done < length && got > 0; done += got) {
|
|
10671
|
-
got = Fs.read(stream,
|
|
10671
|
+
got = Fs.read(stream, data2, done, length - done, position + done);
|
|
10672
10672
|
}
|
|
10673
10673
|
}
|
|
10674
10674
|
} catch (err) {
|
|
@@ -10679,7 +10679,7 @@ function useFileMmap(Fs, deps) {
|
|
|
10679
10679
|
if (!ptr) throw new Fs.ErrnoError(wasiErrno("ENOMEM"));
|
|
10680
10680
|
const target = new capturedUint8Array(memory.buffer, ptr, size);
|
|
10681
10681
|
target.fill(0);
|
|
10682
|
-
target.set(
|
|
10682
|
+
target.set(data2.subarray(0, done));
|
|
10683
10683
|
return { ptr, allocated: true };
|
|
10684
10684
|
};
|
|
10685
10685
|
}
|
|
@@ -11476,8 +11476,8 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
|
|
|
11476
11476
|
stream.sliccProc = new capturedTextEncoder().encode(content());
|
|
11477
11477
|
},
|
|
11478
11478
|
read: (stream, buffer, offset, length, at) => {
|
|
11479
|
-
const
|
|
11480
|
-
const chunk =
|
|
11479
|
+
const data2 = stream.sliccProc ?? new capturedUint8Array(0);
|
|
11480
|
+
const chunk = data2.subarray(at, at + length);
|
|
11481
11481
|
buffer.set(chunk, offset);
|
|
11482
11482
|
return chunk.length;
|
|
11483
11483
|
},
|
|
@@ -12319,11 +12319,11 @@ var init_js_proc = __esm({
|
|
|
12319
12319
|
});
|
|
12320
12320
|
|
|
12321
12321
|
// src/process/js/js-rights.ts
|
|
12322
|
-
function sendmsgRequest(fd,
|
|
12322
|
+
function sendmsgRequest(fd, data2, options = {}) {
|
|
12323
12323
|
return {
|
|
12324
12324
|
op: "sock-sendmsg",
|
|
12325
12325
|
fd,
|
|
12326
|
-
body: typeof
|
|
12326
|
+
body: typeof data2 === "string" ? encoder2.encode(data2) : data2,
|
|
12327
12327
|
fds: options.fds ?? [],
|
|
12328
12328
|
nonblock: options.nonblock === true
|
|
12329
12329
|
};
|
|
@@ -12360,7 +12360,7 @@ async function blocked(kernel, watch, req) {
|
|
|
12360
12360
|
function rightsAsync(kernel, forget, watch) {
|
|
12361
12361
|
return {
|
|
12362
12362
|
socketpair: async () => await kernel.json({ op: "sock-pair", domain: "unix", type: "stream" }),
|
|
12363
|
-
sendmsg: async (fd,
|
|
12363
|
+
sendmsg: async (fd, data2, options) => jsonOf(await blocked(kernel, watch, sendmsgRequest(fd, data2, options))),
|
|
12364
12364
|
async recvmsg(fd, max, options) {
|
|
12365
12365
|
const got = decodeReceived2(
|
|
12366
12366
|
bytesOf2(await blocked(kernel, watch, recvmsgRequest(fd, max, options)))
|
|
@@ -12507,8 +12507,8 @@ function syncOps(kernel, shared) {
|
|
|
12507
12507
|
const r = kernel.blocking({ op: "fd-read", fd, max: capturedMath.min(max, MAX_IO) });
|
|
12508
12508
|
return r.ok && r.kind === "bytes" ? r.bytes : new capturedUint8Array(0);
|
|
12509
12509
|
};
|
|
12510
|
-
const write2 = (fd,
|
|
12511
|
-
const bytes = typeof
|
|
12510
|
+
const write2 = (fd, data2, options) => {
|
|
12511
|
+
const bytes = typeof data2 === "string" ? encoder4.encode(data2) : data2;
|
|
12512
12512
|
const i = info(fd);
|
|
12513
12513
|
if (writeDevice(i)) return bytes.length;
|
|
12514
12514
|
const nonblock = options?.nonblock === true;
|
|
@@ -12599,7 +12599,7 @@ function syncOps(kernel, shared) {
|
|
|
12599
12599
|
kernel.call({ op: "fd-close", fd });
|
|
12600
12600
|
},
|
|
12601
12601
|
socketpair: () => kernel.json({ op: "sock-pair", domain: "unix", type: "stream" }),
|
|
12602
|
-
sendmsg: (fd,
|
|
12602
|
+
sendmsg: (fd, data2, options) => kernel.json(sendmsgRequest(fd, data2, options)),
|
|
12603
12603
|
recvmsg(fd, max, options) {
|
|
12604
12604
|
const got = decodeReceived2(kernel.bytes(recvmsgRequest(fd, max, options)));
|
|
12605
12605
|
for (const n of got.fds) infos.delete(n);
|
|
@@ -12648,17 +12648,17 @@ function syncFile(kernel, fd, path, append, forget) {
|
|
|
12648
12648
|
read(position, length) {
|
|
12649
12649
|
return pread(position, length);
|
|
12650
12650
|
},
|
|
12651
|
-
write(position,
|
|
12651
|
+
write(position, data2) {
|
|
12652
12652
|
index2(position, "write");
|
|
12653
12653
|
let at = 0;
|
|
12654
12654
|
do {
|
|
12655
12655
|
live();
|
|
12656
|
-
if (at >=
|
|
12657
|
-
const body =
|
|
12656
|
+
if (at >= data2.length) break;
|
|
12657
|
+
const body = data2.subarray(at, at + MAX_IO);
|
|
12658
12658
|
const n = kernel.json(fileWrite(fd, append, position + at, body));
|
|
12659
12659
|
if (!(n > 0)) throw new JsCallError("EIO", "write");
|
|
12660
12660
|
at += n;
|
|
12661
|
-
} while (at <
|
|
12661
|
+
} while (at < data2.length);
|
|
12662
12662
|
return at;
|
|
12663
12663
|
},
|
|
12664
12664
|
truncate(size) {
|
|
@@ -12743,7 +12743,7 @@ function syncPathOps(kernel, resolve2, statOf, open, clean) {
|
|
|
12743
12743
|
return readWholeSync(open(devPath));
|
|
12744
12744
|
}
|
|
12745
12745
|
},
|
|
12746
|
-
writeFile(path,
|
|
12746
|
+
writeFile(path, data2, options) {
|
|
12747
12747
|
const mode = options?.mode;
|
|
12748
12748
|
const file = open(path, {
|
|
12749
12749
|
write: true,
|
|
@@ -12752,7 +12752,7 @@ function syncPathOps(kernel, resolve2, statOf, open, clean) {
|
|
|
12752
12752
|
...mode !== void 0 ? { mode } : {}
|
|
12753
12753
|
});
|
|
12754
12754
|
try {
|
|
12755
|
-
file.write(0, typeof
|
|
12755
|
+
file.write(0, typeof data2 === "string" ? encoder4.encode(data2) : data2);
|
|
12756
12756
|
} finally {
|
|
12757
12757
|
file.close();
|
|
12758
12758
|
}
|
|
@@ -14226,8 +14226,8 @@ function createProcessKernel(deps) {
|
|
|
14226
14226
|
},
|
|
14227
14227
|
pause: () => status(call3({ op: "sig-pause" }, "pause")),
|
|
14228
14228
|
sigInherited: () => inheritedOf(call3({ op: "sig-inherited" }, "sig-inherited")),
|
|
14229
|
-
mount(source, target, type, flags,
|
|
14230
|
-
const req = { op: "mount", source, target: at(target), type, flags, data };
|
|
14229
|
+
mount(source, target, type, flags, data2) {
|
|
14230
|
+
const req = { op: "mount", source, target: at(target), type, flags, data: data2 };
|
|
14231
14231
|
return status(call3(req, `mount ${target}`));
|
|
14232
14232
|
},
|
|
14233
14233
|
umount2(target, flags) {
|
|
@@ -15933,9 +15933,9 @@ function includesSelf(kernel, self, pid) {
|
|
|
15933
15933
|
}
|
|
15934
15934
|
function writer(kernel, info, pid) {
|
|
15935
15935
|
const writes = new capturedSet();
|
|
15936
|
-
const sendAll = async (fd,
|
|
15937
|
-
while (w.at <
|
|
15938
|
-
const body =
|
|
15936
|
+
const sendAll = async (fd, data2, i, w, signal) => {
|
|
15937
|
+
while (w.at < data2.length) {
|
|
15938
|
+
const body = data2.subarray(w.at, w.at + MAX_IO);
|
|
15939
15939
|
w.len = body.length;
|
|
15940
15940
|
try {
|
|
15941
15941
|
w.at += signal ? await sendSome(kernel, fd, body, signal) : written(
|
|
@@ -15953,21 +15953,21 @@ function writer(kernel, info, pid) {
|
|
|
15953
15953
|
}
|
|
15954
15954
|
}
|
|
15955
15955
|
};
|
|
15956
|
-
const writeAll = async (fd,
|
|
15957
|
-
const w = { fd, data, at: 0, len: 0 };
|
|
15956
|
+
const writeAll = async (fd, data2, signal) => {
|
|
15957
|
+
const w = { fd, data: data2, at: 0, len: 0 };
|
|
15958
15958
|
if (!signal) writes.add(w);
|
|
15959
15959
|
try {
|
|
15960
15960
|
const i = await info(fd);
|
|
15961
15961
|
if (writeDevice(i)) return;
|
|
15962
|
-
await sendAll(fd,
|
|
15962
|
+
await sendAll(fd, data2, i, w, signal);
|
|
15963
15963
|
} finally {
|
|
15964
15964
|
writes.delete(w);
|
|
15965
15965
|
}
|
|
15966
15966
|
};
|
|
15967
|
-
const writeSome = async (fd,
|
|
15967
|
+
const writeSome = async (fd, data2) => {
|
|
15968
15968
|
const i = await info(fd);
|
|
15969
|
-
if (writeDevice(i)) return
|
|
15970
|
-
const body =
|
|
15969
|
+
if (writeDevice(i)) return data2.length;
|
|
15970
|
+
const body = data2.subarray(0, MAX_IO);
|
|
15971
15971
|
const r = await kernel.raw({ op: "fd-write", fd, body, nonblock: true });
|
|
15972
15972
|
if (r.ok) return written(r, body.length);
|
|
15973
15973
|
if (brokenPipe(callError(r, "fd-write"), i))
|
|
@@ -16051,10 +16051,10 @@ async function fifoOpen(kernel, abs, options, io) {
|
|
|
16051
16051
|
seekless(position, "read");
|
|
16052
16052
|
return io.read(fd, length);
|
|
16053
16053
|
}),
|
|
16054
|
-
async write(position,
|
|
16054
|
+
async write(position, data2) {
|
|
16055
16055
|
seekless(position, "write");
|
|
16056
|
-
await io.write(fd,
|
|
16057
|
-
return
|
|
16056
|
+
await io.write(fd, data2);
|
|
16057
|
+
return data2.length;
|
|
16058
16058
|
},
|
|
16059
16059
|
async truncate() {
|
|
16060
16060
|
live();
|
|
@@ -16145,10 +16145,10 @@ function pendingReads(kernel, info, random2) {
|
|
|
16145
16145
|
return { read: read2, closing, watch };
|
|
16146
16146
|
}
|
|
16147
16147
|
function tracked2(pending, writeAll, writeSome, failed5) {
|
|
16148
|
-
return (fd,
|
|
16148
|
+
return (fd, data2, options) => {
|
|
16149
16149
|
const status2 = failed5?.();
|
|
16150
16150
|
if (status2 !== void 0) return capturedPromise.reject(new JsExit(status2));
|
|
16151
|
-
const bytes = typeof
|
|
16151
|
+
const bytes = typeof data2 === "string" ? encoder5.encode(data2) : data2;
|
|
16152
16152
|
let settle;
|
|
16153
16153
|
const settled2 = new capturedPromise((resolve2) => settle = resolve2);
|
|
16154
16154
|
pending.add(settled2);
|
|
@@ -16415,17 +16415,17 @@ function fileHandle(kernel, fd, path, append, forget) {
|
|
|
16415
16415
|
async read(position, length) {
|
|
16416
16416
|
return await pread(position, length);
|
|
16417
16417
|
},
|
|
16418
|
-
async write(position,
|
|
16418
|
+
async write(position, data2) {
|
|
16419
16419
|
index2(position, "write");
|
|
16420
16420
|
let at = 0;
|
|
16421
16421
|
do {
|
|
16422
16422
|
live();
|
|
16423
|
-
if (at >=
|
|
16424
|
-
const body =
|
|
16423
|
+
if (at >= data2.length) break;
|
|
16424
|
+
const body = data2.subarray(at, at + MAX_IO);
|
|
16425
16425
|
const n = await kernel.json(fileWrite(fd, append, position + at, body));
|
|
16426
16426
|
if (!(n > 0)) throw new JsCallError("EIO", "write");
|
|
16427
16427
|
at += n;
|
|
16428
|
-
} while (at <
|
|
16428
|
+
} while (at < data2.length);
|
|
16429
16429
|
return at;
|
|
16430
16430
|
},
|
|
16431
16431
|
async truncate(size) {
|
|
@@ -16535,7 +16535,7 @@ function pathOps(kernel, resolve2, statOf, open, clean) {
|
|
|
16535
16535
|
return readWhole(await open(devPath));
|
|
16536
16536
|
}
|
|
16537
16537
|
},
|
|
16538
|
-
async writeFile(path,
|
|
16538
|
+
async writeFile(path, data2, options) {
|
|
16539
16539
|
const mode = options?.mode;
|
|
16540
16540
|
const file = await open(
|
|
16541
16541
|
path,
|
|
@@ -16543,7 +16543,7 @@ function pathOps(kernel, resolve2, statOf, open, clean) {
|
|
|
16543
16543
|
true
|
|
16544
16544
|
);
|
|
16545
16545
|
try {
|
|
16546
|
-
await file.write(0, typeof
|
|
16546
|
+
await file.write(0, typeof data2 === "string" ? encoder5.encode(data2) : data2);
|
|
16547
16547
|
} finally {
|
|
16548
16548
|
await file.close();
|
|
16549
16549
|
}
|
|
@@ -17132,9 +17132,9 @@ var init_wasi_signals = __esm({
|
|
|
17132
17132
|
this.libcDefault = outer.libc;
|
|
17133
17133
|
}
|
|
17134
17134
|
}
|
|
17135
|
-
muted(fd,
|
|
17135
|
+
muted(fd, data2) {
|
|
17136
17136
|
if (fd !== 2 || this.delivering === void 0) return false;
|
|
17137
|
-
if (!WASIX_LIBC_DEFAULT_LINE.test(new capturedTextDecoder().decode(
|
|
17137
|
+
if (!WASIX_LIBC_DEFAULT_LINE.test(new capturedTextDecoder().decode(data2))) return false;
|
|
17138
17138
|
this.libcDefault = true;
|
|
17139
17139
|
return true;
|
|
17140
17140
|
}
|
|
@@ -17306,8 +17306,8 @@ var init_wasix_fork = __esm({
|
|
|
17306
17306
|
fork(fork) {
|
|
17307
17307
|
const sp = this.stackPointer();
|
|
17308
17308
|
const globals = this.globals();
|
|
17309
|
-
return this.unwind((
|
|
17310
|
-
this.answer = fork(
|
|
17309
|
+
return this.unwind((data2) => {
|
|
17310
|
+
this.answer = fork(data2, globals, sp);
|
|
17311
17311
|
});
|
|
17312
17312
|
}
|
|
17313
17313
|
checkpoint(snapPtr, retPtr) {
|
|
@@ -17317,9 +17317,9 @@ var init_wasix_fork = __esm({
|
|
|
17317
17317
|
v.setBigUint64(snapPtr + 8, capturedBigInt(id), true);
|
|
17318
17318
|
v.setBigUint64(snapPtr + 16, 0x51cc5117n, true);
|
|
17319
17319
|
const globals = this.globals();
|
|
17320
|
-
return this.unwind((
|
|
17321
|
-
const end = this.mem.view().getUint32(
|
|
17322
|
-
this.snapshots.set(id, { frames: this.mem.bytes(
|
|
17320
|
+
return this.unwind((data2) => {
|
|
17321
|
+
const end = this.mem.view().getUint32(data2, true);
|
|
17322
|
+
this.snapshots.set(id, { frames: this.mem.bytes(data2 + 8, end - data2 - 8).slice(), globals });
|
|
17323
17323
|
this.answer = 0;
|
|
17324
17324
|
});
|
|
17325
17325
|
}
|
|
@@ -17327,9 +17327,9 @@ var init_wasix_fork = __esm({
|
|
|
17327
17327
|
const id = capturedNumber(this.mem.view().getBigUint64(snapPtr + 8, true));
|
|
17328
17328
|
const snap = this.snapshots.get(id);
|
|
17329
17329
|
if (!snap) throw new capturedError(`WASIX: longjmp to an unknown setjmp (${id})`);
|
|
17330
|
-
return this.unwind((
|
|
17331
|
-
this.mem.bytes(
|
|
17332
|
-
this.mem.view().setUint32(
|
|
17330
|
+
return this.unwind((data2) => {
|
|
17331
|
+
this.mem.bytes(data2 + 8, snap.frames.length).set(snap.frames);
|
|
17332
|
+
this.mem.view().setUint32(data2, data2 + 8 + snap.frames.length, true);
|
|
17333
17333
|
this.restoreGlobals(snap.globals);
|
|
17334
17334
|
this.answer = capturedNumber(val) || 1;
|
|
17335
17335
|
});
|
|
@@ -17357,15 +17357,15 @@ var init_wasix_fork = __esm({
|
|
|
17357
17357
|
}
|
|
17358
17358
|
unwind(then) {
|
|
17359
17359
|
if (!this.supported) return E.NOSYS;
|
|
17360
|
-
const
|
|
17360
|
+
const data2 = this.dataPointer();
|
|
17361
17361
|
const v = this.mem.view();
|
|
17362
|
-
v.setUint32(
|
|
17363
|
-
v.setUint32(
|
|
17362
|
+
v.setUint32(data2, data2 + 8, true);
|
|
17363
|
+
v.setUint32(data2 + 4, this.stackPointer() - 16, true);
|
|
17364
17364
|
this.pending = () => {
|
|
17365
|
-
then(
|
|
17366
|
-
return
|
|
17365
|
+
then(data2);
|
|
17366
|
+
return data2;
|
|
17367
17367
|
};
|
|
17368
|
-
this.exports.asyncify_start_unwind?.(
|
|
17368
|
+
this.exports.asyncify_start_unwind?.(data2);
|
|
17369
17369
|
return E.SUCCESS;
|
|
17370
17370
|
}
|
|
17371
17371
|
restoreGlobals(globals) {
|
|
@@ -19284,7 +19284,7 @@ async function runWasiProcess(init, port3) {
|
|
|
19284
19284
|
host.signals = signals;
|
|
19285
19285
|
wireSignals(host, gate);
|
|
19286
19286
|
host.onRaise = (sig) => signals.raised(sig);
|
|
19287
|
-
host.muted = (fd,
|
|
19287
|
+
host.muted = (fd, data2) => signals.muted(fd, data2);
|
|
19288
19288
|
const exports = instance.exports;
|
|
19289
19289
|
driver.bind(instance.exports);
|
|
19290
19290
|
const entry = fork?.entry;
|
|
@@ -19693,10 +19693,11 @@ function workerShaped(scope2, href) {
|
|
|
19693
19693
|
location: slot2(capturedObject.freeze({ href }))
|
|
19694
19694
|
});
|
|
19695
19695
|
}
|
|
19696
|
-
function ownCache(dir, result) {
|
|
19696
|
+
function ownCache(dir, result, optional = false) {
|
|
19697
19697
|
const active = result.directory;
|
|
19698
19698
|
if (active === void 0) return false;
|
|
19699
19699
|
if (!`${resolve(active)}${sep}`.startsWith(`${resolve(dir)}${sep}`)) {
|
|
19700
|
+
if (optional) return false;
|
|
19700
19701
|
throw new capturedError(
|
|
19701
19702
|
`slicc-kernel: compileCache ${dir} was asked for, but this worker already caches in ${active} (a host preload enabled it): refusing to run programs`
|
|
19702
19703
|
);
|
|
@@ -19951,30 +19952,30 @@ function processEntry(port3, run = runWasmProcess, wasi = loadWasi, js = loadJs,
|
|
|
19951
19952
|
}
|
|
19952
19953
|
return refused3;
|
|
19953
19954
|
};
|
|
19954
|
-
return (
|
|
19955
|
-
const type =
|
|
19955
|
+
return (data2) => {
|
|
19956
|
+
const type = data2?.type;
|
|
19956
19957
|
if (type !== WASM_THREAD_INIT && type !== WASM_PROCESS_INIT && type !== JS_THREAD_INIT) return;
|
|
19957
19958
|
const refusal2 = sealOnce();
|
|
19958
19959
|
if (type === JS_THREAD_INIT) {
|
|
19959
19960
|
if (refusal2) return failed5(refusal2.error);
|
|
19960
19961
|
js().then((m) => {
|
|
19961
19962
|
if (!m.runJsThread) throw new capturedError("this process worker runs no JS threads");
|
|
19962
|
-
return m.runJsThread(
|
|
19963
|
+
return m.runJsThread(data2, port3);
|
|
19963
19964
|
}).then(
|
|
19964
19965
|
(code2) => port3.postMessage({ type: JS_THREAD_EXIT, code: code2 }),
|
|
19965
19966
|
failed5
|
|
19966
19967
|
);
|
|
19967
19968
|
return;
|
|
19968
19969
|
}
|
|
19969
|
-
const init =
|
|
19970
|
+
const init = data2;
|
|
19970
19971
|
if (type === WASM_THREAD_INIT || init?.program?.abi !== "js") useLocalClock(init?.sab);
|
|
19971
19972
|
if (type === WASM_THREAD_INIT) {
|
|
19972
19973
|
if (refusal2) return failed5(refusal2.error);
|
|
19973
|
-
wasi().then((m) => m.runWasiThread(
|
|
19974
|
+
wasi().then((m) => m.runWasiThread(data2, port3)).catch(failed5);
|
|
19974
19975
|
return;
|
|
19975
19976
|
}
|
|
19976
19977
|
if (refusal2) return failed5(refusal2.error, NOT_RUNNABLE2);
|
|
19977
|
-
started2(
|
|
19978
|
+
started2(data2, port3, run, wasi, js).then(
|
|
19978
19979
|
(code2) => port3.postMessage({ type: WASM_PROCESS_EXIT, code: code2 }),
|
|
19979
19980
|
failed5
|
|
19980
19981
|
);
|
|
@@ -19988,8 +19989,9 @@ var scope = capturedGlobalThis;
|
|
|
19988
19989
|
scope.require ??= createRequire(import.meta.url);
|
|
19989
19990
|
scope.__filename ??= new capturedURL(import.meta.url).pathname;
|
|
19990
19991
|
scope.__dirname ??= new capturedURL(".", import.meta.url).pathname;
|
|
19991
|
-
var
|
|
19992
|
-
var
|
|
19992
|
+
var data = workerData;
|
|
19993
|
+
var cacheDir = data?.compileCache;
|
|
19994
|
+
var cached = typeof cacheDir === "string" && ownCache(cacheDir, enableCompileCache(cacheDir), data?.ownedCache === true);
|
|
19993
19995
|
var imported = cached ? () => flushCompileCache() : void 0;
|
|
19994
19996
|
var port2 = parentPort;
|
|
19995
19997
|
var post2 = {
|