All docsNative compilation

Native compilation

How the ahead of time ARM64 compiler turns a .vbc file into a standalone binary.

Venutian gives you two ways to run compiled bytecode: the virtual machine behind venutian run, and an ahead of time compiler that turns a .vbc file into a real machine code binary. Both ship with the venutian command.

Compile to bytecode first

Every path starts the same way venutian run does under the hood: compiling your .ven source to Venutian's own bytecode format.

shell
venutian build hello.ven -o hello.vbc
venutian disasm hello.vbc

hello.vbc is a text format, readable directly, not a binary blob: venutian disasm shows you exactly what the compiler produced.

Ahead of time compilation to a standalone binary

Venutian's ahead of time code generator targets ARM64 (AAPCS64): every opcode's control flow compiles to actual AArch64 branches and calls, and once compiled, a program's bytecode is never read as instructions again. One command turns a source file into its own binary:

shell
venutian build --native hello.ven -o hello_native
./hello_native

hello_native runs as real machine code, with no interpreter loop in that path. Dynamic operations call straight into the shared runtime helpers, which wrap the same runtime semantics the interpreter itself uses, so the compiled and interpreted paths agree by construction rather than by two independent implementations staying in sync by hand. Whole program dead code elimination and cross call site inlining are on by default, measured at 21x faster on function call heavy workloads than the same build without them.

The compiled binary still reads its own .vbc file once at startup, for constants, shape tables and rescue data: metadata, never read again as instructions, the same way any compiled program reads its own embedded data section.

Scope

The ahead of time compiler targets ARM64 only; there is no x86_64 backend. Every stage is checked the same way: the full example corpus is compiled and run through each build, and its output is compared byte for byte against the ordinary pipeline.

See performance guide for what these builds measure against clang O2, and tooling for venutian build, venutian run and venutian disasm.