@ai-ecoverse/slicc-kernel 1.31.1 → 1.31.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.
@@ -1318,7 +1318,7 @@ function sabViews(sab) {
1318
1318
  window: new Uint8Array(sab, SAB_HEADER_BYTES)
1319
1319
  };
1320
1320
  }
1321
- var SAB_HEADER_I32, SAB_HEADER_BYTES, SAB_I_STATE, SAB_I_SEQ, SAB_I_STATUS, SAB_I_TOTAL, SAB_I_CHUNK, SAB_I_OFFSET, SAB_I_REQ, SAB_I_PUB, SAB_I_SIGNALS, SAB_I_TIMERS, SAB_I_MEMORY, SAB_I_TOTAL_HI, SAB_I_OFFSET_HI, U32, SAB_STATE_IDLE, SAB_STATE_PENDING, SAB_STATE_READY, SAB_STATUS_BYTES, SAB_STATUS_JSON, SAB_STATUS_VOID, SAB_STATUS_ERRNO, SAB_DEFAULT_WINDOW_BYTES, SAB_MIN_BYTES, SYNC_SAB_REQ_MSG, SYNC_SAB_NEXT_MSG, encoder, decoder;
1321
+ var SAB_HEADER_I32, SAB_HEADER_BYTES, SAB_I_STATE, SAB_I_SEQ, SAB_I_STATUS, SAB_I_TOTAL, SAB_I_CHUNK, SAB_I_OFFSET, SAB_I_REQ, SAB_I_PUB, SAB_I_SIGNALS, SAB_I_TIMERS, SAB_I_MEMORY, SAB_I_TOTAL_HI, SAB_I_OFFSET_HI, SAB_I_KILLED, U32, SAB_STATE_IDLE, SAB_STATE_PENDING, SAB_STATE_READY, SAB_STATUS_BYTES, SAB_STATUS_JSON, SAB_STATUS_VOID, SAB_STATUS_ERRNO, SAB_DEFAULT_WINDOW_BYTES, SAB_MIN_BYTES, SYNC_SAB_REQ_MSG, SYNC_SAB_NEXT_MSG, encoder, decoder;
1322
1322
  var init_sync_sab_wire = __esm({
1323
1323
  "src/realm/sync-sab-wire.ts"() {
1324
1324
  "use strict";
@@ -1337,6 +1337,7 @@ var init_sync_sab_wire = __esm({
1337
1337
  SAB_I_MEMORY = 10;
1338
1338
  SAB_I_TOTAL_HI = 11;
1339
1339
  SAB_I_OFFSET_HI = 12;
1340
+ SAB_I_KILLED = 13;
1340
1341
  U32 = 2 ** 32;
1341
1342
  SAB_STATE_IDLE = 0;
1342
1343
  SAB_STATE_PENDING = 1;
@@ -2836,6 +2837,7 @@ var init_process_signals = __esm({
2836
2837
  lastDelivered = 0;
2837
2838
  depth = 0;
2838
2839
  reporting = false;
2840
+ unwinding = false;
2839
2841
  raw;
2840
2842
  header;
2841
2843
  hooks;
@@ -2881,6 +2883,11 @@ var init_process_signals = __esm({
2881
2883
  this.raw.call({ op: "sig-mask", caught, ignored }, Number.POSITIVE_INFINITY, "sig-mask");
2882
2884
  }
2883
2885
  deliver() {
2886
+ const killed = Atomics.load(this.header, SAB_I_KILLED);
2887
+ if (killed !== 0 && !this.unwinding && this.hooks.killed) {
2888
+ this.unwinding = true;
2889
+ this.hooks.killed(killed);
2890
+ }
2884
2891
  const timers = Atomics.exchange(this.header, SAB_I_TIMERS, 0);
2885
2892
  const pending = Atomics.exchange(this.header, SAB_I_SIGNALS, 0);
2886
2893
  if (this.depth <= 1) this.lastDelivered = pending | (timers & 1 ? sigbit(SIG.ALRM) : 0);
@@ -5682,8 +5689,13 @@ var init_wasi_signals = __esm({
5682
5689
  uncaught = 0;
5683
5690
  delivering;
5684
5691
  fallBack;
5685
- constructor(fallBack) {
5692
+ onKilled;
5693
+ constructor(fallBack, onKilled) {
5686
5694
  this.fallBack = fallBack;
5695
+ this.onKilled = onKilled;
5696
+ }
5697
+ killed(code2) {
5698
+ this.onKilled?.(code2);
5687
5699
  }
5688
5700
  bind(exports) {
5689
5701
  this.exports = exports;
@@ -7422,10 +7434,15 @@ function descriptors(init, fork, threads) {
7422
7434
  }
7423
7435
  async function runWasiProcess(init, port2) {
7424
7436
  captureBacktraces(init.env);
7425
- const signals = new WasiSignals((sig) => {
7426
- call2({ op: "proc-kill", pid: init.pid, sig });
7427
- throw new WasiExit(128 + sig);
7428
- });
7437
+ const signals = new WasiSignals(
7438
+ (sig) => {
7439
+ call2({ op: "proc-kill", pid: init.pid, sig });
7440
+ throw new WasiExit(128 + sig);
7441
+ },
7442
+ (code2) => {
7443
+ throw new WasiExit(code2);
7444
+ }
7445
+ );
7429
7446
  const main = {};
7430
7447
  const { transport, sys, call: kernelCall, say } = kernelOf(init, port2, signals, sizeOf(main));
7431
7448
  const id = identify(transport, init);