@ai-ecoverse/slicc-kernel 1.7.1 → 1.8.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 +1 -1
- package/dist/kernel-worker.js +8 -1
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +29 -20
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +8 -1
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +29 -20
- package/dist/process-worker.js.map +3 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -109,7 +109,7 @@ A WASI program runs in a process worker of its own like an Emscripten one, again
|
|
|
109
109
|
|
|
110
110
|
### Program imports
|
|
111
111
|
|
|
112
|
-
A WASI command can name an ES module of its package that provides imports of its own, for host functions a program needs beyond WASI (`"imports": "host/pnpm-host.mjs"`). Each worker of the process (the process and every thread) loads it, with the same trust as Emscripten glue, and calls its `createImports(ctx)`, which returns import namespaces (`{ pnpm_host: { … } }`). It may not define `wasi_snapshot_preview1`, `wasix_32v1`, `wasi` or `env`; any other namespace the module imports is then accepted, and functions it does not provide answer `ENOSYS`. `ctx` has:
|
|
112
|
+
A WASI command can name an ES module of its package that provides imports of its own, for host functions a program needs beyond WASI (`"imports": "host/pnpm-host.mjs"`). Each worker of the process (the process and every thread) loads it, with the same trust as Emscripten glue, and calls its `createImports(ctx)`, which returns import namespaces (`{ pnpm_host: { … } }`). It may not define `wasi_snapshot_preview1`, `wasix_32v1`, `wasi` or `env`; any other namespace the module imports is then accepted, and functions it does not provide answer `ENOSYS`. A WASI program (one that imports `wasi_snapshot_preview1` or `wasix_32v1`) needs no imports module for that: without one, its function imports from namespaces of its own all answer `ENOSYS`, so the same binary runs the commands that need no host functions anywhere. A module with no WASI imports, or a foreign import that is not a function, is still refused (126). `ctx` has:
|
|
113
113
|
|
|
114
114
|
- `memory()`, `instance()` (after instantiation), `tid` (1 for the main thread), `argv`, `env`, `cwd()`;
|
|
115
115
|
- `fs`: the synchronous filesystem the WASI calls use (absolute paths);
|
package/dist/kernel-worker.js
CHANGED
|
@@ -3097,6 +3097,8 @@ var SAB_I_STATUS = 2;
|
|
|
3097
3097
|
var SAB_I_TOTAL = 3;
|
|
3098
3098
|
var SAB_I_CHUNK = 4;
|
|
3099
3099
|
var SAB_I_OFFSET = 5;
|
|
3100
|
+
var SAB_I_REQ = 6;
|
|
3101
|
+
var SAB_I_PUB = 7;
|
|
3100
3102
|
var SAB_I_SIGNALS = 8;
|
|
3101
3103
|
var SAB_I_TIMERS = 9;
|
|
3102
3104
|
var SAB_STATE_READY = 2;
|
|
@@ -3151,6 +3153,10 @@ function attachSyncSabResponder(port, sab, token, opts) {
|
|
|
3151
3153
|
pending.delete(id);
|
|
3152
3154
|
}
|
|
3153
3155
|
function publish(id, entry, offset) {
|
|
3156
|
+
if (Atomics.load(header2, SAB_I_REQ) !== id) {
|
|
3157
|
+
drop(id);
|
|
3158
|
+
return;
|
|
3159
|
+
}
|
|
3154
3160
|
const chunk2 = Math.min(window.byteLength, entry.payload.byteLength - offset);
|
|
3155
3161
|
if (chunk2 > 0) window.set(entry.payload.subarray(offset, offset + chunk2));
|
|
3156
3162
|
Atomics.store(header2, SAB_I_STATUS, entry.status);
|
|
@@ -3159,7 +3165,8 @@ function attachSyncSabResponder(port, sab, token, opts) {
|
|
|
3159
3165
|
Atomics.store(header2, SAB_I_OFFSET, offset);
|
|
3160
3166
|
Atomics.store(header2, SAB_I_SEQ, id);
|
|
3161
3167
|
Atomics.store(header2, SAB_I_STATE, SAB_STATE_READY);
|
|
3162
|
-
Atomics.
|
|
3168
|
+
Atomics.add(header2, SAB_I_PUB, 1);
|
|
3169
|
+
Atomics.notify(header2, SAB_I_PUB);
|
|
3163
3170
|
if (offset + chunk2 >= entry.payload.byteLength) drop(id);
|
|
3164
3171
|
}
|
|
3165
3172
|
function settle2(id, result) {
|