virtual-machine 0.0.36 → 0.1.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.
@@ -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__h39d3e89751b07765(arg0, arg1, arg2) {
210
- wasm.wasm_bindgen__convert__closures_____invoke__h39d3e89751b07765(arg0, arg1, arg2);
209
+ function wasm_bindgen__convert__closures_____invoke__h8a077b496ee6a629(arg0, arg1) {
210
+ wasm.wasm_bindgen__convert__closures_____invoke__h8a077b496ee6a629(arg0, arg1);
211
211
  }
212
- function wasm_bindgen__convert__closures_____invoke__h2d5a3433881a07dc(arg0, arg1) {
213
- wasm.wasm_bindgen__convert__closures_____invoke__h2d5a3433881a07dc(arg0, arg1);
212
+ function wasm_bindgen__convert__closures_____invoke__h38b3d5c42439bcf4(arg0, arg1) {
213
+ wasm.wasm_bindgen__convert__closures_____invoke__h38b3d5c42439bcf4(arg0, arg1);
214
214
  }
215
- function wasm_bindgen__convert__closures_____invoke__hd016cca7bbf341cd(arg0, arg1) {
216
- wasm.wasm_bindgen__convert__closures_____invoke__hd016cca7bbf341cd(arg0, arg1);
215
+ function wasm_bindgen__convert__closures_____invoke__he860240c5b649134(arg0, arg1, arg2) {
216
+ wasm.wasm_bindgen__convert__closures_____invoke__he860240c5b649134(arg0, arg1, arg2);
217
217
  }
218
- function wasm_bindgen__convert__closures_____invoke__h07c9b936df37d4f2(arg0, arg1, arg2) {
219
- wasm.wasm_bindgen__convert__closures_____invoke__h07c9b936df37d4f2(arg0, arg1, arg2);
218
+ function wasm_bindgen__convert__closures_____invoke__h39d3e89751b07765(arg0, arg1, arg2) {
219
+ wasm.wasm_bindgen__convert__closures_____invoke__h39d3e89751b07765(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}
@@ -1041,27 +1063,27 @@ function __wbg_get_imports() {
1041
1063
  }, arguments);
1042
1064
  };
1043
1065
  imports.wbg.__wbindgen_cast_1fb0b53a6a9a76e5 = function(arg0, arg1) {
1044
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h4a8089319832ef98, wasm_bindgen__convert__closures_____invoke__h2d5a3433881a07dc);
1066
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h54a2706e25dd10b8, wasm_bindgen__convert__closures_____invoke__h38b3d5c42439bcf4);
1045
1067
  return ret;
1046
1068
  };
1047
1069
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
1048
1070
  const ret = getStringFromWasm0(arg0, arg1);
1049
1071
  return ret;
1050
1072
  };
1051
- imports.wbg.__wbindgen_cast_bcc7883475928b3d = function(arg0, arg1) {
1052
- const ret = makeClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h4a8089319832ef98, wasm_bindgen__convert__closures_____invoke__hd016cca7bbf341cd);
1073
+ imports.wbg.__wbindgen_cast_386725c5b2a3b665 = function(arg0, arg1) {
1074
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hf225e18fc5ab9bc1, wasm_bindgen__convert__closures_____invoke__h39d3e89751b07765);
1053
1075
  return ret;
1054
1076
  };
1055
- imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
1056
- const ret = arg0;
1077
+ imports.wbg.__wbindgen_cast_4ee4ae87c307a33c = function(arg0, arg1) {
1078
+ const ret = makeClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h54a2706e25dd10b8, wasm_bindgen__convert__closures_____invoke__h8a077b496ee6a629);
1057
1079
  return ret;
1058
1080
  };
1059
- imports.wbg.__wbindgen_cast_eb80e707f2cdece7 = function(arg0, arg1) {
1060
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h4a8089319832ef98, wasm_bindgen__convert__closures_____invoke__h07c9b936df37d4f2);
1081
+ imports.wbg.__wbindgen_cast_b536e8348296605c = function(arg0, arg1) {
1082
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h54a2706e25dd10b8, wasm_bindgen__convert__closures_____invoke__he860240c5b649134);
1061
1083
  return ret;
1062
1084
  };
1063
- imports.wbg.__wbindgen_cast_f1c9170db27db6a8 = function(arg0, arg1) {
1064
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hf225e18fc5ab9bc1, wasm_bindgen__convert__closures_____invoke__h39d3e89751b07765);
1085
+ imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
1086
+ const ret = arg0;
1065
1087
  return ret;
1066
1088
  };
1067
1089
  imports.wbg.__wbindgen_init_externref_table = function() {