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
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.
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 interpretedveko runcompletes 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 hardwaref64.sqrt, bulk memory ops, unboxedi64/f64loops, and capability-confinedHostSandboxisolation. - 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.dllonly, optional--gui)--target=win-arm64— Windows 11 ARM64 64-bit PE32+ (0xAA64) executable (kernel32.dll/ws2_32.dllonly, optional--gui— Snapdragon X Elite/Plus, Surface Pro/Laptop, Windows on ARM VMs)--target=linux-x64— Static zero-libcLinux x86_64 ELF64 executable (direct Linux syscalls)--target=linux-arm64— Static zero-libcLinux AArch64 (arm64) ELF64 executable (directasm-genericLinux syscalls — AWS Graviton, Ampere, Raspberry Pi 5)--target=macos-arm64— 16 KiB-aligned Apple Silicon M1–M4 Mach-OMH_EXECUTEbinary withdyldchained fixups,/usr/lib/libSystem.B.dylibstubs, and automatic pure-Veko SHA-256 ad-hocLC_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
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:
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):
- 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/--guiflags, andFNV-1a+mtimecontent hashes of all transitive modules. - 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), coldveko checkcompletes in~2.7sand warmveko checkin~43 ms; coldveko compile --nativecompletes in~9.7sand warmveko compile --nativein~48 ms. Pass--no-cache(used automatically bybuild.vk -- fixed-point) to force a full uncached rebuild and verifyS1 == S2bit-identical determinism. - Native Codegen Fast-Paths (
native_emit.vk&x64_enc.vk): Unboxedvstackloop conditions fusewhile i < (len xs)into 3 machine instructions with zero[R13]stack spills orrt_releasecalls, inline bounds-checkedbytes[i]loads, and patchx64jump/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:
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
# 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:
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:
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.