@ai-ecoverse/slicc-kernel 1.98.3 → 1.99.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/README.md +56 -1
- package/dist/kernel-worker.js +240 -15
- package/dist/kernel-worker.js.map +4 -4
- package/dist/node-process-worker.js +89 -18
- package/dist/node-process-worker.js.map +4 -4
- package/dist/node.js +240 -15
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +89 -18
- package/dist/process-worker.js.map +4 -4
- package/package.json +2 -2
package/dist/process-worker.js
CHANGED
|
@@ -2454,7 +2454,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
2454
2454
|
var init_version = __esm({
|
|
2455
2455
|
"src/version.ts"() {
|
|
2456
2456
|
"use strict";
|
|
2457
|
-
KERNEL_VERSION = true ? "1.
|
|
2457
|
+
KERNEL_VERSION = true ? "1.99.0" : "0.0.0-dev";
|
|
2458
2458
|
OS_RELEASE = "6.0.0-slicc";
|
|
2459
2459
|
}
|
|
2460
2460
|
});
|
|
@@ -6644,6 +6644,57 @@ var init_wasi_files = __esm({
|
|
|
6644
6644
|
}
|
|
6645
6645
|
});
|
|
6646
6646
|
|
|
6647
|
+
// src/process/wasi/slicc-sem.ts
|
|
6648
|
+
function remainingMs(deadline, now) {
|
|
6649
|
+
if (deadline <= now) return 0;
|
|
6650
|
+
return Number((deadline - now + NS_PER_MS - 1n) / NS_PER_MS);
|
|
6651
|
+
}
|
|
6652
|
+
function semImports(host) {
|
|
6653
|
+
const { mem } = host;
|
|
6654
|
+
const call2 = (req) => host.o.kernel.call(req);
|
|
6655
|
+
const name2 = (ptr, len) => mem.string(ptr, len);
|
|
6656
|
+
return {
|
|
6657
|
+
sem_open: (np, nl, oflag, mode, value2, out) => {
|
|
6658
|
+
const handle = call2({
|
|
6659
|
+
op: "sem-open",
|
|
6660
|
+
name: name2(np, nl),
|
|
6661
|
+
create: (oflag & SEM_CREAT) !== 0,
|
|
6662
|
+
exclusive: (oflag & SEM_EXCL) !== 0,
|
|
6663
|
+
mode,
|
|
6664
|
+
value: value2
|
|
6665
|
+
});
|
|
6666
|
+
mem.view().setUint32(out, handle, true);
|
|
6667
|
+
},
|
|
6668
|
+
sem_close: (handle) => void call2({ op: "sem-close", handle }),
|
|
6669
|
+
sem_unlink: (np, nl) => void call2({ op: "sem-unlink", name: name2(np, nl) }),
|
|
6670
|
+
sem_post: (handle) => void call2({ op: "sem-post", handle }),
|
|
6671
|
+
sem_wait: (handle, how, clock, deadline) => {
|
|
6672
|
+
const kind = HOW[how];
|
|
6673
|
+
if (!kind) throw new WasiError("EINVAL");
|
|
6674
|
+
let timeoutMs2 = -1;
|
|
6675
|
+
if (kind === "timed") {
|
|
6676
|
+
if (deadline < 0n) throw new WasiError("EINVAL");
|
|
6677
|
+
if (clock !== CLOCK.REALTIME && clock !== CLOCK.MONOTONIC) throw new WasiError("EINVAL");
|
|
6678
|
+
timeoutMs2 = remainingMs(deadline, host.now(clock));
|
|
6679
|
+
}
|
|
6680
|
+
call2({ op: "sem-wait", handle, how: kind, timeoutMs: timeoutMs2 });
|
|
6681
|
+
},
|
|
6682
|
+
sem_getvalue: (handle, out) => void mem.view().setInt32(out, call2({ op: "sem-getvalue", handle }), true)
|
|
6683
|
+
};
|
|
6684
|
+
}
|
|
6685
|
+
var SEM_CREAT, SEM_EXCL, HOW, NS_PER_MS;
|
|
6686
|
+
var init_slicc_sem = __esm({
|
|
6687
|
+
"src/process/wasi/slicc-sem.ts"() {
|
|
6688
|
+
"use strict";
|
|
6689
|
+
init_wasi_abi();
|
|
6690
|
+
init_wasi_files();
|
|
6691
|
+
SEM_CREAT = 1;
|
|
6692
|
+
SEM_EXCL = 2;
|
|
6693
|
+
HOW = ["block", "try", "timed"];
|
|
6694
|
+
NS_PER_MS = 1000000n;
|
|
6695
|
+
}
|
|
6696
|
+
});
|
|
6697
|
+
|
|
6647
6698
|
// src/kernel/pipe.ts
|
|
6648
6699
|
var PIPE_CAPACITY;
|
|
6649
6700
|
var init_pipe = __esm({
|
|
@@ -8099,7 +8150,7 @@ function filestatOf(path, s) {
|
|
|
8099
8150
|
size: BigInt(s.size),
|
|
8100
8151
|
ino: s.ino !== void 0 ? BigInt(s.ino) : pathInode(path),
|
|
8101
8152
|
...s.nlink !== void 0 ? { nlink: BigInt(s.nlink) } : {},
|
|
8102
|
-
mtimeNs: BigInt(Math.round(s.mtimeMs ?? 0)) *
|
|
8153
|
+
mtimeNs: BigInt(Math.round(s.mtimeMs ?? 0)) * NS_PER_MS2
|
|
8103
8154
|
};
|
|
8104
8155
|
}
|
|
8105
8156
|
function kernelFiletype(kind) {
|
|
@@ -8149,7 +8200,7 @@ function wrap(table) {
|
|
|
8149
8200
|
}
|
|
8150
8201
|
return out;
|
|
8151
8202
|
}
|
|
8152
|
-
var WasiExit, IDS,
|
|
8203
|
+
var WasiExit, IDS, NS_PER_MS2, AT_SYMLINK_NOFOLLOW2, AT_EACCESS2, ROOT_IDS, GONE, S_IFIFO, DEFAULT_UMASK, MONOTONIC_BASE, MAX_READ, SIGPIPE_EXIT, SIG_IGN, SEALED_MODE, WasiHost;
|
|
8153
8204
|
var init_wasi_host = __esm({
|
|
8154
8205
|
"src/process/wasi/wasi-host.ts"() {
|
|
8155
8206
|
"use strict";
|
|
@@ -8157,6 +8208,7 @@ var init_wasi_host = __esm({
|
|
|
8157
8208
|
init_physical_path();
|
|
8158
8209
|
init_cpu_clock();
|
|
8159
8210
|
init_cred();
|
|
8211
|
+
init_slicc_sem();
|
|
8160
8212
|
init_wasi_abi();
|
|
8161
8213
|
init_wasi_fds();
|
|
8162
8214
|
init_wasi_files();
|
|
@@ -8172,14 +8224,14 @@ var init_wasi_host = __esm({
|
|
|
8172
8224
|
}
|
|
8173
8225
|
};
|
|
8174
8226
|
IDS = ["ruid", "euid", "suid", "rgid", "egid", "sgid"];
|
|
8175
|
-
|
|
8227
|
+
NS_PER_MS2 = 1000000n;
|
|
8176
8228
|
AT_SYMLINK_NOFOLLOW2 = 1;
|
|
8177
8229
|
AT_EACCESS2 = 2;
|
|
8178
8230
|
ROOT_IDS = Object.freeze({ uid: 0, gid: 0 });
|
|
8179
8231
|
GONE = /* @__PURE__ */ new Set(["ENOENT", "ENOTDIR"]);
|
|
8180
8232
|
S_IFIFO = 4096;
|
|
8181
8233
|
DEFAULT_UMASK = 18;
|
|
8182
|
-
MONOTONIC_BASE = BigInt(Math.round(performance.timeOrigin)) *
|
|
8234
|
+
MONOTONIC_BASE = BigInt(Math.round(performance.timeOrigin)) * NS_PER_MS2;
|
|
8183
8235
|
MAX_READ = 1024 * 1024;
|
|
8184
8236
|
SIGPIPE_EXIT = 141;
|
|
8185
8237
|
SIG_IGN = 1;
|
|
@@ -8377,6 +8429,7 @@ var init_wasi_host = __esm({
|
|
|
8377
8429
|
});
|
|
8378
8430
|
void this.o.kernel.call({ op: "proc-setcred", change });
|
|
8379
8431
|
},
|
|
8432
|
+
...semImports(this),
|
|
8380
8433
|
groups_get: (buf, cap, count) => {
|
|
8381
8434
|
const { groups } = this.o.kernel.call({ op: "proc-cred" });
|
|
8382
8435
|
if (cap !== 0 && cap < groups.length) throw new WasiError("EINVAL");
|
|
@@ -8467,7 +8520,7 @@ var init_wasi_host = __esm({
|
|
|
8467
8520
|
return this.cache;
|
|
8468
8521
|
}
|
|
8469
8522
|
now(id) {
|
|
8470
|
-
if (id === CLOCK.REALTIME) return BigInt(Date.now()) *
|
|
8523
|
+
if (id === CLOCK.REALTIME) return BigInt(Date.now()) * NS_PER_MS2;
|
|
8471
8524
|
if (id === CLOCK.MONOTONIC) {
|
|
8472
8525
|
return MONOTONIC_BASE + BigInt(Math.round(performance.now() * 1e6));
|
|
8473
8526
|
}
|
|
@@ -8976,7 +9029,7 @@ var init_wasi_host = __esm({
|
|
|
8976
9029
|
current ??= statOf(path);
|
|
8977
9030
|
return current[field2] ?? current.mtimeMs ?? now;
|
|
8978
9031
|
};
|
|
8979
|
-
const pick = (set, setNow, value2, field2) => flags & setNow ? now : flags & set ? Number(value2 /
|
|
9032
|
+
const pick = (set, setNow, value2, field2) => flags & setNow ? now : flags & set ? Number(value2 / NS_PER_MS2) : kept(field2);
|
|
8980
9033
|
(follow2 ? this.o.fs.utimes : this.o.fs.lutimes).call(
|
|
8981
9034
|
this.o.fs,
|
|
8982
9035
|
path,
|
|
@@ -10224,16 +10277,18 @@ function mutableGlobals(exports) {
|
|
|
10224
10277
|
}
|
|
10225
10278
|
return out;
|
|
10226
10279
|
}
|
|
10227
|
-
var UNWINDING, REWINDING, AsyncifyDriver;
|
|
10280
|
+
var STACK_POINTER, UNWINDING, REWINDING, AsyncifyDriver;
|
|
10228
10281
|
var init_wasix_fork = __esm({
|
|
10229
10282
|
"src/process/wasi/wasix-fork.ts"() {
|
|
10230
10283
|
"use strict";
|
|
10231
10284
|
init_wasi_abi();
|
|
10285
|
+
STACK_POINTER = "__stack_pointer";
|
|
10232
10286
|
UNWINDING = 1;
|
|
10233
10287
|
REWINDING = 2;
|
|
10234
10288
|
AsyncifyDriver = class {
|
|
10235
10289
|
exports = {};
|
|
10236
10290
|
stackUpper = 0;
|
|
10291
|
+
linked;
|
|
10237
10292
|
pending;
|
|
10238
10293
|
answer = 0;
|
|
10239
10294
|
snapshots = /* @__PURE__ */ new Map();
|
|
@@ -10242,10 +10297,12 @@ var init_wasix_fork = __esm({
|
|
|
10242
10297
|
constructor(mem) {
|
|
10243
10298
|
this.mem = mem;
|
|
10244
10299
|
}
|
|
10300
|
+
useStack(pointer, low) {
|
|
10301
|
+
this.linked = { pointer, low };
|
|
10302
|
+
}
|
|
10245
10303
|
bind(exports) {
|
|
10246
10304
|
this.exports = exports;
|
|
10247
|
-
|
|
10248
|
-
this.stackUpper = sp instanceof WebAssembly.Global ? sp.value : 0;
|
|
10305
|
+
this.stackUpper = this.stackPointer();
|
|
10249
10306
|
}
|
|
10250
10307
|
get supported() {
|
|
10251
10308
|
return typeof this.exports.asyncify_start_unwind === "function";
|
|
@@ -10280,7 +10337,7 @@ var init_wasix_fork = __esm({
|
|
|
10280
10337
|
}
|
|
10281
10338
|
fork(fork) {
|
|
10282
10339
|
const sp = this.stackPointer();
|
|
10283
|
-
const globals =
|
|
10340
|
+
const globals = this.globals();
|
|
10284
10341
|
return this.unwind((data) => {
|
|
10285
10342
|
this.answer = fork(data, globals, sp);
|
|
10286
10343
|
});
|
|
@@ -10291,7 +10348,7 @@ var init_wasix_fork = __esm({
|
|
|
10291
10348
|
v.setBigUint64(snapPtr, BigInt(retPtr), true);
|
|
10292
10349
|
v.setBigUint64(snapPtr + 8, BigInt(id), true);
|
|
10293
10350
|
v.setBigUint64(snapPtr + 16, 0x51cc5117n, true);
|
|
10294
|
-
const globals =
|
|
10351
|
+
const globals = this.globals();
|
|
10295
10352
|
return this.unwind((data) => {
|
|
10296
10353
|
const end = this.mem.view().getUint32(data, true);
|
|
10297
10354
|
this.snapshots.set(id, { frames: this.mem.bytes(data + 8, end - data - 8).slice(), globals });
|
|
@@ -10309,11 +10366,24 @@ var init_wasix_fork = __esm({
|
|
|
10309
10366
|
this.answer = Number(val) || 1;
|
|
10310
10367
|
});
|
|
10311
10368
|
}
|
|
10369
|
+
stackGlobal() {
|
|
10370
|
+
const g = this.exports[STACK_POINTER];
|
|
10371
|
+
return g instanceof WebAssembly.Global ? g : this.linked?.pointer;
|
|
10372
|
+
}
|
|
10312
10373
|
stackPointer() {
|
|
10313
|
-
|
|
10314
|
-
|
|
10374
|
+
return this.stackGlobal()?.value ?? 0;
|
|
10375
|
+
}
|
|
10376
|
+
globals() {
|
|
10377
|
+
const out = mutableGlobals(this.exports);
|
|
10378
|
+
if (this.linked && !out.some(([name2]) => name2 === STACK_POINTER)) {
|
|
10379
|
+
out.push([STACK_POINTER, this.linked.pointer.value]);
|
|
10380
|
+
}
|
|
10381
|
+
return out;
|
|
10315
10382
|
}
|
|
10316
10383
|
dataPointer() {
|
|
10384
|
+
if (this.linked && !(this.exports[STACK_POINTER] instanceof WebAssembly.Global)) {
|
|
10385
|
+
return this.linked.low + 15 & ~15;
|
|
10386
|
+
}
|
|
10317
10387
|
const g = this.exports.__data_end;
|
|
10318
10388
|
const dataEnd = g instanceof WebAssembly.Global ? g.value : 0;
|
|
10319
10389
|
return dataEnd < this.stackUpper ? dataEnd + 15 & ~15 : 16;
|
|
@@ -10333,7 +10403,7 @@ var init_wasix_fork = __esm({
|
|
|
10333
10403
|
}
|
|
10334
10404
|
restoreGlobals(globals) {
|
|
10335
10405
|
for (const [name2, value2] of globals) {
|
|
10336
|
-
const g = this.exports[name2];
|
|
10406
|
+
const g = name2 === STACK_POINTER ? this.stackGlobal() : this.exports[name2];
|
|
10337
10407
|
if (g instanceof WebAssembly.Global) g.value = value2;
|
|
10338
10408
|
}
|
|
10339
10409
|
}
|
|
@@ -10345,7 +10415,7 @@ var init_wasix_fork = __esm({
|
|
|
10345
10415
|
function timeoutMs(ns) {
|
|
10346
10416
|
const value2 = BigInt.asUintN(64, ns);
|
|
10347
10417
|
if (value2 === FOREVER) return -1;
|
|
10348
|
-
const ms = (value2 +
|
|
10418
|
+
const ms = (value2 + NS_PER_MS3 - 1n) / NS_PER_MS3;
|
|
10349
10419
|
return ms > BigInt(MAX_TIMEOUT_MS) ? -1 : Number(ms);
|
|
10350
10420
|
}
|
|
10351
10421
|
function wasixEpollImports(host) {
|
|
@@ -10406,7 +10476,7 @@ function wasixEpollImports(host) {
|
|
|
10406
10476
|
}
|
|
10407
10477
|
};
|
|
10408
10478
|
}
|
|
10409
|
-
var EVENT_SIZE, DATA_OFFSET, DATA_SIZE, MAX_EVENTS, FOREVER, MAX_TIMEOUT_MS,
|
|
10479
|
+
var EVENT_SIZE, DATA_OFFSET, DATA_SIZE, MAX_EVENTS, FOREVER, MAX_TIMEOUT_MS, NS_PER_MS3, EVENTFD_SEMAPHORE, EVENTFD_NONBLOCK, EVENTFD_MAX, OPS;
|
|
10410
10480
|
var init_wasix_epoll = __esm({
|
|
10411
10481
|
"src/process/wasi/wasix-epoll.ts"() {
|
|
10412
10482
|
"use strict";
|
|
@@ -10418,7 +10488,7 @@ var init_wasix_epoll = __esm({
|
|
|
10418
10488
|
MAX_EVENTS = 4096;
|
|
10419
10489
|
FOREVER = 0xffffffffffffffffn;
|
|
10420
10490
|
MAX_TIMEOUT_MS = 2147483647;
|
|
10421
|
-
|
|
10491
|
+
NS_PER_MS3 = 1000000n;
|
|
10422
10492
|
EVENTFD_SEMAPHORE = 1;
|
|
10423
10493
|
EVENTFD_NONBLOCK = 4;
|
|
10424
10494
|
EVENTFD_MAX = 0xfffffffffffffffen;
|
|
@@ -12083,6 +12153,7 @@ async function instantiate(host, module, memory, threads, {
|
|
|
12083
12153
|
}
|
|
12084
12154
|
}
|
|
12085
12155
|
if (sync) bindLinker(host, sync, instance, { thread, forked, path });
|
|
12156
|
+
if (sync && !thread) driver.useStack(sync.linker.stackPointer, sync.linker.stackLow);
|
|
12086
12157
|
return { instance, driver };
|
|
12087
12158
|
}
|
|
12088
12159
|
function bindLinker(host, sync, instance, at) {
|