P5.6 prereq: port bitwise/shift ops into the comptime VM

`comptime_vm` exec now handles `bit_and`/`bit_or`/`bit_xor`/`bit_not`/`shl`/`shr`
(a new `bitwise` helper next to `arith`), mirroring the legacy interp's i64 model
exactly: the shift amount clamps to `@min(rhs, 63)` and `shr` is an arithmetic
right shift (sign-extending).

These were unported and bailed; the `shr` gap surfaced via the iOS-device bundler
once P5.5 let it run further (1616). With the port, 1616's strict VM run reaches
the real bundler logic and stops only at the genuinely-unavailable iOS runtime on
macOS (`_UIApplicationMain` / no linked binary under `sx run`), as expected.

New corpus test `examples/0639-comptime-bitwise-shift.sx` folds AND/OR/XOR/NOT/
shl/shr/arith-shr as `::` consts — identical on both evaluators. 704/0 both gates.
This commit is contained in:
agra
2026-06-19 14:20:37 +03:00
parent ba28488d99
commit 994d6498fc
6 changed files with 55 additions and 0 deletions

View File

@@ -427,6 +427,14 @@ when reached (sentinels or accessor fns; see the design doc Risks).
`List` growth; orthogonal, see `current/CHECKPOINT-METATYPE.md`.)
## Log
- **P5.6 prerequisite — bitwise/shift ops ported into the VM (2026-06-19).** `comptime_vm` exec now handles
`bit_and`/`bit_or`/`bit_xor`/`bit_not`/`shl`/`shr` (new `bitwise` helper next to `arith`), mirroring the legacy
interp's i64 model EXACTLY: shift amount clamps to `@min(rhs, 63)`, `shr` is an ARITHMETIC right shift
(sign-extending). These were unported and bailed — the `shr` gap surfaced via the iOS-device bundler once P5.5
let it run further (1616). With the port, 1616's strict VM run reaches the real bundler logic (no more `shr`
bail; it now stops only at the genuinely-unavailable iOS runtime on macOS — `_UIApplicationMain` / no linked
binary under `sx run`, expected). New focused corpus test `examples/0639-comptime-bitwise-shift.sx` (`::` consts
fold AND/OR/XOR/NOT/shl/shr/arith-shr; identical on both evaluators). **704/0 BOTH gates.**
- **P5.5 — the 35 `BuildOptions` accessors migrated off `struct #compiler` onto VM-native `abi(.compiler)` (2026-06-19).**
`BuildOptions :: struct #compiler { ...35 methods... }` → `BuildOptions :: struct { }` (an opaque
null-sentinel handle) + 35 free `ufcs (self: BuildOptions, …) abi(.compiler)` decls in