virtual-machine 0.1.3 → 0.1.4

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,91 +206,25 @@ if (!("encodeInto" in cachedTextEncoder)) {
206
206
  };
207
207
  }
208
208
  var WASM_VECTOR_LEN = 0;
209
- function wasm_bindgen__convert__closures_____invoke__ha9a06e4d93c772bf(arg0, arg1) {
210
- wasm.wasm_bindgen__convert__closures_____invoke__ha9a06e4d93c772bf(arg0, arg1);
211
- }
212
- function wasm_bindgen__convert__closures_____invoke__h3eb569f20d255f19(arg0, arg1) {
213
- wasm.wasm_bindgen__convert__closures_____invoke__h3eb569f20d255f19(arg0, arg1);
209
+ function wasm_bindgen__convert__closures_____invoke__h02b024c830faf3c0(arg0, arg1, arg2) {
210
+ wasm.wasm_bindgen__convert__closures_____invoke__h02b024c830faf3c0(arg0, arg1, arg2);
214
211
  }
215
212
  function wasm_bindgen__convert__closures_____invoke__h39d3e89751b07765(arg0, arg1, arg2) {
216
213
  wasm.wasm_bindgen__convert__closures_____invoke__h39d3e89751b07765(arg0, arg1, arg2);
217
214
  }
218
- function wasm_bindgen__convert__closures_____invoke__h320e929207365995(arg0, arg1, arg2) {
219
- wasm.wasm_bindgen__convert__closures_____invoke__h320e929207365995(arg0, arg1, arg2);
215
+ function wasm_bindgen__convert__closures_____invoke__h9493c87185cf2d12(arg0, arg1) {
216
+ wasm.wasm_bindgen__convert__closures_____invoke__h9493c87185cf2d12(arg0, arg1);
217
+ }
218
+ function wasm_bindgen__convert__closures_____invoke__hec486a7a364d96de(arg0, arg1) {
219
+ wasm.wasm_bindgen__convert__closures_____invoke__hec486a7a364d96de(arg0, arg1);
220
220
  }
221
221
  var __wbindgen_enum_WorkerType = ["classic", "module"];
222
- var JitWorkerContextFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
223
- }, unregister: () => {
224
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_jitworkercontext_free(ptr >>> 0, 1));
225
222
  var WasmVmFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
226
223
  }, unregister: () => {
227
224
  } } : new FinalizationRegistry((ptr) => wasm.__wbg_wasmvm_free(ptr >>> 0, 1));
228
225
  var WorkerStateFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
229
226
  }, unregister: () => {
230
227
  } } : new FinalizationRegistry((ptr) => wasm.__wbg_workerstate_free(ptr >>> 0, 1));
231
- var JitWorkerContext = class _JitWorkerContext {
232
- static __wrap(ptr) {
233
- ptr = ptr >>> 0;
234
- const obj = Object.create(_JitWorkerContext.prototype);
235
- obj.__wbg_ptr = ptr;
236
- JitWorkerContextFinalization.register(obj, obj.__wbg_ptr, obj);
237
- return obj;
238
- }
239
- __destroy_into_raw() {
240
- const ptr = this.__wbg_ptr;
241
- this.__wbg_ptr = 0;
242
- JitWorkerContextFinalization.unregister(this);
243
- return ptr;
244
- }
245
- free() {
246
- const ptr = this.__destroy_into_raw();
247
- wasm.__wbg_jitworkercontext_free(ptr, 0);
248
- }
249
- /**
250
- * Create a new JIT worker context with custom configuration.
251
- *
252
- * # Arguments
253
- * * `min_block_size` - Minimum number of instructions for JIT compilation
254
- * * `debug_wat` - Enable debug WAT output
255
- * @param {number} min_block_size
256
- * @param {boolean} debug_wat
257
- * @returns {JitWorkerContext}
258
- */
259
- static newWithConfig(min_block_size, debug_wat) {
260
- const ret = wasm.jitworkercontext_newWithConfig(min_block_size, debug_wat);
261
- return _JitWorkerContext.__wrap(ret);
262
- }
263
- /**
264
- * Create a new JIT worker context with default configuration.
265
- */
266
- constructor() {
267
- const ret = wasm.jitworkercontext_new();
268
- this.__wbg_ptr = ret >>> 0;
269
- JitWorkerContextFinalization.register(this, this.__wbg_ptr, this);
270
- return this;
271
- }
272
- /**
273
- * Compile a block from serialized request bytes.
274
- *
275
- * # Arguments
276
- * * `request_bytes` - Bincode-serialized `CompileRequest`
277
- *
278
- * # Returns
279
- * A JavaScript object with the compilation result:
280
- * - On success: `{ success: true, pc: number, wasmBytes: Uint8Array }`
281
- * - On unsuitable: `{ success: false, pc: number, status: 'unsuitable' }`
282
- * - On error: `{ success: false, pc: number, status: 'error' }`
283
- * @param {Uint8Array} request_bytes
284
- * @returns {any}
285
- */
286
- compile(request_bytes) {
287
- const ptr0 = passArray8ToWasm0(request_bytes, wasm.__wbindgen_malloc);
288
- const len0 = WASM_VECTOR_LEN;
289
- const ret = wasm.jitworkercontext_compile(this.__wbg_ptr, ptr0, len0);
290
- return ret;
291
- }
292
- };
293
- if (Symbol.dispose) JitWorkerContext.prototype[Symbol.dispose] = JitWorkerContext.prototype.free;
294
228
  var NetworkStatus = Object.freeze({
295
229
  Disconnected: 0,
296
230
  "0": "Disconnected",
@@ -346,35 +280,6 @@ var WasmVm = class _WasmVm {
346
280
  const len0 = WASM_VECTOR_LEN;
347
281
  wasm.wasmvm_print_status(this.__wbg_ptr, ptr0, len0);
348
282
  }
349
- /**
350
- * Re-enable JIT after it was disabled by errors.
351
- */
352
- reenableJit() {
353
- wasm.wasmvm_reenableJit(this.__wbg_ptr);
354
- }
355
- /**
356
- * Get JIT statistics as JSON string.
357
- * @returns {string}
358
- */
359
- getJitStats() {
360
- let deferred1_0;
361
- let deferred1_1;
362
- try {
363
- const ret = wasm.wasmvm_getJitStats(this.__wbg_ptr);
364
- deferred1_0 = ret[0];
365
- deferred1_1 = ret[1];
366
- return getStringFromWasm0(ret[0], ret[1]);
367
- } finally {
368
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
369
- }
370
- }
371
- /**
372
- * Enable or disable JIT debug WAT output.
373
- * @param {boolean} debug
374
- */
375
- setJitDebug(debug) {
376
- wasm.wasmvm_setJitDebug(this.__wbg_ptr, debug);
377
- }
378
283
  /**
379
284
  * Start worker threads for secondary harts (1..num_harts).
380
285
  *
@@ -393,21 +298,6 @@ var WasmVm = class _WasmVm {
393
298
  throw takeFromExternrefTable0(ret[0]);
394
299
  }
395
300
  }
396
- /**
397
- * Dump recent JIT trace events to console.
398
- * @param {number | null} [count]
399
- */
400
- dumpJitTrace(count) {
401
- wasm.wasmvm_dumpJitTrace(this.__wbg_ptr, isLikeNone(count) ? 4294967297 : count >>> 0);
402
- }
403
- /**
404
- * Check if JIT is currently enabled.
405
- * @returns {boolean}
406
- */
407
- isJitEnabled() {
408
- const ret = wasm.wasmvm_isJitEnabled(this.__wbg_ptr);
409
- return ret !== 0;
410
- }
411
301
  /**
412
302
  * Get the current network connection status.
413
303
  * This checks the actual connection state by seeing if an IP was assigned.
@@ -436,26 +326,6 @@ var WasmVm = class _WasmVm {
436
326
  }
437
327
  return _WasmVm.__wrap(ret[0]);
438
328
  }
439
- /**
440
- * Clear JIT cache.
441
- */
442
- clearJitCache() {
443
- wasm.wasmvm_clearJitCache(this.__wbg_ptr);
444
- }
445
- /**
446
- * Enable or disable JIT compilation.
447
- * @param {boolean} enabled
448
- */
449
- setJitEnabled(enabled) {
450
- wasm.wasmvm_setJitEnabled(this.__wbg_ptr, enabled);
451
- }
452
- /**
453
- * Enable or disable JIT execution tracing.
454
- * @param {boolean} enabled
455
- */
456
- setJitTracing(enabled) {
457
- wasm.wasmvm_setJitTracing(this.__wbg_ptr, enabled);
458
- }
459
329
  /**
460
330
  * Get current memory usage (DRAM size) in bytes.
461
331
  * @returns {bigint}
@@ -464,20 +334,6 @@ var WasmVm = class _WasmVm {
464
334
  const ret = wasm.wasmvm_get_memory_usage(this.__wbg_ptr);
465
335
  return BigInt.asUintN(64, ret);
466
336
  }
467
- /**
468
- * Reset all JIT error tracking.
469
- */
470
- resetJitErrors() {
471
- wasm.wasmvm_resetJitErrors(this.__wbg_ptr);
472
- }
473
- /**
474
- * Get current JIT compilation threshold.
475
- * @returns {number}
476
- */
477
- getJitThreshold() {
478
- const ret = wasm.wasmvm_getJitThreshold(this.__wbg_ptr);
479
- return ret >>> 0;
480
- }
481
337
  /**
482
338
  * Get the SharedArrayBuffer for external worker management.
483
339
  * Returns None if not in SMP mode.
@@ -487,13 +343,6 @@ var WasmVm = class _WasmVm {
487
343
  const ret = wasm.wasmvm_get_shared_buffer(this.__wbg_ptr);
488
344
  return ret;
489
345
  }
490
- /**
491
- * Set JIT compilation threshold (min exec_count before compiling).
492
- * @param {number} threshold
493
- */
494
- setJitThreshold(threshold) {
495
- wasm.wasmvm_setJitThreshold(this.__wbg_ptr, threshold);
496
- }
497
346
  /**
498
347
  * Terminate all workers.
499
348
  */
@@ -506,43 +355,6 @@ var WasmVm = class _WasmVm {
506
355
  disconnect_network() {
507
356
  wasm.wasmvm_disconnect_network(this.__wbg_ptr);
508
357
  }
509
- /**
510
- * Get number of cached JIT blocks.
511
- * @returns {number}
512
- */
513
- getJitCacheSize() {
514
- const ret = wasm.wasmvm_getJitCacheSize(this.__wbg_ptr);
515
- return ret >>> 0;
516
- }
517
- /**
518
- * Add a PC to the JIT blacklist.
519
- * @param {bigint} pc
520
- */
521
- blacklistJitBlock(pc) {
522
- wasm.wasmvm_blacklistJitBlock(this.__wbg_ptr, pc);
523
- }
524
- /**
525
- * Clear the JIT blacklist.
526
- */
527
- clearJitBlacklist() {
528
- wasm.wasmvm_clearJitBlacklist(this.__wbg_ptr);
529
- }
530
- /**
531
- * Get JIT diagnostics as JSON string.
532
- * @returns {string}
533
- */
534
- getJitDiagnostics() {
535
- let deferred1_0;
536
- let deferred1_1;
537
- try {
538
- const ret = wasm.wasmvm_getJitDiagnostics(this.__wbg_ptr);
539
- deferred1_0 = ret[0];
540
- deferred1_1 = ret[1];
541
- return getStringFromWasm0(ret[0], ret[1]);
542
- } finally {
543
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
544
- }
545
- }
546
358
  /**
547
359
  * Check how many bytes are pending in the UART output buffer.
548
360
  * Useful for debugging output issues.
@@ -578,13 +390,6 @@ var WasmVm = class _WasmVm {
578
390
  const ret = wasm.wasmvm_inject_network_packet(this.__wbg_ptr, packet);
579
391
  return ret !== 0;
580
392
  }
581
- /**
582
- * Enable TLB fast-path optimization.
583
- * @param {boolean} enabled
584
- */
585
- setJitTlbFastPath(enabled) {
586
- wasm.wasmvm_setJitTlbFastPath(this.__wbg_ptr, enabled);
587
- }
588
393
  /**
589
394
  * Signal that workers can start executing.
590
395
  * Called by the main thread after hart 0 has finished initializing
@@ -602,21 +407,6 @@ var WasmVm = class _WasmVm {
602
407
  const ret = wasm.wasmvm_extract_network_packet(this.__wbg_ptr);
603
408
  return ret;
604
409
  }
605
- /**
606
- * Check if JIT tracing is enabled.
607
- * @returns {boolean}
608
- */
609
- isJitTracingEnabled() {
610
- const ret = wasm.wasmvm_isJitTracingEnabled(this.__wbg_ptr);
611
- return ret !== 0;
612
- }
613
- /**
614
- * Set maximum block size for JIT compilation.
615
- * @param {number} size
616
- */
617
- setJitMaxBlockSize(size) {
618
- wasm.wasmvm_setJitMaxBlockSize(this.__wbg_ptr, size);
619
- }
620
410
  /**
621
411
  * Set up an external network backend for packet bridging.
622
412
  * This is used by the Node.js CLI to bridge packets between the native
@@ -631,32 +421,6 @@ var WasmVm = class _WasmVm {
631
421
  throw takeFromExternrefTable0(ret[0]);
632
422
  }
633
423
  }
634
- /**
635
- * Get JIT cache hit ratio.
636
- * @returns {number}
637
- */
638
- getJitCacheHitRatio() {
639
- const ret = wasm.wasmvm_getJitCacheHitRatio(this.__wbg_ptr);
640
- return ret;
641
- }
642
- /**
643
- * Get JIT execution ratio (JIT executions / total executions).
644
- * Calculated from CPU's block cache statistics.
645
- * @returns {number}
646
- */
647
- getJitExecutionRatio() {
648
- const ret = wasm.wasmvm_getJitCacheHitRatio(this.__wbg_ptr);
649
- return ret;
650
- }
651
- /**
652
- * Invalidate JIT cache for a specific address.
653
- * @param {bigint} pc
654
- * @returns {boolean}
655
- */
656
- invalidateJitCacheAt(pc) {
657
- const ret = wasm.wasmvm_invalidateJitCacheAt(this.__wbg_ptr, pc);
658
- return ret !== 0;
659
- }
660
424
  /**
661
425
  * Set the assigned IP address for the external network.
662
426
  * Called when the native WebTransport addon receives an IP assignment.
@@ -667,14 +431,6 @@ var WasmVm = class _WasmVm {
667
431
  const ret = wasm.wasmvm_set_external_network_ip(this.__wbg_ptr, ip_bytes);
668
432
  return ret !== 0;
669
433
  }
670
- /**
671
- * Get JIT cache memory usage in bytes.
672
- * @returns {number}
673
- */
674
- getJitCacheMemoryUsage() {
675
- const ret = wasm.wasmvm_getJitCacheMemoryUsage(this.__wbg_ptr);
676
- return ret >>> 0;
677
- }
678
434
  /**
679
435
  * Get the number of pending RX packets.
680
436
  * @returns {number}
@@ -708,13 +464,6 @@ var WasmVm = class _WasmVm {
708
464
  const ret = wasm.wasmvm_is_external_network_connected(this.__wbg_ptr);
709
465
  return ret !== 0;
710
466
  }
711
- /**
712
- * Set interrupt check interval (0 = disabled).
713
- * @param {number} interval
714
- */
715
- setJitInterruptCheckInterval(interval) {
716
- wasm.wasmvm_setJitInterruptCheckInterval(this.__wbg_ptr, interval);
717
- }
718
467
  /**
719
468
  * Create a new VM instance and load a kernel (ELF or raw binary).
720
469
  *
@@ -1285,6 +1034,10 @@ function __wbg_get_imports() {
1285
1034
  return ret;
1286
1035
  }, arguments);
1287
1036
  };
1037
+ imports.wbg.__wbg_subarray_845f2f5bce7d061a = function(arg0, arg1, arg2) {
1038
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1039
+ return ret;
1040
+ };
1288
1041
  imports.wbg.__wbg_terminate_08a1236dd2e69da0 = function(arg0) {
1289
1042
  arg0.terminate();
1290
1043
  };
@@ -1313,30 +1066,30 @@ function __wbg_get_imports() {
1313
1066
  return ret;
1314
1067
  }, arguments);
1315
1068
  };
1069
+ imports.wbg.__wbindgen_cast_1b00663567edb453 = function(arg0, arg1) {
1070
+ const ret = makeClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h6be55d916a7a567c, wasm_bindgen__convert__closures_____invoke__h9493c87185cf2d12);
1071
+ return ret;
1072
+ };
1316
1073
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
1317
1074
  const ret = getStringFromWasm0(arg0, arg1);
1318
1075
  return ret;
1319
1076
  };
1320
- imports.wbg.__wbindgen_cast_32327f67251393a4 = function(arg0, arg1) {
1321
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h1292c9e7657b72ef, wasm_bindgen__convert__closures_____invoke__ha9a06e4d93c772bf);
1077
+ imports.wbg.__wbindgen_cast_22b48c66901f03d5 = function(arg0, arg1) {
1078
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hf225e18fc5ab9bc1, wasm_bindgen__convert__closures_____invoke__h39d3e89751b07765);
1322
1079
  return ret;
1323
1080
  };
1324
- imports.wbg.__wbindgen_cast_82c798e194eb44f0 = function(arg0, arg1) {
1325
- const ret = makeClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h1292c9e7657b72ef, wasm_bindgen__convert__closures_____invoke__h3eb569f20d255f19);
1081
+ imports.wbg.__wbindgen_cast_a93ea42108a71f00 = function(arg0, arg1) {
1082
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h6be55d916a7a567c, wasm_bindgen__convert__closures_____invoke__h02b024c830faf3c0);
1326
1083
  return ret;
1327
1084
  };
1328
- imports.wbg.__wbindgen_cast_a93ea42108a71f00 = function(arg0, arg1) {
1329
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h1292c9e7657b72ef, wasm_bindgen__convert__closures_____invoke__h320e929207365995);
1085
+ imports.wbg.__wbindgen_cast_af54cb5d64a8cc15 = function(arg0, arg1) {
1086
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h6be55d916a7a567c, wasm_bindgen__convert__closures_____invoke__hec486a7a364d96de);
1330
1087
  return ret;
1331
1088
  };
1332
1089
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
1333
1090
  const ret = arg0;
1334
1091
  return ret;
1335
1092
  };
1336
- imports.wbg.__wbindgen_cast_dc00c1264d481122 = function(arg0, arg1) {
1337
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hf225e18fc5ab9bc1, wasm_bindgen__convert__closures_____invoke__h39d3e89751b07765);
1338
- return ret;
1339
- };
1340
1093
  imports.wbg.__wbindgen_init_externref_table = function() {
1341
1094
  const table = wasm.__wbindgen_externrefs;
1342
1095
  const offset = table.grow(4);
@@ -1391,7 +1144,6 @@ async function __wbg_init(module_or_path) {
1391
1144
  var riscv_vm_default = __wbg_init;
1392
1145
 
1393
1146
  export {
1394
- JitWorkerContext,
1395
1147
  NetworkStatus,
1396
1148
  WasmVm,
1397
1149
  WorkerState,