perf(gc/symbols)+feat(image): O(n^2) fixes, GC telemetry, asdf image bakeVerified

Session work across symbol lookup, GC, save-image, and asdf baking.
Verified: self-host holds byte-identical; alexandria load-all functional
(flatten/iota/lastcar correct); `make build` fast (mini-clos only, 0.04s boot).

Symbol lookup (ADR-0026 / cave#266):
- (pkg,name)-keyed canonical symbol records + interleaved read-one/eval-one
  loader (reader/runtime/compiler/stage1/stdlib) so functions are
  package-scoped, not bare-name-keyed.
- Fence-index over the arena store (*ag-pkgsym-idx*) + a per-package
  first-byte index for find-symbol-in-pkg; whole-file loads were O(n^2).

Garbage reduction (the big one):
- ag-dwarf-build-eh-frame-buf-jit sized the per-top-level-form JIT .eh_frame
  buffer to the WHOLE code region (~800 KiB/form baked baseline); now sized
  to the batch's own code bytes. 18x less garbage (915 KiB -> 50 KiB/defun);
  500 -> 0 GC collections on the asdf load; ~3x faster load.

GC:
- Binary-search gc-frame-record-index-for-pc (was a linear per-stack-frame
  scan) - eliminates the 9-min save-image hang on save-image's deep collect
  recursion.
- Telemetry: (gc-stats) [collections, minor/degenerate ratio, bytes-consed,
  region generations], (gc-heap-census) by widetag, cumulative bytes-consed
  tracked at window granularity.

Image / boot:
- save-image buffers 16 MiB -> 256 MiB (asdf's ~100 MB live heap overflowed
  the fixed push buffer).
- Boot loader stat(2)-sizes the /proc/self/exe read buffer (was a fixed
  8 MiB that truncated a large embedded image) + exactly-sized relocate buf.

Build:
- `make build` stays fast (stdlib + mini-clos only). New `make build-asdf`
  (and `make release`) bakes asdf so (asdf:load-system ...) works with no
  (load "asdf.lisp"); kept out of the default because it adds ~5 min bake
  and several seconds to boot (restore rebuilds asdf's heap + fn-cells).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Anthony Green2026-07-10 08:03:30 -0400 5ccf8a1c7dd6a51ea4003d754566b47a748677b2
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>