veko
ORO Homoiconic Language • Custom VM • Wasm 3.0 (vvm) • Native x86_64 & arm64

Performance, Hardware Intrinsics & AArch64 Cross-Compilation Guide

Veko delivers predictable, low-latency native execution strictly without a JIT compiler and with zero W^X (write-then-execute) memory pages. Every native binary is compiled ahead-of-time (AOT) directly from Veko's 64-bit VKO intermediate representation into standalone machine code across 5 zero-dependency OS/CPU targets — Windows x86_64 (win-x64), Windows 11 ARM64 (win-arm64), Linux x86_64 (linux-x64), Linux AArch64 (linux-arm64), and macOS Apple Silicon (macos-arm64) — with zero external C compiler, LLVM, libc, or crypto library dependencies.


1. Strict No-JIT & Zero-W^X Execution Model

CODEGEN & BINARY LINKERS

64-Bit VKO ISA, Hardware SIMD & Four-Target Native Binary Emitters

Zero-JIT, zero-W^X compilation from typed ASTs to superinstruction bytecode, x86_64, and AArch64 executables.

Interactive SVG • Click any node (6 components)
IR & BYTECODE TRACK vko_emit.vk + oro_vm.vk X86_64 NATIVE BACKEND x64_enc.vk + native_emit.vk AARCH64 NATIVE BACKEND arm64_enc.vk + arm64_emit.vk VKO1 words x86_64 code ARM64 code Shared AST PAL parity Bytecode IR 64-Bit VKO Emitter op:u8 | flags:u8 | a:u16 | bx:u32 VM Engine VM Superinstructions Zero-JIT Dispatch Fusion x86_64 Codegen x86_64 Machine Emitter CPUID AVX2 / SSE2 / AES-NI x86_64 Linkers Win64 PE32+ & Linux ELF64 pe_emit.vk + elf_emit.vk ARM64 Codegen AArch64 Machine Emitter ARMv8-A + NEON-ready PAL ARM64 Linkers Linux ELF64 & macOS Mach-O elf_emit.vk + macho_emit.vk
Components:
Bytecode IR
64-Bit VKO Emitter
vko_emit.vk
Component 1 of 6
Architectural Role & Purpose

Compiles ASTs into fixed-width 64-bit instructions serialized as portable 'VKO1' binaries.

Contextual Description & System Interaction

Eliminates narrow bytecode limits so the 39-module compiler runs effortlessly on the VM.

Core Functionality & Mechanics
  • Supports 65,535 locals per frame and 4B constant/jump offsets
  • Emits TRY_OR and DEFER_PUSH structured unwind scopes
  • Validates spawn capture isolation at compile time
VM Engine
VM Superinstructions
oro_vm.vk
Component 2 of 6
Architectural Role & Purpose

Fuses hot local-load, arithmetic, comparison, and branch sequences in pure AOT code.

Contextual Description & System Interaction

Delivers fast interpreter performance while remaining 100% compatible with iOS/hardened kernels.

Core Functionality & Mechanics
  • Strict No-JIT design: zero RWX pages on every platform
  • Accelerates inner loops and crypto rounds on Track A
  • Powers veko repl and instant .vk script execution
x86_64 Codegen
x86_64 Machine Emitter
x64_enc.vk native_emit.vk
Component 3 of 6
Architectural Role & Purpose

Lowers typed ASTs directly to x86_64 machine code with 79-group dead-code elimination.

Contextual Description & System Interaction

Generates compact native machine code in milliseconds without invoking clang, gcc, or link.exe.

Core Functionality & Mechanics
  • Uses CPUID dispatch for AVX2/SSE2 byte scans/XOR and AESENC
  • Unboxes tight integer/float loops into native CPU registers
  • Emits static C-ABI trampolines only when .ffi is enabled
x86_64 Linkers
Win64 PE32+ & Linux ELF64
pe_emit.vk elf_emit.vk
Component 4 of 6
Architectural Role & Purpose

Writes standalone Windows .exe and static zero-libc Linux x86_64 executables.

Contextual Description & System Interaction

Produces clean, dependency-free binaries ready for Windows desktops and Linux containers.

Core Functionality & Mechanics
  • Win64 imports only kernel32/ws2_32 (+ user32/gdi32 only on .ui; --gui)
  • Linux x86_64 emits 100% static ELF64 (dynamic libc.so.6 only on .ffi)
  • Verified S1 == S2 bit-identical self-hosting on both OSes
ARM64 Codegen
AArch64 Machine Emitter
arm64_enc.vk arm64_emit.vk
Component 5 of 6
Architectural Role & Purpose

Encodes fixed 32-bit ARM64 instructions with dedicated callee-saved runtime registers.

Contextual Description & System Interaction

Brings first-class native performance to AWS Graviton, Raspberry Pi, and Apple Silicon.

Core Functionality & Mechanics
  • Maps ORO 16B Value pairs cleanly onto X0..X28 register file
  • Shares identical 16B SlabHdr and 12-bucket allocator invariants
  • Cross-compiles from Windows or Linux hosts with zero SDKs
ARM64 Linkers
Linux ELF64 & macOS Mach-O
elf_emit.vk macho_emit.vk
Component 6 of 6
Architectural Role & Purpose

Emits static Linux EM_AARCH64 ELF64 and ad-hoc SHA-256 signed 16 KiB Apple Silicon Mach-O.

Contextual Description & System Interaction

Completes Veko 1.0's four-target native cross-compilation matrix.

Core Functionality & Mechanics
  • Linux arm64 uses raw syscalls + clone/futex + epoll (S1 == S2 verified)
  • macOS arm64 emits LC_MAIN, libSystem.B.dylib, and LC_CODE_SIGNATURE
  • 16 KiB segment alignment runs natively on macOS M1/M2/M3/M4

Across all three execution tracks, Veko enforces strict separation between writable memory and executable code:

  • Track A (--vm / .vko): The pure-Veko 64-bit bytecode VM (oro_vm.vk) uses fused superinstructions (LOAD_CONST_ADD, LOAD_CONST_LT_JMP_FALSE, LOCAL_INC, LOAD_LOCAL_INDEX, LOAD_LOCAL_LEN), shared devirtualization, guarded leaf inlining, optional --fuel=<n> instruction quotas, and .secret-preserving native fast-paths for modular big-integer/Curve25519/Keccak-f[1600]/SHA-2 kernels so even interpreted veko run completes full post-quantum TLS 1.3 HTTPS handshakes in milliseconds without allocating executable heap pages.
  • Track B (--wasm / vvm): Compiles to validated WebAssembly 3.0 with hardware f64.sqrt, bulk memory ops, unboxed i64/f64 loops, and capability-confined HostSandbox isolation.
  • Track C (--native): Emits standalone OS executables directly for five OS/CPU architectures and platforms:
    • --target=win-x64 — Windows x86_64 64-bit PE32+ executable (kernel32.dll / ws2_32.dll only, optional --gui)
    • --target=win-arm64 — Windows 11 ARM64 64-bit PE32+ (0xAA64) executable (kernel32.dll / ws2_32.dll only, optional --gui — Snapdragon X Elite/Plus, Surface Pro/Laptop, Windows on ARM VMs)
    • --target=linux-x64 — Static zero-libc Linux x86_64 ELF64 executable (direct Linux syscalls)
    • --target=linux-arm64 — Static zero-libc Linux AArch64 (arm64) ELF64 executable (direct asm-generic Linux syscalls — AWS Graviton, Ampere, Raspberry Pi 5)
    • --target=macos-arm64 — 16 KiB-aligned Apple Silicon M1–M4 Mach-O MH_EXECUTE binary with dyld chained fixups, /usr/lib/libSystem.B.dylib stubs, and automatic pure-Veko SHA-256 ad-hoc LC_CODE_SIGNATURE

On x86_64 native targets, startup performs a single read-only CPUID + XGETBV probe (SSE2, AVX2, AES-NI) and dispatches hot byte and cryptographic loops automatically to the widest supported instruction set—falling back cleanly to constant-time scalar code on older CPUs.


2. Hardware & Bulk Byte Intrinsics (3-Track Parity)

Six built-in primitives accelerate numeric, buffer-scanning, and cryptographic workloads across all three backends with bit-identical semantics:

Builtin Arity Description Native Hardware Acceleration
f64/sqrt 1 IEEE-754 double-precision square root SQRTSD (x86_64), FSQRT (AArch64), f64.sqrt (Wasm 3.0)
bytes/eq 2 Exact byte-buffer equality check AVX2 32B / SSE2 16B lanes (x86_64), 8B word loop (AArch64)
bytes/index-of 2 First byte offset of needle in haystack, or -1 AVX2 / SSE2 PMOVMSKB scan (x86_64), fast prefix scan (AArch64)
bytes/xor 2 Returns a new bytes buffer XORing two equal-length buffers AVX2 32B / SSE2 16B VPXOR/PXOR (x86_64), 8B EOR loop (AArch64)
bytes/xor! 2 In-place ORO mut XOR (bytes/xor! mut dst mask) with zero allocation AVX2 32B / SSE2 16B in-place vector XOR (x86_64), 8B EOR loop (AArch64)
bytes/aes-enc-block 2 Single-block AES-128/192/256 encryption (blk16, rk) Hardware AESENC/AESENCLAST (x86_64 AES-NI), constant-time branchless algebraic GF(2^8) fallback (AArch64 / non-AES-NI / Wasm / VM)

Example: Using Hardware & Bulk Intrinsics

VEKO
use [m = math, bits, hex = codec/hex, aes = crypto/aes]

// Hardware IEEE-754 square root (`math/sqrt` delegates to `f64/sqrt`)
root2 = f64/sqrt 2.0

// Bulk SIMD equality, search, and zero-allocation in-place XOR
hay = bytes/from-str 'veko-simd-acceleration-pipeline-sentinel-99'
idx = bytes/index-of hay (bytes/from-str 'sentinel-99')

mut payload = bytes/from-str '0123456789abcdef'
mask = bytes/fill 16 0x5a
_ = bytes/xor! mut payload mask
_ = bytes/xor! mut payload mask
ok = bytes/eq payload (bytes/from-str '0123456789abcdef')

// NIST FIPS-197 AES-256 block & AES-256-GCM AEAD (automatically uses AES-NI when present)
key = hex/decode '000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f'
pt = hex/decode '00112233445566778899aabbccddeeff'
ct = aes/encrypt-block key pt   // '8ea2b7ca516745bfeafc49904b496089'

// Table-driven IEEE 802.3 CRC32 (256-entry Sarwate table in `lib/bits.vk`)
sum = bits/crc32 (bytes/from-str '123456789')   // 0xcbf43926

Run the complete self-verifying demonstration (examples/28_simd_optimization_and_arm64_cross_compile.vk) across all tracks:

POWERSHELL
veko run examples/28_simd_optimization_and_arm64_cross_compile.vk
veko run --wasm --fuel=0 --check-slabs examples/28_simd_optimization_and_arm64_cross_compile.vk
veko run --native examples/28_simd_optimization_and_arm64_cross_compile.vk

3. Content-Addressed Incremental Cache & veko run --native

Veko accelerates both interactive type-checking and AOT native builds via a deterministic content-addressed cache under dist/.veko_cache/ (bypassable anytime with --no-cache):

  1. Frontend & Binary Cache (dist/.veko_cache/mod_v1/): Keyed by a SHA-256 digest over the compiler binary fingerprint, embedded 'VFS2' stdlib fingerprint (stdlib_vfs.bin, lazy per-module zlib decompression), target triple, --strict-types / --gui flags, and FNV-1a + mtime content hashes of all transitive modules.
  2. Warm Sub-50ms Turnaround: On a 42-module production server (veko-site, including TLS 1.3, HTTP/2, QUIC HTTP/3, and Zero-FFI SQLite), cold veko check completes in ~2.7s and warm veko check in ~43 ms; cold veko compile --native completes in ~9.7s and warm veko compile --native in ~48 ms. Pass --no-cache (used automatically by build.vk -- fixed-point) to force a full uncached rebuild and verify S1 == S2 bit-identical determinism.
  3. Native Codegen Fast-Paths (native_emit.vk & x64_enc.vk): Unboxed vstack loop conditions fuse while i < (len xs) into 3 machine instructions with zero [R13] stack spills or rt_release calls, inline bounds-checked bytes[i] loads, and patch x64 jump/call relocations in $O(L + F)$ in-place passes.

For scripts and benchmarks that want full native throughput without managing output paths manually, use veko run --native:

POWERSHELL
veko run --native benchmarks/bench_suite.vk
veko compile --native --no-cache src/main.vk -o dist/app.exe

4. Cross-Compiling to AArch64 (win-arm64, linux-arm64 & macos-arm64)

Every veko binary includes both the x86_64 and AArch64 native code generators and linkers built in. You can cross-compile from any host OS to any of the 5 supported targets in a single command—no cross-compilers, Docker toolchains, Visual Studio Build Tools, or Xcode SDKs are required.

Target Matrix

--target Architecture Binary Format Runtime ABI & Linking Signing / Permissions
win-x64 x86_64 PE32+ (.exe, 0x8664) kernel32.dll + ws2_32.dll IAT (--gui optional) Standard Windows x64 executable
win-arm64 AArch64 (arm64) PE32+ (.exe, 0xAA64) kernel32.dll + ws2_32.dll IAT (--gui optional) Native Windows 11 ARM64 executable (zero x64 emulation)
linux-x64 x86_64 Static ELF64 (ET_EXEC) Direct Linux syscalls (zero libc) Automatic 0o755 executable mode
linux-arm64 AArch64 (arm64) Static ELF64 (EM_AARCH64) Direct asm-generic Linux syscalls (zero libc) Automatic 0o755 executable mode
macos-arm64 AArch64 (arm64) 16 KiB Mach-O MH_EXECUTE dyld chained fixups + /usr/lib/libSystem.B.dylib stubs Built-in pure-Veko SHA-256 ad-hoc LC_CODE_SIGNATURE

Cross-Compile Commands

POWERSHELL
# Windows 11 ARM64 PE32+ (0xAA64) binary (Snapdragon X Elite/Plus, Surface Pro/Laptop, Windows on ARM VMs)
veko compile --native --target=win-arm64 examples/28_simd_optimization_and_arm64_cross_compile.vk -o dist/app_win_arm64.exe

# Static Linux AArch64 (arm64) binary (runs on Raspberry Pi 4/5, AWS Graviton, Ampere, or QEMU)
veko compile --native --target=linux-arm64 examples/28_simd_optimization_and_arm64_cross_compile.vk -o dist/app_linux_arm64

# Apple Silicon macOS arm64 binary (16 KiB pages + automatic ad-hoc SHA-256 LC_CODE_SIGNATURE)
veko compile --native --target=macos-arm64 examples/28_simd_optimization_and_arm64_cross_compile.vk -o dist/app_macos_arm64

# Self-host the full Veko compiler itself for Windows arm64, Linux arm64, or macOS arm64
veko compile --native --target=win-arm64   src/main.vk -o dist/veko_win_arm64.exe
veko compile --native --target=linux-arm64 src/main.vk -o dist/veko_linux_arm64
veko compile --native --target=macos-arm64 src/main.vk -o dist/veko_macos_arm64

Deploying win-arm64 Binaries on Windows 11 on ARM

--target=win-arm64 emits a native AArch64 PE32+ (IMAGE_FILE_MACHINE_ARM64 = 0xAA64) executable using the Windows ARM64 AAPCS64 calling convention (X0..X7 integer arguments, X18 reserved for the Win32 TEB, ADRP+LDR Win32 IAT thunks). Binaries execute directly on Snapdragon X Elite/Plus workstations, Surface Pro/Laptop devices, and Azure/AWS Windows on ARM instances with zero Prism x64 binary-translation overhead, and veko run --native / veko compile --native auto-detect Windows ARM64 hosts automatically.

Testing linux-arm64 Binaries on x86_64 Hosts via QEMU

On Linux or Windows WSL2 (Ubuntu/Debian), install user-mode QEMU emulation and execute linux-arm64 binaries directly:

BASH
sudo apt-get update && sudo apt-get install -y qemu-user
qemu-aarch64 ./dist/app_linux_arm64

Deploying macos-arm64 Binaries on Apple Silicon

Apple Silicon (arm64) macOS requires every executable to be 16 KiB page-aligned and signed with at least an ad-hoc LC_CODE_SIGNATURE containing SHA-256 hashes of every 4 KiB code page. Veko's built-in Mach-O linker (macho_emit.vk) computes and embeds the full CS_MAGIC_EMBEDDED_SIGNATURE / CS_MAGIC_CODEDIRECTORY SHA-256 blob automatically (and unlinks any existing Mach-O target before writing to avoid APFS code-signing vnode cache SIGKILL), while veko run --native, veko compile --native, and veko doc --test --native auto-detect Apple Silicon (macos-arm64) and Linux AArch64 (linux-arm64) hosts out of the box without requiring --target, codesign, or Xcode.


5. Benchmarking Across All Three Tracks

Run Veko's reproducible benchmark suite (benchmarks/bench_suite.vk) to measure native, Wasm 3.0, and bytecode VM throughput on your machine:

POWERSHELL
veko run --native benchmarks/bench_suite.vk
veko run --wasm --fuel=0 benchmarks/bench_suite.vk
veko run benchmarks/bench_suite.vk

The suite benchmarks 9 real-world pure-Veko workloads: math/sqrt+sin, bits/crc32 (1 KiB), seq/sort (64 ints), regex/find-all, compress/gzip, crypto/sha3-256 (1 KiB), crypto/blake2b-256 (1 KiB), crypto/aes-256-gcm, and crypto/mlkem-512 post-quantum encapsulation.