Expand description
Background AOT-native compilation (HOTSWAP §Axis-3 / P18).
A very-hot function’s OPTIMIZED form is compiled to a cdylib and loaded on a WORKER
thread — rustc is seconds, so it must never block the interpreter — then the loaded
function is installed via Vm::install_aot_native at a drain point and runs at
compiled-binary speed from then on. This is the AOT path to the coarse-tiered
“optimize hot functions during the run” goal: it reuses the proven on-demand build
(crate::compile::aot_build_function) off-thread, the same mpsc worker shape as
the forge background compiler (§6), and the existing NativeSlot::Ready dispatch —
no new VM seam. Because an AOT function is all-or-nothing per call (it bails to the
lower tier on a signature mismatch rather than precise-deopting), it sidesteps the
warm-bytecode run-loop change the forge coarse path would need.
Native-only: the browser uses pre-bundled wasm, and there is no rustc there.
Structs§
- AotRequest
- A request to background-compile function
fi(namedfn_name) fromsource, caching the artifact undercache_dir. All fields owned so the request crosses to the worker thread. - AotResult
- The worker’s reply: the function index and the loaded AOT function (or
Noneif the function was outside the scalar subset or the build/load failed — the interpreter then keeps it on VM+JIT). - BgAot
Compiler - The interpreter-side handle to the background AOT compiler.
submitis non-blocking;try_drainis polled at profiling points anddrain_blockingis the determinism hook tests use. The worker detaches on drop.