virtual-machine 0.0.35 → 0.0.37

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.
@@ -206,17 +206,17 @@ if (!("encodeInto" in cachedTextEncoder)) {
206
206
  };
207
207
  }
208
208
  var WASM_VECTOR_LEN = 0;
209
- function wasm_bindgen__convert__closures_____invoke__hbde9876d0cea708c(arg0, arg1, arg2) {
210
- wasm.wasm_bindgen__convert__closures_____invoke__hbde9876d0cea708c(arg0, arg1, arg2);
209
+ function wasm_bindgen__convert__closures_____invoke__h633c7630e96bf7ba(arg0, arg1) {
210
+ wasm.wasm_bindgen__convert__closures_____invoke__h633c7630e96bf7ba(arg0, arg1);
211
+ }
212
+ function wasm_bindgen__convert__closures_____invoke__h1ead60eaa5163c89(arg0, arg1) {
213
+ wasm.wasm_bindgen__convert__closures_____invoke__h1ead60eaa5163c89(arg0, arg1);
211
214
  }
212
215
  function wasm_bindgen__convert__closures_____invoke__h39d3e89751b07765(arg0, arg1, arg2) {
213
216
  wasm.wasm_bindgen__convert__closures_____invoke__h39d3e89751b07765(arg0, arg1, arg2);
214
217
  }
215
- function wasm_bindgen__convert__closures_____invoke__he7a35327fb096d07(arg0, arg1) {
216
- wasm.wasm_bindgen__convert__closures_____invoke__he7a35327fb096d07(arg0, arg1);
217
- }
218
- function wasm_bindgen__convert__closures_____invoke__h749506e285e0c000(arg0, arg1) {
219
- wasm.wasm_bindgen__convert__closures_____invoke__h749506e285e0c000(arg0, arg1);
218
+ function wasm_bindgen__convert__closures_____invoke__hcefed207e507b803(arg0, arg1, arg2) {
219
+ wasm.wasm_bindgen__convert__closures_____invoke__hcefed207e507b803(arg0, arg1, arg2);
220
220
  }
221
221
  var __wbindgen_enum_WorkerType = ["classic", "module"];
222
222
  var WasmVmFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
@@ -390,6 +390,14 @@ var WasmVm = class _WasmVm {
390
390
  const ret = wasm.wasmvm_inject_network_packet(this.__wbg_ptr, packet);
391
391
  return ret !== 0;
392
392
  }
393
+ /**
394
+ * Signal that workers can start executing.
395
+ * Called by the main thread after hart 0 has finished initializing
396
+ * kernel data structures.
397
+ */
398
+ allow_workers_to_start() {
399
+ wasm.wasmvm_allow_workers_to_start(this.__wbg_ptr);
400
+ }
393
401
  /**
394
402
  * Extract a network packet sent by the guest.
395
403
  * Returns the packet data or null if no packet is pending.
@@ -518,6 +526,15 @@ var WasmVm = class _WasmVm {
518
526
  const ret = wasm.wasmvm_step_n(this.__wbg_ptr, count);
519
527
  return ret >>> 0;
520
528
  }
529
+ /**
530
+ * Get the entry PC address for workers.
531
+ * This is the address where secondary harts should start executing.
532
+ * @returns {bigint}
533
+ */
534
+ entry_pc() {
535
+ const ret = wasm.wasmvm_entry_pc(this.__wbg_ptr);
536
+ return BigInt.asUintN(64, ret);
537
+ }
521
538
  /**
522
539
  * Get the halt code if the VM has halted.
523
540
  * Code 0x5555 typically means successful shutdown (PASS).
@@ -573,6 +590,11 @@ var WorkerState = class {
573
590
  * the event loop to yield between batches. This prevents the worker
574
591
  * from blocking indefinitely and allows it to respond to messages.
575
592
  *
593
+ * Performance optimization: We reduce atomic operations by:
594
+ * - Only checking halt signals every HALT_CHECK_INTERVAL instructions
595
+ * - Only checking interrupts every INTERRUPT_CHECK_INTERVAL instructions
596
+ * - Doing a full interrupt check at the end of each batch
597
+ *
576
598
  * Returns a WorkerStepResult indicating whether to continue, halt, etc.
577
599
  * @param {number} batch_size
578
600
  * @returns {WorkerStepResult}
@@ -1040,20 +1062,20 @@ function __wbg_get_imports() {
1040
1062
  return ret;
1041
1063
  }, arguments);
1042
1064
  };
1043
- imports.wbg.__wbindgen_cast_0268c24e8eb79d38 = function(arg0, arg1) {
1044
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h1a8abd1a91785820, wasm_bindgen__convert__closures_____invoke__he7a35327fb096d07);
1045
- return ret;
1046
- };
1047
1065
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
1048
1066
  const ret = getStringFromWasm0(arg0, arg1);
1049
1067
  return ret;
1050
1068
  };
1051
- imports.wbg.__wbindgen_cast_4ee4ae87c307a33c = function(arg0, arg1) {
1052
- const ret = makeClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h1a8abd1a91785820, wasm_bindgen__convert__closures_____invoke__h749506e285e0c000);
1069
+ imports.wbg.__wbindgen_cast_705cb87c37628e08 = function(arg0, arg1) {
1070
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h219b6c77d9281450, wasm_bindgen__convert__closures_____invoke__hcefed207e507b803);
1053
1071
  return ret;
1054
1072
  };
1055
- imports.wbg.__wbindgen_cast_705cb87c37628e08 = function(arg0, arg1) {
1056
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h1a8abd1a91785820, wasm_bindgen__convert__closures_____invoke__hbde9876d0cea708c);
1073
+ imports.wbg.__wbindgen_cast_bcc7883475928b3d = function(arg0, arg1) {
1074
+ const ret = makeClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h219b6c77d9281450, wasm_bindgen__convert__closures_____invoke__h1ead60eaa5163c89);
1075
+ return ret;
1076
+ };
1077
+ imports.wbg.__wbindgen_cast_ce1738ca1cf90a8c = function(arg0, arg1) {
1078
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h219b6c77d9281450, wasm_bindgen__convert__closures_____invoke__h633c7630e96bf7ba);
1057
1079
  return ret;
1058
1080
  };
1059
1081
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {