@ai-ecoverse/slicc-kernel 1.146.1 → 1.146.2
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/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +384 -365
- package/dist/node-process-worker.js.map +4 -4
- package/dist/node.js +1 -1
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +30 -11
- package/dist/process-worker.js.map +3 -3
- package/dist/types/process/js/async-sab.d.ts +1 -1
- package/dist/types/realm/sync-sab-bridge.d.ts +4 -0
- package/package.json +4 -4
package/dist/process-worker.js
CHANGED
|
@@ -1197,6 +1197,18 @@ var init_sync_fs_wire = __esm({
|
|
|
1197
1197
|
});
|
|
1198
1198
|
|
|
1199
1199
|
// src/realm/sync-sab-bridge.ts
|
|
1200
|
+
function exactBody(req, transfer = []) {
|
|
1201
|
+
const body = req.body;
|
|
1202
|
+
if (!ArrayBuffer.isView(body)) return { req, transfer };
|
|
1203
|
+
if (Object.prototype.toString.call(body.buffer) === "[object SharedArrayBuffer]") {
|
|
1204
|
+
return { req, transfer };
|
|
1205
|
+
}
|
|
1206
|
+
const whole = body.constructor === Uint8Array && body.byteOffset === 0 && body.byteLength === body.buffer.byteLength;
|
|
1207
|
+
if (whole) return { req, transfer };
|
|
1208
|
+
const copy2 = new Uint8Array(body.byteLength);
|
|
1209
|
+
copy2.set(new Uint8Array(body.buffer, body.byteOffset, body.byteLength));
|
|
1210
|
+
return { req: { ...req, body: copy2 }, transfer: [...transfer, copy2.buffer] };
|
|
1211
|
+
}
|
|
1200
1212
|
function syncCallCount() {
|
|
1201
1213
|
return calls;
|
|
1202
1214
|
}
|
|
@@ -1242,8 +1254,9 @@ function createSyncSabTransport(sab, port2, deps = {}) {
|
|
|
1242
1254
|
}
|
|
1243
1255
|
}
|
|
1244
1256
|
return {
|
|
1245
|
-
call(
|
|
1257
|
+
call(asked, timeoutMs2, label, given = []) {
|
|
1246
1258
|
if (deps.memory) publishMemory(sab, deps.memory());
|
|
1259
|
+
const { req, transfer } = exactBody(asked, given);
|
|
1247
1260
|
const id = ++seq;
|
|
1248
1261
|
calls += Number(!UNCOUNTED_OPS.has(req.op));
|
|
1249
1262
|
let out = null;
|
|
@@ -2914,7 +2927,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
2914
2927
|
var init_version = __esm({
|
|
2915
2928
|
"src/version.ts"() {
|
|
2916
2929
|
"use strict";
|
|
2917
|
-
KERNEL_VERSION = true ? "1.146.
|
|
2930
|
+
KERNEL_VERSION = true ? "1.146.2" : "0.0.0-dev";
|
|
2918
2931
|
OS_RELEASE = "6.0.0-slicc";
|
|
2919
2932
|
}
|
|
2920
2933
|
});
|
|
@@ -6112,9 +6125,12 @@ function ownBytes(bytes) {
|
|
|
6112
6125
|
if (bytes.constructor === Uint8Array) return bytes;
|
|
6113
6126
|
return new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength).slice();
|
|
6114
6127
|
}
|
|
6128
|
+
function ownedBuffer(body, given) {
|
|
6129
|
+
return body === given ? void 0 : [body.buffer];
|
|
6130
|
+
}
|
|
6115
6131
|
function kernelSys(transport) {
|
|
6116
|
-
const call2 = (req, label) => {
|
|
6117
|
-
const r = transport.call(req, Number.POSITIVE_INFINITY, label);
|
|
6132
|
+
const call2 = (req, label, transfer) => {
|
|
6133
|
+
const r = transport.call(req, Number.POSITIVE_INFINITY, label, transfer);
|
|
6118
6134
|
if (!r.ok) throw new SyscallError(r.errno);
|
|
6119
6135
|
return r;
|
|
6120
6136
|
};
|
|
@@ -6129,13 +6145,14 @@ function kernelSys(transport) {
|
|
|
6129
6145
|
return r.ok && r.kind === "bytes" ? r.bytes : new Uint8Array(0);
|
|
6130
6146
|
},
|
|
6131
6147
|
write(fd, bytes, opts) {
|
|
6148
|
+
const body = ownBytes(bytes);
|
|
6132
6149
|
const req = {
|
|
6133
6150
|
op: "fd-write",
|
|
6134
6151
|
fd,
|
|
6135
|
-
body
|
|
6152
|
+
body,
|
|
6136
6153
|
...opts?.nonblock ? { nonblock: true } : {}
|
|
6137
6154
|
};
|
|
6138
|
-
const n = json2(call2(req, `fd-write ${fd}
|
|
6155
|
+
const n = json2(call2(req, `fd-write ${fd}`, ownedBuffer(body, bytes)));
|
|
6139
6156
|
return typeof n === "number" ? n : bytes.length;
|
|
6140
6157
|
},
|
|
6141
6158
|
close(fd) {
|
|
@@ -6180,8 +6197,9 @@ function kernelSys(transport) {
|
|
|
6180
6197
|
return r.ok && r.kind === "bytes" ? r.bytes : new Uint8Array(0);
|
|
6181
6198
|
},
|
|
6182
6199
|
pwrite(fd, bytes, at) {
|
|
6200
|
+
const body = ownBytes(bytes);
|
|
6183
6201
|
return json2(
|
|
6184
|
-
call2({ op: "fd-pwrite", fd, offset: at, body
|
|
6202
|
+
call2({ op: "fd-pwrite", fd, offset: at, body }, `fd-pwrite ${fd}`, ownedBuffer(body, bytes))
|
|
6185
6203
|
);
|
|
6186
6204
|
},
|
|
6187
6205
|
isatty(fd) {
|
|
@@ -7734,7 +7752,8 @@ function createAsyncSabTransport(sab, port2, waitAsync = defaultWaitAsync) {
|
|
|
7734
7752
|
await changed(header, SAB_I_PUB, published, waitAsync);
|
|
7735
7753
|
}
|
|
7736
7754
|
}
|
|
7737
|
-
async function once(
|
|
7755
|
+
async function once(asked) {
|
|
7756
|
+
const { req, transfer } = exactBody(asked);
|
|
7738
7757
|
const id = ++seq;
|
|
7739
7758
|
let out = null;
|
|
7740
7759
|
let status2 = 0;
|
|
@@ -7743,9 +7762,8 @@ function createAsyncSabTransport(sab, port2, waitAsync = defaultWaitAsync) {
|
|
|
7743
7762
|
try {
|
|
7744
7763
|
for (; ; ) {
|
|
7745
7764
|
Atomics.store(header, SAB_I_STATE, SAB_STATE_PENDING);
|
|
7746
|
-
port2.postMessage(
|
|
7747
|
-
|
|
7748
|
-
);
|
|
7765
|
+
if (offset === 0) port2.postMessage({ type: SYNC_SAB_REQ_MSG, id, req }, transfer);
|
|
7766
|
+
else port2.postMessage({ type: SYNC_SAB_NEXT_MSG, id, offset });
|
|
7749
7767
|
await ready(id);
|
|
7750
7768
|
const total = loadU53(header, SAB_I_TOTAL, SAB_I_TOTAL_HI);
|
|
7751
7769
|
const chunk = Atomics.load(header, SAB_I_CHUNK);
|
|
@@ -7780,6 +7798,7 @@ var defaultWaitAsync;
|
|
|
7780
7798
|
var init_async_sab = __esm({
|
|
7781
7799
|
"src/process/js/async-sab.ts"() {
|
|
7782
7800
|
"use strict";
|
|
7801
|
+
init_sync_sab_bridge();
|
|
7783
7802
|
init_sync_sab_wire();
|
|
7784
7803
|
defaultWaitAsync = (a, i, v) => Atomics.waitAsync(a, i, v);
|
|
7785
7804
|
}
|