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.
- package/build/{chunk-S3CJQKBH.mjs → chunk-IMQM5K6V.mjs} +21 -269
- package/build/cli.js +23 -333
- package/build/index.d.ts +6 -391
- package/build/index.js +23 -333
- package/build/index.mjs +3 -65
- package/build/{riscv_vm-B3MWUK6W.mjs → riscv_vm-L5R6KUXO.mjs} +1 -3
- package/build/worker.js +22 -19
- package/native/riscv-vm-native.darwin-arm64.node +0 -0
- package/native/riscv-vm-native.darwin-x64.node +0 -0
- package/native/riscv-vm-native.linux-arm64-gnu.node +0 -0
- package/native/riscv-vm-native.linux-arm64-musl.node +0 -0
- package/native/riscv-vm-native.linux-x64-gnu.node +0 -0
- package/native/riscv-vm-native.linux-x64-musl.node +0 -0
- package/native/riscv-vm-native.win32-x64-msvc.node +0 -0
- package/package.json +1 -6
package/build/index.d.ts
CHANGED
|
@@ -1,36 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
-
declare class JitWorkerContext {
|
|
5
|
-
free(): void;
|
|
6
|
-
[Symbol.dispose](): void;
|
|
7
|
-
/**
|
|
8
|
-
* Create a new JIT worker context with custom configuration.
|
|
9
|
-
*
|
|
10
|
-
* # Arguments
|
|
11
|
-
* * `min_block_size` - Minimum number of instructions for JIT compilation
|
|
12
|
-
* * `debug_wat` - Enable debug WAT output
|
|
13
|
-
*/
|
|
14
|
-
static newWithConfig(min_block_size: number, debug_wat: boolean): JitWorkerContext;
|
|
15
|
-
/**
|
|
16
|
-
* Create a new JIT worker context with default configuration.
|
|
17
|
-
*/
|
|
18
|
-
constructor();
|
|
19
|
-
/**
|
|
20
|
-
* Compile a block from serialized request bytes.
|
|
21
|
-
*
|
|
22
|
-
* # Arguments
|
|
23
|
-
* * `request_bytes` - Bincode-serialized `CompileRequest`
|
|
24
|
-
*
|
|
25
|
-
* # Returns
|
|
26
|
-
* A JavaScript object with the compilation result:
|
|
27
|
-
* - On success: `{ success: true, pc: number, wasmBytes: Uint8Array }`
|
|
28
|
-
* - On unsuitable: `{ success: false, pc: number, status: 'unsuitable' }`
|
|
29
|
-
* - On error: `{ success: false, pc: number, status: 'error' }`
|
|
30
|
-
*/
|
|
31
|
-
compile(request_bytes: Uint8Array): any;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
4
|
/**
|
|
35
5
|
* Network connection status for the WASM VM.
|
|
36
6
|
*/
|
|
@@ -60,18 +30,6 @@ declare class WasmVm {
|
|
|
60
30
|
* Print a status message to UART output (visible in browser).
|
|
61
31
|
*/
|
|
62
32
|
print_status(message: string): void;
|
|
63
|
-
/**
|
|
64
|
-
* Re-enable JIT after it was disabled by errors.
|
|
65
|
-
*/
|
|
66
|
-
reenableJit(): void;
|
|
67
|
-
/**
|
|
68
|
-
* Get JIT statistics as JSON string.
|
|
69
|
-
*/
|
|
70
|
-
getJitStats(): string;
|
|
71
|
-
/**
|
|
72
|
-
* Enable or disable JIT debug WAT output.
|
|
73
|
-
*/
|
|
74
|
-
setJitDebug(debug: boolean): void;
|
|
75
33
|
/**
|
|
76
34
|
* Start worker threads for secondary harts (1..num_harts).
|
|
77
35
|
*
|
|
@@ -82,14 +40,6 @@ declare class WasmVm {
|
|
|
82
40
|
* * `worker_url` - URL to the worker script (e.g., "/worker.js")
|
|
83
41
|
*/
|
|
84
42
|
start_workers(worker_url: string): void;
|
|
85
|
-
/**
|
|
86
|
-
* Dump recent JIT trace events to console.
|
|
87
|
-
*/
|
|
88
|
-
dumpJitTrace(count?: number | null): void;
|
|
89
|
-
/**
|
|
90
|
-
* Check if JIT is currently enabled.
|
|
91
|
-
*/
|
|
92
|
-
isJitEnabled(): boolean;
|
|
93
43
|
/**
|
|
94
44
|
* Get the current network connection status.
|
|
95
45
|
* This checks the actual connection state by seeing if an IP was assigned.
|
|
@@ -103,39 +53,15 @@ declare class WasmVm {
|
|
|
103
53
|
* * `num_harts` - Number of harts (0 = auto-detect)
|
|
104
54
|
*/
|
|
105
55
|
static new_with_harts(kernel: Uint8Array, num_harts: number): WasmVm;
|
|
106
|
-
/**
|
|
107
|
-
* Clear JIT cache.
|
|
108
|
-
*/
|
|
109
|
-
clearJitCache(): void;
|
|
110
|
-
/**
|
|
111
|
-
* Enable or disable JIT compilation.
|
|
112
|
-
*/
|
|
113
|
-
setJitEnabled(enabled: boolean): void;
|
|
114
|
-
/**
|
|
115
|
-
* Enable or disable JIT execution tracing.
|
|
116
|
-
*/
|
|
117
|
-
setJitTracing(enabled: boolean): void;
|
|
118
56
|
/**
|
|
119
57
|
* Get current memory usage (DRAM size) in bytes.
|
|
120
58
|
*/
|
|
121
59
|
get_memory_usage(): bigint;
|
|
122
|
-
/**
|
|
123
|
-
* Reset all JIT error tracking.
|
|
124
|
-
*/
|
|
125
|
-
resetJitErrors(): void;
|
|
126
|
-
/**
|
|
127
|
-
* Get current JIT compilation threshold.
|
|
128
|
-
*/
|
|
129
|
-
getJitThreshold(): number;
|
|
130
60
|
/**
|
|
131
61
|
* Get the SharedArrayBuffer for external worker management.
|
|
132
62
|
* Returns None if not in SMP mode.
|
|
133
63
|
*/
|
|
134
64
|
get_shared_buffer(): SharedArrayBuffer | undefined;
|
|
135
|
-
/**
|
|
136
|
-
* Set JIT compilation threshold (min exec_count before compiling).
|
|
137
|
-
*/
|
|
138
|
-
setJitThreshold(threshold: number): void;
|
|
139
65
|
/**
|
|
140
66
|
* Terminate all workers.
|
|
141
67
|
*/
|
|
@@ -144,22 +70,6 @@ declare class WasmVm {
|
|
|
144
70
|
* Disconnect from the network.
|
|
145
71
|
*/
|
|
146
72
|
disconnect_network(): void;
|
|
147
|
-
/**
|
|
148
|
-
* Get number of cached JIT blocks.
|
|
149
|
-
*/
|
|
150
|
-
getJitCacheSize(): number;
|
|
151
|
-
/**
|
|
152
|
-
* Add a PC to the JIT blacklist.
|
|
153
|
-
*/
|
|
154
|
-
blacklistJitBlock(pc: bigint): void;
|
|
155
|
-
/**
|
|
156
|
-
* Clear the JIT blacklist.
|
|
157
|
-
*/
|
|
158
|
-
clearJitBlacklist(): void;
|
|
159
|
-
/**
|
|
160
|
-
* Get JIT diagnostics as JSON string.
|
|
161
|
-
*/
|
|
162
|
-
getJitDiagnostics(): string;
|
|
163
73
|
/**
|
|
164
74
|
* Check how many bytes are pending in the UART output buffer.
|
|
165
75
|
* Useful for debugging output issues.
|
|
@@ -175,10 +85,6 @@ declare class WasmVm {
|
|
|
175
85
|
* Called from JavaScript when the native WebTransport addon receives a packet.
|
|
176
86
|
*/
|
|
177
87
|
inject_network_packet(packet: Uint8Array): boolean;
|
|
178
|
-
/**
|
|
179
|
-
* Enable TLB fast-path optimization.
|
|
180
|
-
*/
|
|
181
|
-
setJitTlbFastPath(enabled: boolean): void;
|
|
182
88
|
/**
|
|
183
89
|
* Signal that workers can start executing.
|
|
184
90
|
* Called by the main thread after hart 0 has finished initializing
|
|
@@ -190,14 +96,6 @@ declare class WasmVm {
|
|
|
190
96
|
* Returns the packet data or null if no packet is pending.
|
|
191
97
|
*/
|
|
192
98
|
extract_network_packet(): Uint8Array | undefined;
|
|
193
|
-
/**
|
|
194
|
-
* Check if JIT tracing is enabled.
|
|
195
|
-
*/
|
|
196
|
-
isJitTracingEnabled(): boolean;
|
|
197
|
-
/**
|
|
198
|
-
* Set maximum block size for JIT compilation.
|
|
199
|
-
*/
|
|
200
|
-
setJitMaxBlockSize(size: number): void;
|
|
201
99
|
/**
|
|
202
100
|
* Set up an external network backend for packet bridging.
|
|
203
101
|
* This is used by the Node.js CLI to bridge packets between the native
|
|
@@ -206,28 +104,11 @@ declare class WasmVm {
|
|
|
206
104
|
* @param mac_bytes - MAC address as 6 bytes [0x52, 0x54, 0x00, 0x12, 0x34, 0x56]
|
|
207
105
|
*/
|
|
208
106
|
setup_external_network(mac_bytes: Uint8Array): void;
|
|
209
|
-
/**
|
|
210
|
-
* Get JIT cache hit ratio.
|
|
211
|
-
*/
|
|
212
|
-
getJitCacheHitRatio(): number;
|
|
213
|
-
/**
|
|
214
|
-
* Get JIT execution ratio (JIT executions / total executions).
|
|
215
|
-
* Calculated from CPU's block cache statistics.
|
|
216
|
-
*/
|
|
217
|
-
getJitExecutionRatio(): number;
|
|
218
|
-
/**
|
|
219
|
-
* Invalidate JIT cache for a specific address.
|
|
220
|
-
*/
|
|
221
|
-
invalidateJitCacheAt(pc: bigint): boolean;
|
|
222
107
|
/**
|
|
223
108
|
* Set the assigned IP address for the external network.
|
|
224
109
|
* Called when the native WebTransport addon receives an IP assignment.
|
|
225
110
|
*/
|
|
226
111
|
set_external_network_ip(ip_bytes: Uint8Array): boolean;
|
|
227
|
-
/**
|
|
228
|
-
* Get JIT cache memory usage in bytes.
|
|
229
|
-
*/
|
|
230
|
-
getJitCacheMemoryUsage(): number;
|
|
231
112
|
/**
|
|
232
113
|
* Get the number of pending RX packets.
|
|
233
114
|
*/
|
|
@@ -245,10 +126,6 @@ declare class WasmVm {
|
|
|
245
126
|
* Check if external network is connected (has IP assigned).
|
|
246
127
|
*/
|
|
247
128
|
is_external_network_connected(): boolean;
|
|
248
|
-
/**
|
|
249
|
-
* Set interrupt check interval (0 = disabled).
|
|
250
|
-
*/
|
|
251
|
-
setJitInterruptCheckInterval(interval: number): void;
|
|
252
129
|
/**
|
|
253
130
|
* Create a new VM instance and load a kernel (ELF or raw binary).
|
|
254
131
|
*
|
|
@@ -384,39 +261,22 @@ type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Modul
|
|
|
384
261
|
|
|
385
262
|
interface InitOutput {
|
|
386
263
|
readonly memory: WebAssembly.Memory;
|
|
387
|
-
readonly __wbg_jitworkercontext_free: (a: number, b: number) => void;
|
|
388
264
|
readonly __wbg_wasmvm_free: (a: number, b: number) => void;
|
|
389
265
|
readonly __wbg_workerstate_free: (a: number, b: number) => void;
|
|
390
|
-
readonly jitworkercontext_compile: (a: number, b: number, c: number) => any;
|
|
391
|
-
readonly jitworkercontext_new: () => number;
|
|
392
|
-
readonly jitworkercontext_newWithConfig: (a: number, b: number) => number;
|
|
393
266
|
readonly wasmvm_allow_workers_to_start: (a: number) => void;
|
|
394
|
-
readonly wasmvm_blacklistJitBlock: (a: number, b: bigint) => void;
|
|
395
|
-
readonly wasmvm_clearJitBlacklist: (a: number) => void;
|
|
396
|
-
readonly wasmvm_clearJitCache: (a: number) => void;
|
|
397
267
|
readonly wasmvm_connect_webtransport: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
398
268
|
readonly wasmvm_disconnect_network: (a: number) => void;
|
|
399
|
-
readonly wasmvm_dumpJitTrace: (a: number, b: number) => void;
|
|
400
269
|
readonly wasmvm_entry_pc: (a: number) => bigint;
|
|
401
270
|
readonly wasmvm_external_network_rx_pending: (a: number) => number;
|
|
402
271
|
readonly wasmvm_external_network_tx_pending: (a: number) => number;
|
|
403
272
|
readonly wasmvm_extract_all_network_packets: (a: number) => any;
|
|
404
273
|
readonly wasmvm_extract_network_packet: (a: number) => any;
|
|
405
|
-
readonly wasmvm_getJitCacheHitRatio: (a: number) => number;
|
|
406
|
-
readonly wasmvm_getJitCacheMemoryUsage: (a: number) => number;
|
|
407
|
-
readonly wasmvm_getJitCacheSize: (a: number) => number;
|
|
408
|
-
readonly wasmvm_getJitDiagnostics: (a: number) => [number, number];
|
|
409
|
-
readonly wasmvm_getJitStats: (a: number) => [number, number];
|
|
410
|
-
readonly wasmvm_getJitThreshold: (a: number) => number;
|
|
411
274
|
readonly wasmvm_get_memory_usage: (a: number) => bigint;
|
|
412
275
|
readonly wasmvm_get_output: (a: number) => number;
|
|
413
276
|
readonly wasmvm_get_shared_buffer: (a: number) => any;
|
|
414
277
|
readonly wasmvm_halt_code: (a: number) => bigint;
|
|
415
278
|
readonly wasmvm_inject_network_packet: (a: number, b: any) => number;
|
|
416
279
|
readonly wasmvm_input: (a: number, b: number) => void;
|
|
417
|
-
readonly wasmvm_invalidateJitCacheAt: (a: number, b: bigint) => number;
|
|
418
|
-
readonly wasmvm_isJitEnabled: (a: number) => number;
|
|
419
|
-
readonly wasmvm_isJitTracingEnabled: (a: number) => number;
|
|
420
280
|
readonly wasmvm_is_external_network_connected: (a: number) => number;
|
|
421
281
|
readonly wasmvm_is_halted: (a: number) => number;
|
|
422
282
|
readonly wasmvm_is_smp: (a: number) => number;
|
|
@@ -427,15 +287,6 @@ interface InitOutput {
|
|
|
427
287
|
readonly wasmvm_num_harts: (a: number) => number;
|
|
428
288
|
readonly wasmvm_print_banner: (a: number) => void;
|
|
429
289
|
readonly wasmvm_print_status: (a: number, b: number, c: number) => void;
|
|
430
|
-
readonly wasmvm_reenableJit: (a: number) => void;
|
|
431
|
-
readonly wasmvm_resetJitErrors: (a: number) => void;
|
|
432
|
-
readonly wasmvm_setJitDebug: (a: number, b: number) => void;
|
|
433
|
-
readonly wasmvm_setJitEnabled: (a: number, b: number) => void;
|
|
434
|
-
readonly wasmvm_setJitInterruptCheckInterval: (a: number, b: number) => void;
|
|
435
|
-
readonly wasmvm_setJitMaxBlockSize: (a: number, b: number) => void;
|
|
436
|
-
readonly wasmvm_setJitThreshold: (a: number, b: number) => void;
|
|
437
|
-
readonly wasmvm_setJitTlbFastPath: (a: number, b: number) => void;
|
|
438
|
-
readonly wasmvm_setJitTracing: (a: number, b: number) => void;
|
|
439
290
|
readonly wasmvm_set_external_network_ip: (a: number, b: any) => number;
|
|
440
291
|
readonly wasmvm_setup_external_network: (a: number, b: any) => [number, number];
|
|
441
292
|
readonly wasmvm_start_workers: (a: number, b: number, c: number) => [number, number];
|
|
@@ -449,13 +300,12 @@ interface InitOutput {
|
|
|
449
300
|
readonly workerstate_new: (a: number, b: any, c: bigint) => number;
|
|
450
301
|
readonly workerstate_step_batch: (a: number, b: number) => number;
|
|
451
302
|
readonly workerstate_step_count: (a: number) => bigint;
|
|
452
|
-
readonly
|
|
453
|
-
readonly
|
|
454
|
-
readonly wasm_bindgen__closure__destroy__h1292c9e7657b72ef: (a: number, b: number) => void;
|
|
455
|
-
readonly wasm_bindgen__convert__closures_____invoke__h3eb569f20d255f19: (a: number, b: number) => void;
|
|
303
|
+
readonly wasm_bindgen__convert__closures_____invoke__h02b024c830faf3c0: (a: number, b: number, c: any) => void;
|
|
304
|
+
readonly wasm_bindgen__closure__destroy__h6be55d916a7a567c: (a: number, b: number) => void;
|
|
456
305
|
readonly wasm_bindgen__convert__closures_____invoke__h39d3e89751b07765: (a: number, b: number, c: any) => void;
|
|
457
306
|
readonly wasm_bindgen__closure__destroy__hf225e18fc5ab9bc1: (a: number, b: number) => void;
|
|
458
|
-
readonly
|
|
307
|
+
readonly wasm_bindgen__convert__closures_____invoke__h9493c87185cf2d12: (a: number, b: number) => void;
|
|
308
|
+
readonly wasm_bindgen__convert__closures_____invoke__hec486a7a364d96de: (a: number, b: number) => void;
|
|
459
309
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
460
310
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
461
311
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
@@ -490,8 +340,6 @@ declare function __wbg_init (module_or_path?: { module_or_path: InitInput | Prom
|
|
|
490
340
|
|
|
491
341
|
type __pkg_riscv_vm_InitInput = InitInput;
|
|
492
342
|
type __pkg_riscv_vm_InitOutput = InitOutput;
|
|
493
|
-
type __pkg_riscv_vm_JitWorkerContext = JitWorkerContext;
|
|
494
|
-
declare const __pkg_riscv_vm_JitWorkerContext: typeof JitWorkerContext;
|
|
495
343
|
type __pkg_riscv_vm_NetworkStatus = NetworkStatus;
|
|
496
344
|
declare const __pkg_riscv_vm_NetworkStatus: typeof NetworkStatus;
|
|
497
345
|
type __pkg_riscv_vm_SyncInitInput = SyncInitInput;
|
|
@@ -505,7 +353,7 @@ declare const __pkg_riscv_vm_initSync: typeof initSync;
|
|
|
505
353
|
declare const __pkg_riscv_vm_worker_check_interrupts: typeof worker_check_interrupts;
|
|
506
354
|
declare const __pkg_riscv_vm_worker_entry: typeof worker_entry;
|
|
507
355
|
declare namespace __pkg_riscv_vm {
|
|
508
|
-
export { type __pkg_riscv_vm_InitInput as InitInput, type __pkg_riscv_vm_InitOutput as InitOutput,
|
|
356
|
+
export { type __pkg_riscv_vm_InitInput as InitInput, type __pkg_riscv_vm_InitOutput as InitOutput, __pkg_riscv_vm_NetworkStatus as NetworkStatus, type __pkg_riscv_vm_SyncInitInput as SyncInitInput, __pkg_riscv_vm_WasmVm as WasmVm, __pkg_riscv_vm_WorkerState as WorkerState, __pkg_riscv_vm_WorkerStepResult as WorkerStepResult, __wbg_init as default, __pkg_riscv_vm_initSync as initSync, __pkg_riscv_vm_worker_check_interrupts as worker_check_interrupts, __pkg_riscv_vm_worker_entry as worker_entry };
|
|
509
357
|
}
|
|
510
358
|
|
|
511
359
|
/**
|
|
@@ -558,209 +406,6 @@ declare function isHalted(sharedMem: SharedArrayBuffer): boolean;
|
|
|
558
406
|
|
|
559
407
|
declare function WasmInternal(): Promise<typeof __pkg_riscv_vm>;
|
|
560
408
|
|
|
561
|
-
/**
|
|
562
|
-
* Message sent to JIT worker to request compilation.
|
|
563
|
-
*/
|
|
564
|
-
interface JitCompileRequest {
|
|
565
|
-
type: "compile";
|
|
566
|
-
/** Starting PC of the block */
|
|
567
|
-
pc: number;
|
|
568
|
-
/** Bincode-serialized CompileRequest bytes */
|
|
569
|
-
requestBytes: ArrayBuffer;
|
|
570
|
-
}
|
|
571
|
-
/**
|
|
572
|
-
*
|
|
573
|
-
*
|
|
574
|
-
* Message received from JIT worker with compilation result.
|
|
575
|
-
*/
|
|
576
|
-
interface JitCompileResponse {
|
|
577
|
-
type: "compiled";
|
|
578
|
-
/** Starting PC of the compiled block */
|
|
579
|
-
pc: number;
|
|
580
|
-
/** Whether compilation succeeded */
|
|
581
|
-
success: boolean;
|
|
582
|
-
/** Compiled WASM bytes (if successful) */
|
|
583
|
-
wasmBytes?: Uint8Array;
|
|
584
|
-
/** Status if not successful */
|
|
585
|
-
status?: "unsuitable" | "error";
|
|
586
|
-
/** Compilation time in microseconds */
|
|
587
|
-
compileTimeUs?: number;
|
|
588
|
-
}
|
|
589
|
-
/**
|
|
590
|
-
* JIT worker ready message.
|
|
591
|
-
*/
|
|
592
|
-
interface JitWorkerReadyMessage {
|
|
593
|
-
type: "ready";
|
|
594
|
-
}
|
|
595
|
-
/**
|
|
596
|
-
* JIT worker error message.
|
|
597
|
-
*/
|
|
598
|
-
interface JitWorkerErrorMessage {
|
|
599
|
-
type: "error";
|
|
600
|
-
message: string;
|
|
601
|
-
}
|
|
602
|
-
/**
|
|
603
|
-
* All possible JIT worker outbound messages.
|
|
604
|
-
*/
|
|
605
|
-
type JitWorkerOutboundMessage = JitCompileResponse | JitWorkerReadyMessage | JitWorkerErrorMessage;
|
|
606
|
-
/**
|
|
607
|
-
* All possible JIT worker inbound messages.
|
|
608
|
-
*/
|
|
609
|
-
type JitWorkerInboundMessage = JitCompileRequest;
|
|
610
|
-
/**
|
|
611
|
-
* Cache statistics from the JIT system.
|
|
612
|
-
*/
|
|
613
|
-
interface JitCacheStats {
|
|
614
|
-
/** Number of cache hits */
|
|
615
|
-
hits: number;
|
|
616
|
-
/** Number of cache misses */
|
|
617
|
-
misses: number;
|
|
618
|
-
/** Number of blocks inserted into cache */
|
|
619
|
-
insertions: number;
|
|
620
|
-
/** Number of blocks evicted from cache */
|
|
621
|
-
evictions: number;
|
|
622
|
-
/** Total bytes of WASM compiled */
|
|
623
|
-
bytesCompiled: number;
|
|
624
|
-
/** Number of cache invalidations */
|
|
625
|
-
invalidations: number;
|
|
626
|
-
}
|
|
627
|
-
/**
|
|
628
|
-
* Execution trace statistics.
|
|
629
|
-
*/
|
|
630
|
-
interface JitTraceStats {
|
|
631
|
-
/** Number of JIT block executions */
|
|
632
|
-
jitExecutions: number;
|
|
633
|
-
/** Number of interpreter block executions */
|
|
634
|
-
interpExecutions: number;
|
|
635
|
-
/** Number of successful compilations */
|
|
636
|
-
compilations: number;
|
|
637
|
-
/** Number of failed compilations */
|
|
638
|
-
compilationFailures: number;
|
|
639
|
-
/** Total WASM bytes compiled */
|
|
640
|
-
totalWasmBytes: number;
|
|
641
|
-
/** Total compilation time in microseconds */
|
|
642
|
-
totalCompileTimeUs: number;
|
|
643
|
-
/** Number of traps during JIT execution */
|
|
644
|
-
traps: number;
|
|
645
|
-
/** Number of cache invalidations */
|
|
646
|
-
invalidations: number;
|
|
647
|
-
/** Number of cache hits */
|
|
648
|
-
cacheHits: number;
|
|
649
|
-
/** Number of cache misses */
|
|
650
|
-
cacheMisses: number;
|
|
651
|
-
/** Number of interrupt-triggered exits */
|
|
652
|
-
interruptExits: number;
|
|
653
|
-
}
|
|
654
|
-
/**
|
|
655
|
-
* Complete JIT diagnostics information.
|
|
656
|
-
*/
|
|
657
|
-
interface JitDiagnostics {
|
|
658
|
-
/** Whether JIT is currently enabled and operational */
|
|
659
|
-
enabled: boolean;
|
|
660
|
-
/** Whether JIT was disabled due to errors */
|
|
661
|
-
disabledByError: boolean;
|
|
662
|
-
/** Reason JIT was disabled (if applicable) */
|
|
663
|
-
disabledReason: string | null;
|
|
664
|
-
/** Number of consecutive compilation failures */
|
|
665
|
-
consecutiveFailures: number;
|
|
666
|
-
/** Total number of compilation failures */
|
|
667
|
-
totalFailures: number;
|
|
668
|
-
/** Total number of successful compilations */
|
|
669
|
-
successfulCompilations: number;
|
|
670
|
-
/** Number of blocks that failed to compile (blacklisted) */
|
|
671
|
-
failedBlocksCount: number;
|
|
672
|
-
/** Number of blocks currently in cache */
|
|
673
|
-
cacheEntries: number;
|
|
674
|
-
/** Current cache memory usage in bytes */
|
|
675
|
-
cacheBytes: number;
|
|
676
|
-
/** Cache statistics */
|
|
677
|
-
cacheStats: JitCacheStats;
|
|
678
|
-
/** Trace statistics */
|
|
679
|
-
traceStats: JitTraceStats;
|
|
680
|
-
}
|
|
681
|
-
/**
|
|
682
|
-
* JIT configuration options.
|
|
683
|
-
*/
|
|
684
|
-
interface JitConfig {
|
|
685
|
-
/** Enable JIT compilation (default: true) */
|
|
686
|
-
enabled?: boolean;
|
|
687
|
-
/** Minimum execution count before compiling (default: 50) */
|
|
688
|
-
compileThreshold?: number;
|
|
689
|
-
/** Maximum block size in ops (default: 256) */
|
|
690
|
-
maxBlockSize?: number;
|
|
691
|
-
/** Maximum WASM module size in bytes (default: 65536) */
|
|
692
|
-
maxWasmSize?: number;
|
|
693
|
-
/** Maximum cache entries (default: 1024) */
|
|
694
|
-
cacheMaxEntries?: number;
|
|
695
|
-
/** Maximum cache size in bytes (default: 16MB) */
|
|
696
|
-
cacheMaxBytes?: number;
|
|
697
|
-
/** Enable debug WAT output to console (default: false) */
|
|
698
|
-
debugWat?: boolean;
|
|
699
|
-
/** Enable execution tracing (default: false) */
|
|
700
|
-
traceEnabled?: boolean;
|
|
701
|
-
/** Compilation timeout in ms (default: 100, 0=no timeout) */
|
|
702
|
-
compileTimeoutMs?: number;
|
|
703
|
-
/** Max consecutive failures before disabling (default: 10) */
|
|
704
|
-
maxConsecutiveFailures?: number;
|
|
705
|
-
/** Enable TLB fast-path optimization (default: false) */
|
|
706
|
-
enableTlbFastPath?: boolean;
|
|
707
|
-
/** Interrupt check interval in ops (default: 32, 0=disabled) */
|
|
708
|
-
interruptCheckInterval?: number;
|
|
709
|
-
}
|
|
710
|
-
/**
|
|
711
|
-
* Extended WasmVm interface with JIT methods.
|
|
712
|
-
*
|
|
713
|
-
* This interface extends the base WasmVm class exported from the WASM module
|
|
714
|
-
* with type definitions for all JIT-related methods.
|
|
715
|
-
*/
|
|
716
|
-
interface WasmVmJitMethods {
|
|
717
|
-
/** Enable or disable JIT compilation */
|
|
718
|
-
setJitEnabled(enabled: boolean): void;
|
|
719
|
-
/** Check if JIT is currently enabled and operational */
|
|
720
|
-
isJitEnabled(): boolean;
|
|
721
|
-
/** Re-enable JIT after it was disabled by errors */
|
|
722
|
-
reenableJit(): void;
|
|
723
|
-
/** Enable/disable JIT debug WAT output to console */
|
|
724
|
-
setJitDebug(debug: boolean): void;
|
|
725
|
-
/** Enable/disable JIT execution tracing */
|
|
726
|
-
setJitTracing(enabled: boolean): void;
|
|
727
|
-
/** Check if JIT tracing is enabled */
|
|
728
|
-
isJitTracingEnabled(): boolean;
|
|
729
|
-
/** Get JIT diagnostics as JSON string */
|
|
730
|
-
getJitDiagnostics(): string;
|
|
731
|
-
/** Get JIT statistics as JSON string */
|
|
732
|
-
getJitStats(): string;
|
|
733
|
-
/** Dump recent JIT trace events to console */
|
|
734
|
-
dumpJitTrace(count?: number): void;
|
|
735
|
-
/** Clear all entries from JIT cache */
|
|
736
|
-
clearJitCache(): void;
|
|
737
|
-
/** Invalidate JIT cache for a specific PC */
|
|
738
|
-
invalidateJitCacheAt(pc: bigint): boolean;
|
|
739
|
-
/** Get number of cached JIT blocks */
|
|
740
|
-
getJitCacheSize(): number;
|
|
741
|
-
/** Get JIT cache memory usage in bytes */
|
|
742
|
-
getJitCacheMemoryUsage(): number;
|
|
743
|
-
/** Set JIT compilation threshold */
|
|
744
|
-
setJitThreshold(threshold: number): void;
|
|
745
|
-
/** Get current JIT compilation threshold */
|
|
746
|
-
getJitThreshold(): number;
|
|
747
|
-
/** Set maximum block size for JIT compilation */
|
|
748
|
-
setJitMaxBlockSize(size: number): void;
|
|
749
|
-
/** Add a PC to the JIT blacklist */
|
|
750
|
-
blacklistJitBlock(pc: bigint): void;
|
|
751
|
-
/** Clear the JIT blacklist */
|
|
752
|
-
clearJitBlacklist(): void;
|
|
753
|
-
/** Reset all JIT error tracking */
|
|
754
|
-
resetJitErrors(): void;
|
|
755
|
-
/** Enable TLB fast-path optimization */
|
|
756
|
-
setJitTlbFastPath(enabled: boolean): void;
|
|
757
|
-
/** Set interrupt check interval (0 = disabled) */
|
|
758
|
-
setJitInterruptCheckInterval(interval: number): void;
|
|
759
|
-
/** Get JIT execution ratio (0.0 to 1.0) */
|
|
760
|
-
getJitExecutionRatio(): number;
|
|
761
|
-
/** Get JIT cache hit ratio (0.0 to 1.0) */
|
|
762
|
-
getJitCacheHitRatio(): number;
|
|
763
|
-
}
|
|
764
409
|
interface VmOptions {
|
|
765
410
|
/** Number of harts (auto-detected if not specified) */
|
|
766
411
|
harts?: number;
|
|
@@ -848,35 +493,5 @@ interface WorkerManager {
|
|
|
848
493
|
* Create a worker manager for manual worker control.
|
|
849
494
|
*/
|
|
850
495
|
declare function createWorkerManager(): WorkerManager;
|
|
851
|
-
/**
|
|
852
|
-
* Parse JIT diagnostics from the VM.
|
|
853
|
-
*
|
|
854
|
-
* @param vm - WasmVm instance with JIT methods
|
|
855
|
-
* @returns Parsed JIT diagnostics object
|
|
856
|
-
*/
|
|
857
|
-
declare function parseJitDiagnostics(vm: WasmVmJitMethods): JitDiagnostics;
|
|
858
|
-
/**
|
|
859
|
-
* Parse JIT trace statistics from the VM.
|
|
860
|
-
*
|
|
861
|
-
* @param vm - WasmVm instance with JIT methods
|
|
862
|
-
* @returns Parsed JIT trace statistics object
|
|
863
|
-
*/
|
|
864
|
-
declare function parseJitStats(vm: WasmVmJitMethods): JitTraceStats;
|
|
865
|
-
/**
|
|
866
|
-
* Configure JIT with a partial configuration object.
|
|
867
|
-
*
|
|
868
|
-
* @param vm - WasmVm instance with JIT methods
|
|
869
|
-
* @param config - Partial JIT configuration
|
|
870
|
-
*/
|
|
871
|
-
declare function configureJit(vm: WasmVmJitMethods, config: JitConfig): void;
|
|
872
|
-
/**
|
|
873
|
-
* Print JIT diagnostic summary to console.
|
|
874
|
-
*
|
|
875
|
-
* Displays a formatted summary of JIT status, compilations,
|
|
876
|
-
* cache statistics, and hit ratios.
|
|
877
|
-
*
|
|
878
|
-
* @param vm - WasmVm instance with JIT methods
|
|
879
|
-
*/
|
|
880
|
-
declare function printJitSummary(vm: WasmVmJitMethods): void;
|
|
881
496
|
|
|
882
|
-
export {
|
|
497
|
+
export { NetworkStatus, REQUIRED_HEADERS, type SharedMemorySupport, type VmOptions, WasmInternal, WasmVm, type WorkerErrorMessage, type WorkerHaltedMessage, type WorkerInitMessage, type WorkerManager, type WorkerOutboundMessage, type WorkerReadyMessage, checkSharedMemorySupport, createVM, createWorkerManager, isCrossOriginIsolated, isHaltRequested, isHalted, requestHalt, runVM };
|