Skip to main content

Module aot_native

Module aot_native 

Source
Expand description

Native AOT for node-js via fusevm::aot (node --build).

Mirrors the pythonrs/elisprs/vimlrs approach: lower the program to a fusevm::Chunk, embed the function/try tables (which live on the host, not the chunk) as a JSON image inside chunk.names, emit a relocatable object with fusevm::aot::compile_object, then link it against the node-js runtime staticlib (which carries fusevm’s AOT runtime + this module’s fusevm_aot_register_builtins) and a tiny C entry into a standalone executable.

The node-js catch is simpler than elisp’s: node-js chunk constants are native Value::Str/Int/Float only (JS strings/arrays/objects are built at runtime via MKSTR/MKARR/MKOBJ), so there is no heap image to reconstruct — the only host state a chunk depends on is the function/try tables, which the image below restores before the main chunk runs.

Functions§

emit_executable
Compile a program to a standalone native executable at out.
fusevm_aot_register_builtins⚠
The AOT runtime hook: install the node-js builtins + numeric hook and reload the embedded function/try tables before the main chunk runs. Required link symbol for a standalone node-js AOT binary.