P5.5: migrate the 35 BuildOptions accessors off #compiler to VM-native abi(.compiler)

`BuildOptions :: struct #compiler { ...35 methods... }` becomes
`BuildOptions :: struct { }` (an opaque null-sentinel handle) plus 35 free
`ufcs (self: BuildOptions, …) abi(.compiler)` decls in build.sx, each serviced
by a new `comptime_vm.callBuildOptionFn` arm (off `callCompilerFn`). No legacy
`compiler_lib` handler: the names are registered in `bound_fns` with a single
bailing stub only so `weldedCompilerFn` accepts them.

- String lifetime: setters dupe the arg into the persistent `Vm.gpa` (the
  Compilation allocator, threaded into both `tryEval` and `runBuildCallback` —
  not the per-eval VM arena) and write/append to the threaded `BuildConfig`.
  Getters read the field/slice or compute the target predicate from the triple.
- Dispatch routing (Option B): a `#run`/const-init entry that directly calls a
  compiler-domain/welded fn (`emit_llvm.entryNeedsVm`) runs on the VM with no
  legacy fallback regardless of the `-Dcomptime-flat` gate, so gate-OFF stays
  green without a legacy BuildOptions handler (P5.7 retires the legacy interp).
- Mark the 5 `platform/bundle.sx` getter-calling helpers `abi(.compiler)` (they
  are comptime-only bundler code; otherwise their now-welded getter calls trip
  the runtime-call gate).
- 37 `.ir` snapshots regenerated (std transitively imports build.sx → string-
  pool/type-table indices shift); verified `.ir`-only, zero behavior-stream diffs.

BuildOptions `compiler_call` strict bails gone (1609/1614/1615 strict-clean);
1616 now bails on a separate, pre-existing unported bitwise/shift VM gap (`shr`),
to port first in P5.6. 703/0 both gates.

Also sweep the outdated "flat memory" terminology to "comptime/byte-addressable"
across comptime_vm + the plan/checkpoint/CLAUDE docs: the comptime VM is
arena-backed, byte-addressable memory where `Addr` is a real host pointer, not a
flat contiguous address space (flag names `-Dcomptime-flat`/`SX_COMPTIME_FLAT` kept).
This commit is contained in:
agra
2026-06-19 13:21:09 +03:00
parent af32c3823c
commit ba28488d99
48 changed files with 13896 additions and 14974 deletions

View File

@@ -39,7 +39,7 @@ pub const TypeId = enum(u32) {
/// (`reflect`/`const_type`/the comptime compiler-API), not a boxed Any. It used
/// to share `.any`'s slot, but `.any` is a 16-byte `{tag,value}` box (variadic
/// any), so a `Type` stored in an aggregate was sized 16B while the value is 8B
/// — which blocked the flat-memory comptime VM. Its own slot fixes the size and
/// — which blocked the comptime VM. Its own slot fixes the size and
/// keeps every downstream `== .any`/`switch` check from conflating the two.
type_value = 19,
_, // user-defined types start at `first_user` (slots 2099 reserved for future builtins)
@@ -512,7 +512,7 @@ pub const TypeTable = struct {
/// member count (a scalar, pointer, the `unresolved` sentinel, …) — so a
/// caller bails loudly rather than reading a silent 0. The comptime
/// compiler-API reflection reader `type_field_count` rides on this (both the
/// legacy `compiler_lib` handler and the flat-memory VM call it, so the two
/// legacy `compiler_lib` handler and the comptime VM call it, so the two
/// paths can never drift). Out-of-range ids return null, not a panic.
pub fn memberCount(self: *const TypeTable, id: TypeId) ?i64 {
if (id.index() >= self.infos.items.len) return null;