Skip to main content

Module region_jit

Module region_jit 

Source
Expand description

The WS6 browser WASM-JIT tier (region/function emit + host instantiation). Only the running of emitted modules touches wasmi/js_sys, so this — and only this — is gated behind the wasm-jit feature; encode/func (pure byte emission) are always built. WS6 (FINISH_INTERPRETER Phase 13) — the browser WASM-JIT tier.

The native copy-and-patch JIT (logicaffeine_forge) patches x86 stencils into executable memory — impossible in a browser, where there is no executable memory to patch and only WebAssembly bytecode runs. The only path to JIT-level speed in WASM is a second code generator that emits a fresh WebAssembly module per hot region and instantiates it via the host’s WebAssembly.instantiate. The byte emitter is func; this module is the tier around it — the tier-up bookkeeping plus the host seam that instantiates and calls the emitted modules.

It lives in the VM crate (not logicaffeine_forge) because forge is #![cfg(not(target_arch = "wasm32"))] — it cannot build for wasm32 — whereas this backend must build for and run on wasm32. The native 2.55×-C x86 JIT is untouched.

Structs§

WasmTier
The runtime WASM-JIT tier: per-function call counters plus a cache of compiled + instantiated modules. When a function crosses the hot threshold it is lowered to WASM and instantiated; subsequent calls dispatch to the compiled module. Functions the codegen declines are remembered as Ineligible and stay on the bytecode tier. The VM’s Op::Call consults this only under #[cfg(feature = "wasm-jit")], so the default build never carries it.