One commit, because the parts below only build together.
Allocator: an interval needed at the current instruction is never
evicted, and the allocated-program verifier checks that every operand sits
where the allocation says.
AArch64 encoder: compiler_aarch64.zi encodes allocated machine IR with the
shared ARM byte helpers, maps the function-address relocation,
sign-extends signed 8- and 16-bit loads and rejects what it cannot encode
with a named diagnostic. It has no AOT ELF writer yet.
Native default with checked pointers and no fallback: on linux-x86_64,
`ziran run app.zx`, `zi2zx run`, the embedding API's Auto and the Kryon
players run a bundle's verified program as native code in W^X memory.
Stray and freed pointers, double free, bounds and read-only stores trap. A
native gap is a named preflight error, nothing falls back to the engine,
and `--backend engine` picks it explicitly. zx2native uses the same
preflight. Native code exchanges module state for hot reload, checks the
stack, zeroes fresh locals, spends fuel at the engine's checkpoints and
returns records, arrays and strings from host calls. `zi2zx --debug` source
origins name lines in native traps and `zx2native --emit map`. The host
value API drops its VM prefix (HostValue, HOST_*). A call with a record
result loads the hidden result address into rax only after its stack
arguments are stored, and an indirect target stays in r10: rax could hold
a stack argument (Kryon's text-field clip guard arrived as an address) or
the target (indirect calls returning records crashed).
Self-hosting ports: compiler_backend_process, compiler_backend_cache,
compiler_native_names and compiler_runtime_emit replace the zir_c_build,
zir_c_cache and zir_c_process C, with checked bootstrap C and Makefile
rules. zir_c.toolchain again reports "compiling OUT failed:" with the head
of the compiler output and a truncation marker. The parallel scheduler no
longer stalls on a held compiler after reaping a finished job, and poll or
read errors now fail the build. A fresh BUILD_DIR (Kryon's runtime build)
builds: generated files have pattern rules, objects wait for the headers
they include, and engine flags are per object instead of leaking into zi2c.
Legacy removals F1-F10 and N1-N4: the duplicate LirX64 encoder and its
spec test, zir_c_*, zir_runtime and zir_native, nine zero-reference spec
tests, vec_capacity, the zx_metadata and native_cache_names benchmarks,
build-android-host.sh and two shell wrappers are deleted; zx2native is
machine-only; `zi2zx` rejects `--opt` on ZX input; the bootstrap is
regenerated. ASSEMBLY docs, the legacy-removal plan, the milestones and the
remaining-work plan record the current position.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
zi2zx bundle and ziran run always write and run revision-28 executable
ZX. The semantic bundle reader and writer, the portable VM, the
TinyCC-compiled and linked native bundles with the vendored TinyCC,
bundle libraries, the VM profile, --vm, BundleInstantiatePortable,
libziran-vm.a and the ZIR-based Wasm lowering with zi2wasm are removed;
the Wasm tier, the embedding API and every tool run revision 28. Tests
of the removed VM internals and libraries are removed, and the rest run
on revision 28. Engine problems read as the diagnostics users rely on.
An optional section records the type spellings and record field names
of every host capability's parameters and result, which an embedder's
host values carry and the structural payload does not. Any pointer
crosses a host boundary as an opaque handle, and platform services are
recognised only in the ziran.platform module.
`#foreign host_api` declarations with bool, integer and float
signatures now lower from source and saved IR to bodiless Host
functions called by host.call. The verifier keeps host signatures
bodiless and scalar, forbids direct calls, procedure values and entry
use of them, and lets host.call reach nothing else.
Revision-28 containers store the reachable capability count recomputed
from verified instructions. The reader rejects a manifest whose count
differs. The portable engine gains LirExecBindHost: a run with an
unbound capability stops before the entry executes, and host results
must use canonical bits for their declared type. Native output and
machine IR reject host calls explicitly until the native host ABI
exists.
This removes one of the two constructs that block bench/zx_compare.zi
on the new path. String values remain.
The experimental direct backend now writes and reads an opt-in
revision-28 ZX container that holds verified lowered instructions.
Stripped files run through the portable engine without source or
semantic IR. Bounded validation covers framing, identities, symbols
and reachability, and versions 26/27 are rejected with a rebuild
diagnostic. Default ziran/zi2zx output is unchanged.
Address-taken local scalars lower to fresh checked frame storage in
the portable engine and native x86-64, including aliases across calls
and recursion and stale-token traps. A verified target-neutral machine
IR keeps Allocate as an explicit effectful operation ahead of register
allocation.
ASSEMBLY/milestones.md reviews the ten-step plan and reorders delivery
around a Linux x86-64 vertical slice. It starts with an Alpha
physical-host baseline and adds staged interim comparisons. Plan
statuses now match the implementation.
Compare five real examples across four targets on three measured platforms, preserving raw samples, independent output verification and artifact provenance.
Complete the WebAssembly support needed by the examples, inspect ZX bundles, prune generated C dependencies while preserving C++ linkage, and validate native script execution. Optimize only the temporary bootstrap seed and retain fresh-build measurements and historical benchmark records under bench/results.
Local tests: all 522 cases passed across the full run and corrected header-test rerun; all 16 bootstrap modules match. Playground runtime, bundle runtime, private browser layouts and matrix controls, published artifacts and local site links passed.
compiler_bundle.zi now compares a bundle's capability, law and waiver
tables with the program it links (Differs) and names each mismatch. The
C reader decodes those tables in place, keeps their strings
NUL-terminated in one block and frees on one path; the writer builds the
same table views the check compares, so the old law records, their copy
loops and the C comparisons are gone.
Capabilities have one source, BundleLinkedCapabilities, shared by the
writer, the reader and the host. The native and wasm engines take that
table instead of two parallel name arrays. ZxAssetsAdd keeps collected
and library assets in name order for both zi2zx paths.
Bundles stay byte-identical to the C writer: 163 bundles from the bundle,
law, proof, portable and zx tests and a Kryon app bundle match.
cmd/compiler_bundle.zi owns the bundle format: the header, entry names,
host capability, law and waiver tables, the asset section and every
limit. One walk both writes and reads it, so each field's rule is stated
once. zir_bundle.c and zir_bundle_assets.c keep IR streaming, linking and
the law and capability checks, and call the module through its seed in
bootstrap/compiler_bundle. Bundles keep the same bytes.
zir_bundle.h also puts BundleTrustNativeAssembly back outside the
BundleIdentity comment, which left the header unable to compile.