Skip to content

[PROPOSAL] arm-entry-granularity: the ARM entry-recall gap is a discovery hole, not absorption - #239

Closed
mahaloz wants to merge 1 commit into
mainfrom
feat/decbench-arm-entry-granularity
Closed

mahaloz wants to merge 1 commit into
mainfrom
feat/decbench-arm-entry-granularity

Conversation

@mahaloz

@mahaloz mahaloz commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

[PROPOSAL] — investigation only. No code in this diff. Do not merge until approved; approval re-dispatches implementation on this branch.

docs/decbench/recall-measurement.md closed with one headline: 2,026 of the 2,061 live recall misses (98.3%) are function-entry granularity on embedded ARM — "kuna emits a body for code containing the DWARF low_pc but does not start a function at it", median 24 bytes away.

The count holds. The mechanism sentence does not, and the difference decides the fix.

The correction that matters

It is not absorption — it is a hole. For every missed address, is it inside the ground-truth body of the nearest lower kuna entry?

count
dropped — past the end of the nearest kuna function 1,896
unknown extent (nearest kuna entry is a kuna-invented sub_) 1,040
absorbed — strictly inside a kuna body 3

Three. nuttx O2 devnull_read/devnull_write (8 bytes total) and libopencm3 O2 cdcacm _usbd_standard_request_device are not merged into a neighbour — they produce no output at all. kuna emits 0x8003a8c, then 0x8003aa8; the four bytes in between are never decompiled. This is missing decompilation, not a naming or boundary problem, and it is worth exactly what the recall pool says.

Framing: kuna is second of five here

Entry recall over 36,360 DWARF function addresses (8 ARM Cortex-M projects × 3 opt levels), re-measured live on this build against the stripped binaries decbench actually feeds:

recovered recall
angr 34,295 95.3%
kuna 33,326 91.7%
ghidra 29,530 81.2%
binja 29,364 80.8%
ida 17,632 76.1%

Ghidra finds only 1,859 of the 2,941 addresses kuna misses. "Name the Ghidra analyzer and port it" is the wrong frame — this is a tail against angr.

Sub-classes, counts, and the owning pass

sub-class n decbench-measured owning pass why the evidence was rejected
pointer 1,671 1,402 aif::code_pointer_table_seeds finds the pointer word, then rejects on is_thumb_function_prologue + MIN_SUBROUTINE_INSNS = 3
tailcall 513 226 listing/walk.rs the walk has no tail-call notion — every non-CALL flow target is a same-function successor
called 297 146 not entry discovery 273/297 have a discovered caller; the call site sits past an unresolved Thumb TBB/TBH
fallthrough 194 43 Stages 1–2 no reference at all, and no canonical prologue
unreferenced 146 19 — mostly compiler-runtime aliases
after-terminator 118 2 Stages 1–2 same

Two shape facts decide the design: 93.3% of missed entries have no canonical Thumb frame prologue, and 41% are ≤ 8-byte leaves (movs r0,#0; bx lr, a bare bx lr). Every existing ARM discovery stage requires a prologue and rejects routines of ≤ 2 instructions.

Worked example for the called class: betaflight O0 blackboxLogInflightAdjustmentEvent @ 0x8031688 has 46 direct BLs, all from applyStepAdjustment @ 0x80316b4 — whose third instruction is tbh [pc, r3, lsl #1]. The walk gives an indirect branch no static successor, so every case body past the switch, and every BL in it, is never decoded.

Ground-truth noise: 3.4%, and the cited example is not it

NMI_Handler / PendSV_Handler / DebugMon_Handler were labelled "three DWARF symbols on one b . loop". In cleanflight they are at 0x803b060, 0x803b062, 0x803b064 — three distinct two-byte bx lr stubs, each with its own vector-table slot, and Ghidra, IDA, angr and Binary Ninja all recover all three. They are ordinary pointer-class misses.

Real noise: 105 alias/ICF surplus names (__floatundidf/__aeabi_ul2d, …) on addresses already counted once — 3.4% of the name-based pool. A further 309 misses (10.5%) were recovered by no rival at all. Not worth chasing: 10–14%.

No existing option closes any of it

--mode aggressive, addrtable, fast_funcdisc, eh_frame_full, operand_refs each recover exactly 0 additional entries, on every binary tried. aggressive resolves to the same listing+funcstart_patterns+aif set the decompile-all driver already injects on ARM, so it is the baseline. The earlier "aggressive recovers zero of betaflight's residual 277" replicates and generalises. Removing funcstart_patterns instead costs 6–490 entries per binary — the existing discovery is load-bearing and saturated.

What a fix is worth (measured on a reverted scratch build)

ground truth base pointer-relax tail-call both + re-walk
9 binaries 9,802 8,926 (91.1%) 9,520 (97.1%) 9,092 (92.8%) 9,722 (99.2%)

91% of the residual gap is reachable by relaxing predicates that already run — and the cost is precision, which is the whole of the remaining work:

arm new entries ground truth splits a real body outside any DWARF body
pointer-relax 560 348 (62%) 117 (21%) 95 (17%)
tail-call 384 149 (39%) 213 (55%) 22 (6%)
tail-call, stricter 222 120 (54%) 84 (38%) 18 (8%)

decbench scores per ground-truth function, so a false start costs nothing on GED and everything in real use. Shipping the naive relaxation would trade ~1,400 recovered functions for several hundred wrongly-split ones that the benchmark cannot see.

Verdict: PROPOSAL, 4-PR sequence, all default-OFF first

  1. cortexmvectors (SMALL, independent) — widen the Cortex-M vector-table signature. It silently no-ops on the four biggest contributors today: cleanflight/betaflight fail the SHF_EXECINSTR gate and the SRAM window (stack word 0x1000fff0, CCM RAM; betaflight's table is linked at 0x20000000 for runtime relocation); crazyflie and nuttx fail word[1] == e_entry because their reset vector legitimately differs from the ELF entry.
  2. ptrentry (LARGE, the prize) — pointer-referenced entries, with table-run corroboration and a terminating-routine validity check replacing the length floor. Acceptance target: ≥ 80% of new entries are ground truth, zero regression.
  3. tailcallentry (MEDIUM) — needs WalkState to track per-function claimed instruction sets first; without containment it splits rotated loop heads.
  4. Listing-tier TBB/TBH resolution — a separate gap, sequenced last.

Explicitly not proposed: a standalone PR for re-walking AIF's gap starts (passes.rs:535 omits the re-seed Stages 2/3 do) — real, but worth +39 entries over 9 binaries and subsumed by PR 2.

Also in this diff

Corrections to the two docs this contradicts: the mechanism paragraph in docs/decbench/recall-measurement.md, and docs/missing-ghidra-analyses.md §6's claim that OperandReferenceAnalyzer's function creation is "subsumed by s1-entry-disc" — it is not, and that is the 1,671-entry gap. (Ghidra creates these from instruction operands; its data-side sibling DataOperandReferenceAnalyzer overrides createFunctions to a no-op — "don't ever create a function from a data pointer" — which is the precision guard kuna would need.)

Bundle: docs/features/arm-entry-granularity/ — analysis.md (the map), proposal.md (the sequence), rivals-vs-kuna.txt (every raw table), record.json.

Gates: make check-spec green. No code changed, so the parity/workspace gates are structurally unaffected.

🤖 Generated with Claude Code

https://claude.ai/code/session_011RXVU58TKJxb518oViChwo

The recall measurement's headline -- 2,026 of 2,061 live misses are ARM
function-entry granularity -- holds. Its mechanism sentence does not, and the
difference decides the fix.

Measured on this build, address-based, against the stripped binaries decbench
actually feeds the decompilers:

  - NOT absorption. Of 2,941 missed addresses, 1,896 sit PAST the end of the
    nearest kuna function and exactly 3 are strictly inside a kuna body. The
    24-byte median measures proximity, not containment. devnull_read /
    devnull_write / _usbd_standard_request_device produce NO output at all --
    this is missing decompilation, not a naming problem.
  - kuna is 2nd of 5 on entry recall here (91.7%; angr 95.3%, ghidra 81.2%,
    binja 80.8%, ida 76.1%), so "port the Ghidra analyzer" is the wrong frame.
  - Sub-classes (decbench-measured in parens): pointer 1,671 (1,402) /
    tailcall 513 (226) / called 297 (146) / fallthrough 194 (43) /
    unreferenced 146 (19) / after-terminator 118 (2).
  - Ground-truth noise is 3.4%, not the cited b-dot loop: cleanflight's
    NMI/PendSV/DebugMon handlers are three distinct 2-byte bx-lr stubs that all
    four rivals recover.
  - 57% of the gap is evidence kuna already has and throws away:
    code_pointer_table_seeds finds every one of those pointer words, then
    rejects the target for lacking a frame prologue (93% of misses lack one) and
    for being <= 2 instructions (41% are <= 8-byte leaves).
  - No shipped option closes any of it: aggressive / addrtable / fast_funcdisc /
    eh_frame_full / operand_refs each recover exactly 0.
  - A reverted scratch build with those predicates relaxed takes 9 binaries from
    91.1% to 99.2% entry recall -- at 62% precision, which is the whole of the
    remaining work.

Two incidental defects recorded: cortexm_vector_table silently no-ops on
betaflight/cleanflight/crazyflie/nuttx (exec-section gate, CCM stack word,
reset vector != e_entry), and run_aif's gap starts never re-seed the walk.

Verdict: PROPOSAL, 4-PR sequence, all default-OFF first. No code in this diff.

Also corrects the two docs this contradicts: the recall-measurement mechanism
paragraph, and the missing-ghidra-analyses claim that OperandReferenceAnalyzer's
function creation is subsumed by s1-entry-disc.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011RXVU58TKJxb518oViChwo
mahaloz added a commit that referenced this pull request Aug 3, 2026
…table signature (#248)

Step 1 of the approved ARM entry-recall sequence ([PROPOSAL] #239), which measured
2,026 of 2,061 live recall misses (98.3%) as function-entry granularity on embedded
ARM Cortex-M and called this step SMALL and independent.

Entry-discovery oracle 6 confirms a hardware vector table only when it starts a
section the loader maps executable, word[0] is in 0x20000000-0x3FFFFFFF, and
word[1] == e_entry. All three over-constrain real firmware, and between them they
silently no-op the four biggest contributors: cleanflight and betaflight link
.isr_vector as an A-only section inside a read-only PT_LOAD with a 0x1000fff0 CCM
stack word; crazyflie and nuttx point e_entry somewhere other than the reset
vector. A fourth defect surfaced while measuring: betaflight's table is linked into
RAM ABOVE the flash it points at, so the harvest's "stop at the start of code" rule
fires on the second slot and the table looks one word long.

With --option cortexmvectors on, a candidate is any allocated section whose word[0]
lands in 0x10000000-0x3FFFFFFF and whose slots from word[1] yield at least three
Thumb handler pointers. The run of handlers replaces the e_entry equality; it is
counted by the same harvest loop the oracle then seeds from, over accepted SLOTS
not distinct addresses (a bare-metal table aims most vectors at one shared
Default_Handler). The start-of-code stop is additionally conditioned on the lowest
handler lying at or above the table base. The widened scan runs only where the
shipped signature found nothing, so it can add entries but never remove one.

Measured on the stripped decbench ARM corpus (16 binaries x 3 opt levels, 41,378
DWARF entries) against the compiled/ binaries' DWARF:

  kuna functions (Listing on):  recall 38,238 -> 38,334 (+96); 118 new entries,
      96 ground truth (81.4%), 0 splitting a real body, 22 outside any body,
      ZERO entries lost anywhere.
  --option listing off:         recall 8,885 -> 9,278 (+393); 415 new entries,
      393 ground truth (94.7%), 0 splits, 0 lost. betaflight goes from ONE
      recovered function to 57.
  Byte-identical decompile-all output off vs on for x86-64 (gzip), ARM Linux
      (u-boot), and the four Cortex-M images the shipped signature already detects.

Wiring: a standalone CortexMVectorsPass stashed at load and gated at commit, the
eh_frame_full/funcstart_patterns shape (reading the flag inside EntryDiscoveryPass
silently did nothing - load-time passes run before --option is applied). The pass
emits entry facts and context paints ONLY; feeding the widened handlers to the
Listing walk was measured and rejected (+44 recall with 54 ground-truth entries
lost, because the walk absorbs the shared handler an ISR stub tail-calls). That is
proposal step 3's tail-call split.

Default-OFF, no DIV row: default output is byte-identical. Two-pass gate is a Rust
cross-crate test (verify_cortexmvectors.rs) over a new 357-byte hand-assembled
fixture, not a stages XML - the oracle keys on ELF structure the datatest harness
does not construct, the same reason every sibling analysis-tier discovery flag is
gated that way.

Gates: make test 675/675 PARITY OK; make test-stages 356/356 PARITY OK;
make rust-test green; make check-spec OK (lenient + strict); catalog OK.


Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
mahaloz added a commit that referenced this pull request Aug 3, 2026
…n entries on containment evidence

Step 2 of the approved ARM entry-recall sequence ([PROPOSAL] #239) and the one it
called the prize: 1,671 missed function entries, 56.8% of the whole ARM
entry-recall gap, every one of them reachable only through a code-pointer word
that `aif::code_pointer_table_seeds` already finds and then throws away.

The shipped Stage-3 scan requires a pointer's target to open with a Thumb
stack-frame prologue and to disassemble into more than two instructions. On
bare-metal firmware that is the wrong population: 93.3% of the missed entries
establish no frame at all and 41% are <= 8-byte leaves (`movs r0,#0; bx lr`, or a
bare `bx lr`, which is a valid Cortex-M exception handler every rival recovers).
Those two predicates reject 1,632 of the 1,671.

Deleting them is not shippable - the proposal measured the naive relaxation at 62%
ground truth with 21% of the new entries splitting a real function body, a failure
mode decbench structurally cannot see. So the whole of this change is the precision
model, and the model is CONTAINMENT rather than shape: reject a target when any
word that references it overlaps a decoded instruction (it is operand bytes, not a
table slot) or lies in the same discovered function as the target itself (that
pairing IS the `ldr pc,[pc,r]` switch table). Measured over 3,462 validated
candidates the two guards take splits from 1,261 to 0 for 17 ground-truth entries.
The `MIN_SUBROUTINE_INSNS` floor is replaced, not deleted, by a terminating-routine
check: the same speculative walk with the strict escape policy and no minimum
length.

This is kuna's form of the line Ghidra draws between `OperandReferenceAnalyzer`
(creates functions, from instruction operands) and `DataOperandReferenceAnalyzer`,
which overrides `createFunctions` to a no-op - "don't ever create a function from a
data pointer". kuna cannot use Ghidra's version directly because the Listing tier
records only control-flow references, so the containment pair recovers the same
discrimination from the code/data partition the walk leaves behind.

Measured on the 48-image decbench Cortex-M corpus (41,378 DWARF ground-truth
addresses), `kuna functions`:

  recall 38,238 (92.4%) -> 39,851 (96.3%), +1,613
  1,694 new entries, 1,613 ground truth (95.2%)
  0 splitting a real function body, 81 outside any DWARF body
  0 entries lost, 0 ground-truth entries lost

`--option listing off` is structurally inert (ptrentry is a Listing consumer): 0
new, 0 lost. Whole-binary `decompile-all --json` is sha256-identical off vs on for
x86-64, ARM Linux and the Cortex-M images with no admissible candidate.

Two things the proposal asked for that measurement rejected, both built and
measured rather than argued (tables in docs/features/ptrentry/):

  - table-run corroboration: a switch table IS a run, so it removes no additional
    split, and it costs 311 ground-truth functions (1,302 vs 1,613);
  - re-seeding the recursive-descent walk (what Stages 2-3 do): +13 ground-truth
    entries but 974 split bodies and 734 dropped entries, through the same
    tail-call absorption that constrained step 1. The pass therefore emits entry
    facts only, which makes "never removes an entry" a property of the wiring
    rather than of a heuristic. That also settles the proposal's optional AIF
    gap-start re-walk fold-in: closing it IS a walk re-seed, so it stays with
    step 3.

Default-OFF and not auto-injected by any driver: it discovers more functions, so it
changes emitted C by construction, and the precision numbers want a human read
before a flip. No DIV row (default output is byte-identical).

Tests: `kuna-console/tests/verify_ptrentry.rs` is the two-pass e2e over a new
hand-assembled fixture carrying both shapes - the pointer-only leaf that must be
recovered and the switch-table case that must stay rejected with the option ON -
plus three unit tests and a superset-property pin. No `tests/stages/*.xml`: the
harness embeds raw `<bytechunk>`s and never builds a load image or a Listing, the
same reason every sibling analysis-tier discovery flag ships a cross-crate
`verify_*` gate.

Gates: make test PARITY OK 675/675; make test-stages PARITY OK 369/369; make
rust-test green; make check-spec green (strict); kuna catalog --check OK.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL
mahaloz added a commit that referenced this pull request Aug 3, 2026
…n entries on containment evidence

Step 2 of the approved ARM entry-recall sequence ([PROPOSAL] #239) and the one it
called the prize: 1,671 missed function entries, 56.8% of the whole ARM
entry-recall gap, every one of them reachable only through a code-pointer word
that `aif::code_pointer_table_seeds` already finds and then throws away.

The shipped Stage-3 scan requires a pointer's target to open with a Thumb
stack-frame prologue and to disassemble into more than two instructions. On
bare-metal firmware that is the wrong population: 93.3% of the missed entries
establish no frame at all and 41% are <= 8-byte leaves (`movs r0,#0; bx lr`, or a
bare `bx lr`, which is a valid Cortex-M exception handler every rival recovers).
Those two predicates reject 1,632 of the 1,671.

Deleting them is not shippable - the proposal measured the naive relaxation at 62%
ground truth with 21% of the new entries splitting a real function body, a failure
mode decbench structurally cannot see. So the whole of this change is the precision
model, and the model is CONTAINMENT rather than shape: reject a target when any
word that references it overlaps a decoded instruction (it is operand bytes, not a
table slot) or lies in the same discovered function as the target itself (that
pairing IS the `ldr pc,[pc,r]` switch table). Measured over 3,462 validated
candidates the two guards take splits from 1,261 to 0 for 17 ground-truth entries.
The `MIN_SUBROUTINE_INSNS` floor is replaced, not deleted, by a terminating-routine
check: the same speculative walk with the strict escape policy and no minimum
length.

This is kuna's form of the line Ghidra draws between `OperandReferenceAnalyzer`
(creates functions, from instruction operands) and `DataOperandReferenceAnalyzer`,
which overrides `createFunctions` to a no-op - "don't ever create a function from a
data pointer". kuna cannot use Ghidra's version directly because the Listing tier
records only control-flow references, so the containment pair recovers the same
discrimination from the code/data partition the walk leaves behind.

Measured on the 48-image decbench Cortex-M corpus (41,378 DWARF ground-truth
addresses), `kuna functions`:

  recall 38,238 (92.4%) -> 39,851 (96.3%), +1,613
  1,694 new entries, 1,613 ground truth (95.2%)
  0 splitting a real function body, 81 outside any DWARF body
  0 entries lost, 0 ground-truth entries lost

`--option listing off` is structurally inert (ptrentry is a Listing consumer): 0
new, 0 lost. Whole-binary `decompile-all --json` is sha256-identical off vs on for
x86-64, ARM Linux and the Cortex-M images with no admissible candidate.

Two things the proposal asked for that measurement rejected, both built and
measured rather than argued (tables in docs/features/ptrentry/):

  - table-run corroboration: a switch table IS a run, so it removes no additional
    split, and it costs 311 ground-truth functions (1,302 vs 1,613);
  - re-seeding the recursive-descent walk (what Stages 2-3 do): +13 ground-truth
    entries but 974 split bodies and 734 dropped entries, through the same
    tail-call absorption that constrained step 1. The pass therefore emits entry
    facts only, which makes "never removes an entry" a property of the wiring
    rather than of a heuristic. That also settles the proposal's optional AIF
    gap-start re-walk fold-in: closing it IS a walk re-seed, so it stays with
    step 3.

Default-OFF and not auto-injected by any driver: it discovers more functions, so it
changes emitted C by construction, and the precision numbers want a human read
before a flip. No DIV row (default output is byte-identical).

Tests: `kuna-console/tests/verify_ptrentry.rs` is the two-pass e2e over a new
hand-assembled fixture carrying both shapes - the pointer-only leaf that must be
recovered and the switch-table case that must stay rejected with the option ON -
plus three unit tests and a superset-property pin. No `tests/stages/*.xml`: the
harness embeds raw `<bytechunk>`s and never builds a load image or a Listing, the
same reason every sibling analysis-tier discovery flag ships a cross-crate
`verify_*` gate.

Gates on the rebased tree (origin/main 208bb15, after #252/#253/#254): make test
PARITY OK 675/675; make test-stages PARITY OK 386/386; make rust-test green
(295/295 result blocks); make check-spec green in strict mode; kuna catalog
--check OK.

Every shared counter is derived from a fresh `phase catalog` capture and a green
run on the rebased tree, not by arithmetic: settables 87 -> 88, analysis tier
26 -> 27, catalog JSON rows 86 -> 87, bytecompat fixture 87 -> 88, and the
live-value count stays at 29 because this row declares no codegen live_field.
The `kuna-base/src/xml.rs` corpus count was verified by counting the files (83
datatests + 107 stages = 190, unchanged), and `docs/baseline-stages.json` is
untouched because this PR adds no stages XML. The recall/precision table and the
off-vs-on sha256 ablation were re-measured on the rebased build and are
unchanged, with 0 of 48 per-binary entry sets differing from the pre-rebase run.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL
mahaloz added a commit that referenced this pull request Aug 3, 2026
…n entries on containment evidence (#255)

Step 2 of the approved ARM entry-recall sequence ([PROPOSAL] #239) and the one it
called the prize: 1,671 missed function entries, 56.8% of the whole ARM
entry-recall gap, every one of them reachable only through a code-pointer word
that `aif::code_pointer_table_seeds` already finds and then throws away.

The shipped Stage-3 scan requires a pointer's target to open with a Thumb
stack-frame prologue and to disassemble into more than two instructions. On
bare-metal firmware that is the wrong population: 93.3% of the missed entries
establish no frame at all and 41% are <= 8-byte leaves (`movs r0,#0; bx lr`, or a
bare `bx lr`, which is a valid Cortex-M exception handler every rival recovers).
Those two predicates reject 1,632 of the 1,671.

Deleting them is not shippable - the proposal measured the naive relaxation at 62%
ground truth with 21% of the new entries splitting a real function body, a failure
mode decbench structurally cannot see. So the whole of this change is the precision
model, and the model is CONTAINMENT rather than shape: reject a target when any
word that references it overlaps a decoded instruction (it is operand bytes, not a
table slot) or lies in the same discovered function as the target itself (that
pairing IS the `ldr pc,[pc,r]` switch table). Measured over 3,462 validated
candidates the two guards take splits from 1,261 to 0 for 17 ground-truth entries.
The `MIN_SUBROUTINE_INSNS` floor is replaced, not deleted, by a terminating-routine
check: the same speculative walk with the strict escape policy and no minimum
length.

This is kuna's form of the line Ghidra draws between `OperandReferenceAnalyzer`
(creates functions, from instruction operands) and `DataOperandReferenceAnalyzer`,
which overrides `createFunctions` to a no-op - "don't ever create a function from a
data pointer". kuna cannot use Ghidra's version directly because the Listing tier
records only control-flow references, so the containment pair recovers the same
discrimination from the code/data partition the walk leaves behind.

Measured on the 48-image decbench Cortex-M corpus (41,378 DWARF ground-truth
addresses), `kuna functions`:

  recall 38,238 (92.4%) -> 39,851 (96.3%), +1,613
  1,694 new entries, 1,613 ground truth (95.2%)
  0 splitting a real function body, 81 outside any DWARF body
  0 entries lost, 0 ground-truth entries lost

`--option listing off` is structurally inert (ptrentry is a Listing consumer): 0
new, 0 lost. Whole-binary `decompile-all --json` is sha256-identical off vs on for
x86-64, ARM Linux and the Cortex-M images with no admissible candidate.

Two things the proposal asked for that measurement rejected, both built and
measured rather than argued (tables in docs/features/ptrentry/):

  - table-run corroboration: a switch table IS a run, so it removes no additional
    split, and it costs 311 ground-truth functions (1,302 vs 1,613);
  - re-seeding the recursive-descent walk (what Stages 2-3 do): +13 ground-truth
    entries but 974 split bodies and 734 dropped entries, through the same
    tail-call absorption that constrained step 1. The pass therefore emits entry
    facts only, which makes "never removes an entry" a property of the wiring
    rather than of a heuristic. That also settles the proposal's optional AIF
    gap-start re-walk fold-in: closing it IS a walk re-seed, so it stays with
    step 3.

Default-OFF and not auto-injected by any driver: it discovers more functions, so it
changes emitted C by construction, and the precision numbers want a human read
before a flip. No DIV row (default output is byte-identical).

Tests: `kuna-console/tests/verify_ptrentry.rs` is the two-pass e2e over a new
hand-assembled fixture carrying both shapes - the pointer-only leaf that must be
recovered and the switch-table case that must stay rejected with the option ON -
plus three unit tests and a superset-property pin. No `tests/stages/*.xml`: the
harness embeds raw `<bytechunk>`s and never builds a load image or a Listing, the
same reason every sibling analysis-tier discovery flag ships a cross-crate
`verify_*` gate.

Gates on the rebased tree (origin/main 208bb15, after #252/#253/#254): make test
PARITY OK 675/675; make test-stages PARITY OK 386/386; make rust-test green
(295/295 result blocks); make check-spec green in strict mode; kuna catalog
--check OK.

Every shared counter is derived from a fresh `phase catalog` capture and a green
run on the rebased tree, not by arithmetic: settables 87 -> 88, analysis tier
26 -> 27, catalog JSON rows 86 -> 87, bytecompat fixture 87 -> 88, and the
live-value count stays at 29 because this row declares no codegen live_field.
The `kuna-base/src/xml.rs` corpus count was verified by counting the files (83
datatests + 107 stages = 190, unchanged), and `docs/baseline-stages.json` is
untouched because this PR adds no stages XML. The recall/precision table and the
off-vs-on sha256 ablation were re-measured on the rebased build and are
unchanged, with 0 of 48 per-binary entry sets differing from the pre-rebase run.


Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
@mahaloz

mahaloz commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Sequence progress (2026-08-03)

Steps 1 and 2 have shipped. Measured against this proposal's own acceptance bar (>= 80% of new entries are ground truth, zero regression), on the same harness: 16 Cortex-M binaries x 3 opt levels = 48 stripped images, 41,378 DWARF ground-truth addresses.

step slug PR status result
1 cortexmvectors #248 merged +96 GT on the decbench surface (81.4% precision, 0 lost); with listing off +393 (94.7%, 0 lost). betaflight 1 -> 57 functions.
2 ptrentry #255 merged recall 38,238 (92.4%) -> 39,851 (96.3%); +1,694 new, 1,613 ground truth (95.2%), 0 splits, 0 lost.
3 tailcallentry — in flight —
4 TBB/TBH resolution — not started —

Both default-OFF, both PARITY OK 675/675.

Three corrections this proposal's own predictions needed

1. The vector-table signature had a fourth defect not identified here. All three shipped predicates were wrong and betaflight links .isr_vector into RAM above the flash it points at, so harvest_vector_words' "stop at the start of code" rule fired on slot 2 and the table looked one word long. Without fixing that, betaflight recovered nothing even with the signature widened.

2. Table-run corroboration — the named precision guard for step 2 — is dominated and was not shipped. Instrumented across 3,462 validated candidates: a switch table is a run, so it removes no additional split, and it costs 311 ground-truth functions for 2.1pp of precision sitting entirely in the unverifiable "outside any DWARF body" bucket.

The actual precision model is containment:

guard n ground truth splits
validated candidates 3,462 2,009 (58.0%) 1,261
+ no referencing word shares the target's discovered function 2,184 1,997 (91.4%) 8
+ no referencing word overlaps a decoded instruction 2,143 1,992 (93.0%) 0

3. The walk-reseed trap is real and scales. Step 1 measured it at +44 entries for 54 ground-truth lost; step 2 measured the same wiring at +13 for 734 lost and 974 real bodies split. Both shipped the additive entry-facts wiring instead, which is what makes the results structural rather than heuristic — and why nothing is lost in either.

That also settles the optional AIF gap-start re-walk (passes.rs:535, ~+39 entries): closing it is a walk re-seed, so it sequences with step 3, not step 2.

What step 3 has to clear

The tail-call arm remains the sequence's real precision risk — this proposal measures the naive version at 39% ground truth with 55% of new entries splitting a real body, and even the stricter variant at 54% / 38%. Containment (WalkState tracking per-function claimed instruction sets) is the stated prerequisite, and step 2's result is the evidence that a containment model is what gets this class of change from ~58% to >90%. Step 3 is under the same hard gate: >= 80% ground truth with zero losses, or it reports its ceiling and does not open a PR.

🤖 Generated with Claude Code

mahaloz added a commit that referenced this pull request Aug 3, 2026
…cost this round

Docs-only. No .rs, no phases.toml, no baselines, no tests.
Rebased onto origin/main 4c2b59b (after #254, #255 and #257).

Round 2 shipped, and the benchmark signal was refreshed on 2026-08-03 (all three
opt levels re-decompiled from pinned kuna 9623dc2). Several documented claims
were provably stale and several hard-won operational facts existed only in agent
transcripts. Both fixed, every number re-verified against the live tree.

docs/decbench-loop.md
- Standings replaced and widened: GED ida 36.06 / kuna 35.93 / angr 34.20,
  overall ida 38.01 / kuna 37.91 / angr 36.98, byte_match kuna 3.41 (first).
  Stated plainly that kuna's column is current while the rivals' are from their
  own last runs, so the tree is a MINING INSTRUMENT, not a leaderboard.
- Recall pool: 6,540 (7.3%) -> 1,420 vs angr / 1,552 vs ida, 0 whole-binary
  failures, now almost entirely embedded ARM Cortex-M. All three named causes
  corrected: "u-boot 100% / freertos 100%" was a decbench .text-filter artifact
  and never a kuna discovery failure (angr and ida score nothing there);
  "betaflight 22%" is 6.0%; the coreutils `main` empty-body/panic is fixed
  (comm/join/timeout/uniq all produce full bodies today).
- The `--mode auto` degrades-to-fast warning is moot for this corpus: the
  largest stripped binary is O0 bash at 1,513,904 B (1.44 MiB), so all 803
  binaries resolve 768 aggressive / 35 reliable / 0 fast. The aggressive-vs-
  reliable distinction is kept and sharpened; the stale 21-of-24 default-off
  count is now 20 of 25, with the five exclusions named.
- Two operational traps recorded for the first time:
  (a) byte_match RECOMPILES with an arch-matched toolchain and this box has
      neither arm-none-eabi-gcc nor MinGW, so deleting kuna's (never
      auto-invalidated) checkpoints destroys kuna's ARM/PE scores while every
      rival keeps theirs. The coverage guard caught 34 slices; O2 and
      O2-noinline are still damaged from an earlier DECBENCH_ALLOW_DROPS=1 run
      with no surviving copy. Rule: never pass DECBENCH_ALLOW_DROPS=1 without
      reading every [guard] line.
  (b) The pools store a PE address as an RVA where kuna uses the VA, so
      scripts.decbench.rescore fails on every PE case (119 across the three
      pools). Recorded with a fix direction.
- Pointed at the durable refresh recipe at ~/decbench-campaign-state/ and its
  two pinning rules, plus the non-obvious one: the GED baseline must drop kuna's
  published scores for EVERY re-decompiled opt level, not just the one being
  refreshed (an O0-only baseline died with "cannot reproduce published fallback
  58.0" on an O2 slice).

Method corrections (decbench-loop.md + improvement-pipeline.md standing rules)
- "Not a no-op" is not "correct". On paramcopyhoist a refuter proved the
  proposed hook reached the printer and it was still the wrong site: it deleted
  an assignment, lost an early return, and made another function return the
  wrong parameter. The refute brief now carries an explicit "would this produce
  WRONG output?" axis.
- Diff every changed function, not the witness. Those designs all passed on
  their witness. Round 2's PRs swept 3,031 / 12,241 / 14,720 / 15,386 functions;
  two caught real problems that way.
- The tally, honestly: round 1's filed mechanisms were 2-for-5, round 2's
  refuters overturned the filed diagnosis on 3 of 8, and the symptom stood in
  every case.

Shared counters in a busy queue (decbench-loop.md + improvement-pipeline.md)
- Round 2 ran up to four output-changing PRs over the same hard-coded counters
  and produced three failure shapes, only one of which announced itself: a
  conflict (#257's DIV number raced 55 -> 56 -> 57 -> 58); a SILENT
  identical-edit auto-merge (catalog_bytecompat.rs kept 86 because both sides
  made the same 85 -> 86 edit); and a SILENT keep-both auto-merge (a stale
  baseline-stages.json data_footer, and five rounds of keep-both duplicating a
  row in tests/stages/README.md).
- Rules written down: derive every shared counter from a fresh capture and a
  green run on the rebased tree, never by arithmetic; diff every keep-both
  resolution against main asserting you removed nothing and added nothing twice;
  DIV numbers are claimed on merge; re-run the gates AFTER the rebase.
- New standing requirement 9: re-measure after every rebase, never carry a
  number forward. #257's placeholder count moved 2,143 -> 2,142 because #254
  landed underneath it, caught only by re-measuring.

docs/decbench/features.md
- Round-1 menu replaced by round-2 outcomes, keeping the file's shape and its
  rank-by-correctness thesis. NINE merged PRs: #248 cortexmvectors,
  #249 funcptralign, #250 paramcopyhoist, #251 subright, #252 returncopysplit,
  #253 itecondlist, #254 peimportcall (DIV-57), #255 ptrentry and #257 undefname
  (DIV-58) -- seven of the eight round-2 candidates plus steps 1 and 2 of the
  ARM entry-recall sequence (#239). Only three of the nine move GED on a mined
  case; four are correctness fixes the metric cannot see and two are recall.
- The dead-pass finding is now three DISTINCT shapes to grep for, not one
  anecdote: stub body (RuleSubRight), live body with a permanently-zero input
  (RuleFuncPtrEncoding's hard-coded funcptr_align() = 0), and live body with a
  gate bit that has no writer anywhere (ActionDeindirect / externref). The third
  had a second gap in the same chain -- GlobalEntry::func_no_return never copied
  the callee's no-return flag into the snapshot -- so one dead gate can hide
  another.
- The ARM sequence is cross-referenced to the live table on PR #239 rather than
  duplicated here, so it cannot go stale in-repo.
- Carried forward as the one still-open candidate: catalog-upstream-options
  (38 upstream-inherited ArchOptions invisible to `kuna catalog`).

Re-mined pool tables regenerated against the refreshed tree (snapshot
2026-08-03): backlog.md, backlog-ida.md, novel.md, triage-queue*.json.

Gates on the rebased base: make check-spec OK (lenient and strict);
make test 675/675 PARITY OK; make test-stages 394/394 PARITY OK.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL
mahaloz added a commit that referenced this pull request Aug 3, 2026
…cost this round (#256)

Docs-only. No .rs, no phases.toml, no baselines, no tests.
Rebased onto origin/main 4c2b59b (after #254, #255 and #257).

Round 2 shipped, and the benchmark signal was refreshed on 2026-08-03 (all three
opt levels re-decompiled from pinned kuna 9623dc2). Several documented claims
were provably stale and several hard-won operational facts existed only in agent
transcripts. Both fixed, every number re-verified against the live tree.

docs/decbench-loop.md
- Standings replaced and widened: GED ida 36.06 / kuna 35.93 / angr 34.20,
  overall ida 38.01 / kuna 37.91 / angr 36.98, byte_match kuna 3.41 (first).
  Stated plainly that kuna's column is current while the rivals' are from their
  own last runs, so the tree is a MINING INSTRUMENT, not a leaderboard.
- Recall pool: 6,540 (7.3%) -> 1,420 vs angr / 1,552 vs ida, 0 whole-binary
  failures, now almost entirely embedded ARM Cortex-M. All three named causes
  corrected: "u-boot 100% / freertos 100%" was a decbench .text-filter artifact
  and never a kuna discovery failure (angr and ida score nothing there);
  "betaflight 22%" is 6.0%; the coreutils `main` empty-body/panic is fixed
  (comm/join/timeout/uniq all produce full bodies today).
- The `--mode auto` degrades-to-fast warning is moot for this corpus: the
  largest stripped binary is O0 bash at 1,513,904 B (1.44 MiB), so all 803
  binaries resolve 768 aggressive / 35 reliable / 0 fast. The aggressive-vs-
  reliable distinction is kept and sharpened; the stale 21-of-24 default-off
  count is now 20 of 25, with the five exclusions named.
- Two operational traps recorded for the first time:
  (a) byte_match RECOMPILES with an arch-matched toolchain and this box has
      neither arm-none-eabi-gcc nor MinGW, so deleting kuna's (never
      auto-invalidated) checkpoints destroys kuna's ARM/PE scores while every
      rival keeps theirs. The coverage guard caught 34 slices; O2 and
      O2-noinline are still damaged from an earlier DECBENCH_ALLOW_DROPS=1 run
      with no surviving copy. Rule: never pass DECBENCH_ALLOW_DROPS=1 without
      reading every [guard] line.
  (b) The pools store a PE address as an RVA where kuna uses the VA, so
      scripts.decbench.rescore fails on every PE case (119 across the three
      pools). Recorded with a fix direction.
- Pointed at the durable refresh recipe at ~/decbench-campaign-state/ and its
  two pinning rules, plus the non-obvious one: the GED baseline must drop kuna's
  published scores for EVERY re-decompiled opt level, not just the one being
  refreshed (an O0-only baseline died with "cannot reproduce published fallback
  58.0" on an O2 slice).

Method corrections (decbench-loop.md + improvement-pipeline.md standing rules)
- "Not a no-op" is not "correct". On paramcopyhoist a refuter proved the
  proposed hook reached the printer and it was still the wrong site: it deleted
  an assignment, lost an early return, and made another function return the
  wrong parameter. The refute brief now carries an explicit "would this produce
  WRONG output?" axis.
- Diff every changed function, not the witness. Those designs all passed on
  their witness. Round 2's PRs swept 3,031 / 12,241 / 14,720 / 15,386 functions;
  two caught real problems that way.
- The tally, honestly: round 1's filed mechanisms were 2-for-5, round 2's
  refuters overturned the filed diagnosis on 3 of 8, and the symptom stood in
  every case.

Shared counters in a busy queue (decbench-loop.md + improvement-pipeline.md)
- Round 2 ran up to four output-changing PRs over the same hard-coded counters
  and produced three failure shapes, only one of which announced itself: a
  conflict (#257's DIV number raced 55 -> 56 -> 57 -> 58); a SILENT
  identical-edit auto-merge (catalog_bytecompat.rs kept 86 because both sides
  made the same 85 -> 86 edit); and a SILENT keep-both auto-merge (a stale
  baseline-stages.json data_footer, and five rounds of keep-both duplicating a
  row in tests/stages/README.md).
- Rules written down: derive every shared counter from a fresh capture and a
  green run on the rebased tree, never by arithmetic; diff every keep-both
  resolution against main asserting you removed nothing and added nothing twice;
  DIV numbers are claimed on merge; re-run the gates AFTER the rebase.
- New standing requirement 9: re-measure after every rebase, never carry a
  number forward. #257's placeholder count moved 2,143 -> 2,142 because #254
  landed underneath it, caught only by re-measuring.

docs/decbench/features.md
- Round-1 menu replaced by round-2 outcomes, keeping the file's shape and its
  rank-by-correctness thesis. NINE merged PRs: #248 cortexmvectors,
  #249 funcptralign, #250 paramcopyhoist, #251 subright, #252 returncopysplit,
  #253 itecondlist, #254 peimportcall (DIV-57), #255 ptrentry and #257 undefname
  (DIV-58) -- seven of the eight round-2 candidates plus steps 1 and 2 of the
  ARM entry-recall sequence (#239). Only three of the nine move GED on a mined
  case; four are correctness fixes the metric cannot see and two are recall.
- The dead-pass finding is now three DISTINCT shapes to grep for, not one
  anecdote: stub body (RuleSubRight), live body with a permanently-zero input
  (RuleFuncPtrEncoding's hard-coded funcptr_align() = 0), and live body with a
  gate bit that has no writer anywhere (ActionDeindirect / externref). The third
  had a second gap in the same chain -- GlobalEntry::func_no_return never copied
  the callee's no-return flag into the snapshot -- so one dead gate can hide
  another.
- The ARM sequence is cross-referenced to the live table on PR #239 rather than
  duplicated here, so it cannot go stale in-repo.
- Carried forward as the one still-open candidate: catalog-upstream-options
  (38 upstream-inherited ArchOptions invisible to `kuna catalog`).

Re-mined pool tables regenerated against the refreshed tree (snapshot
2026-08-03): backlog.md, backlog-ida.md, novel.md, triage-queue*.json.

Gates on the rebased base: make check-spec OK (lenient and strict);
make test 675/675 PARITY OK; make test-stages 394/394 PARITY OK.


Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
mahaloz added a commit that referenced this pull request Aug 3, 2026
…e Listing walk absorbs at a tail call (+561 at 94.6%)

Step 3 of the approved ARM entry-recall sequence (PROPOSAL PR #239), and the step
both shipped predecessors independently found blocking them: `listing/walk.rs`
makes a new function only at a CALL target and treats every other flow target as
a same-function successor, so a routine reached only by a tail `B` is swallowed
by whichever function branched to it and never becomes a function at all — 513
missed entries, 17.4% of the ARM entry-recall gap.

Measured on 96 ARM Cortex-M images (43,809 DWARF entries), `kuna functions
--mode aggressive`:

  entry recall 40,309 (92.0%) -> 40,870 (93.3%)
  593 new entries, 561 ground truth (94.6%), 0 split a real body,
  32 outside any DWARF body, 0 entries lost

The proposal's naive arm for this step was the worst-precision arm of the whole
sequence — 39% ground truth with 55% of the new entries splitting a real
function body — and its "stricter" variant 54%/38%. Neither was shippable.

Two results got past that.

1. The split cannot change what the walk decodes. Writing the walk as its
   closure, moving a tail-call target from the instruction worklist to the
   function worklist leaves the decoded-instruction set fixed, because a
   function entry is walked and therefore decoded either way. So the split is
   computed AFTER the walk, with complete predecessor and region information
   rather than whatever the LIFO worklist order exposed, and emitted as an
   additive entry fact that never rebuilds the Listing. "Never removes an entry"
   is a property of the wiring, not of a heuristic.

2. Containment is region crossing. A target is admitted only when every
   predecessor is an unconditional branch, the branch LEAVES the caller's
   entry-ordered function region, the target's flow region reaches a RETURN or
   computed jump (no length floor), and the target does not open with a stack
   restore. Leave-one-out says the region crossing is load-bearing: dropping it
   costs 43 points of precision and splits 514 real bodies. A stack-discipline
   model (reject a branch taken with an unmatched PUSH/SUB SP open) was built,
   measured at 89.9%/18 splits, and dominated; inter-function alignment padding
   was measured and declined at 186 ground-truth functions for 1.6pp.

Split-half holdout over the eight projects: the shipped rule scores 99.2% with
zero splits on the held-out half. Per project 90.3%-100.0%, per optimisation
level 85.7%-96.8%, zero split bodies in every cell.

Exactly orthogonal to `ptrentry` (#255): identical delta with it off and on,
because neither enters `Listing::functions()`. Stacked, corpus entry recall is
97.2%.

The AIF gap-start re-walk that step 2 assigned here is NOT folded in, and the
measurement says why: it is a walk re-seed, which ADDS to the decoded-instruction
closure and makes other stages' candidates fail their `is_undefined` guard —
109 entries lost, 87 of them ground truth, 1013 split bodies, and
`tailcallentry` makes it slightly worse rather than safe.

Default-OFF, ARM-gated. gzip (x86-64) and mydoom.exe (PE) are byte-identical
off vs on. u-boot (ARM Linux, A32) is in scope and disclosed: +21 entries, 19
ground truth (90.5%), 2 splits, 0 lost — the one non-zero-split number, on a
population the model was never fitted on.

Bundle: docs/features/tailcallentry/. Gates: make test 675/675 PARITY OK,
make test-stages 394/394 PARITY OK, make rust-test green, make check-spec green
(strict), kuna catalog --check OK. No DIV row (default output byte-identical).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL
mahaloz added a commit that referenced this pull request Aug 3, 2026
…e Listing walk absorbs at a tail call (+561 at 94.6%) (#259)

Step 3 of the approved ARM entry-recall sequence (PROPOSAL PR #239), and the step
both shipped predecessors independently found blocking them: `listing/walk.rs`
makes a new function only at a CALL target and treats every other flow target as
a same-function successor, so a routine reached only by a tail `B` is swallowed
by whichever function branched to it and never becomes a function at all — 513
missed entries, 17.4% of the ARM entry-recall gap.

Measured on 96 ARM Cortex-M images (43,809 DWARF entries), `kuna functions
--mode aggressive`:

  entry recall 40,309 (92.0%) -> 40,870 (93.3%)
  593 new entries, 561 ground truth (94.6%), 0 split a real body,
  32 outside any DWARF body, 0 entries lost

The proposal's naive arm for this step was the worst-precision arm of the whole
sequence — 39% ground truth with 55% of the new entries splitting a real
function body — and its "stricter" variant 54%/38%. Neither was shippable.

Two results got past that.

1. The split cannot change what the walk decodes. Writing the walk as its
   closure, moving a tail-call target from the instruction worklist to the
   function worklist leaves the decoded-instruction set fixed, because a
   function entry is walked and therefore decoded either way. So the split is
   computed AFTER the walk, with complete predecessor and region information
   rather than whatever the LIFO worklist order exposed, and emitted as an
   additive entry fact that never rebuilds the Listing. "Never removes an entry"
   is a property of the wiring, not of a heuristic.

2. Containment is region crossing. A target is admitted only when every
   predecessor is an unconditional branch, the branch LEAVES the caller's
   entry-ordered function region, the target's flow region reaches a RETURN or
   computed jump (no length floor), and the target does not open with a stack
   restore. Leave-one-out says the region crossing is load-bearing: dropping it
   costs 43 points of precision and splits 514 real bodies. A stack-discipline
   model (reject a branch taken with an unmatched PUSH/SUB SP open) was built,
   measured at 89.9%/18 splits, and dominated; inter-function alignment padding
   was measured and declined at 186 ground-truth functions for 1.6pp.

Split-half holdout over the eight projects: the shipped rule scores 99.2% with
zero splits on the held-out half. Per project 90.3%-100.0%, per optimisation
level 85.7%-96.8%, zero split bodies in every cell.

Exactly orthogonal to `ptrentry` (#255): identical delta with it off and on,
because neither enters `Listing::functions()`. Stacked, corpus entry recall is
97.2%.

The AIF gap-start re-walk that step 2 assigned here is NOT folded in, and the
measurement says why: it is a walk re-seed, which ADDS to the decoded-instruction
closure and makes other stages' candidates fail their `is_undefined` guard —
109 entries lost, 87 of them ground truth, 1013 split bodies, and
`tailcallentry` makes it slightly worse rather than safe.

Default-OFF, ARM-gated. gzip (x86-64) and mydoom.exe (PE) are byte-identical
off vs on. u-boot (ARM Linux, A32) is in scope and disclosed: +21 entries, 19
ground truth (90.5%), 2 splits, 0 lost — the one non-zero-split number, on a
population the model was never fitted on.

Bundle: docs/features/tailcallentry/. Gates: make test 675/675 PARITY OK,
make test-stages 394/394 PARITY OK, make rust-test green, make check-spec green
(strict), kuna catalog --check OK. No DIV row (default output byte-identical).


Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
@mahaloz

mahaloz commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Step 3 shipped (2026-08-03)

step slug PR status result
1 cortexmvectors #248 merged +96 GT (81.4% precision, 0 lost); betaflight 1 -> 57 functions
2 ptrentry #255 merged recall 92.4% -> 96.3%; +1,613 GT at 95.2%, 0 splits, 0 lost
3 tailcallentry #259 merged +561 GT at 94.6%, 0 splits, 0 lost; stacked on ptrentry, Cortex-M recall 95.9% -> 97.2%
4 TBB/TBH resolution — not started the called class, 297 entries

All three default-OFF, all PARITY OK 675/675.

Step 3 re-measured this proposal's two variants at full corpus scale, and both are unshippable

Over all 96 Cortex-M images (43,809 ground-truth addresses), not the 48-image subset:

arm new ground truth splits a real body
proposal's naive arm 39,128 1.7% 37,667
proposal's "stricter" arm 1,392 47.6% 607
shipped 593 94.6% 0

What actually worked, and why the sketched mechanism could not

The proposal called for an in-walk "already claimed by this function?" test backed by WalkState tracking per-function claimed instruction sets. That test is order-dependent and answers "no" for every forward branch, which is why it is not what shipped.

The shipped model rests on a small structural result: a split cannot change what the walk decodes. Since F (function entries) is a subset of I (decoded instructions) — an entry is walked, hence decoded — moving a tail-call target from the instruction worklist to the function worklist leaves the decode closure fixed. So the split is computed after the walk, with complete predecessor and region information, and emitted as an additive entry fact. "Never removes an entry" is therefore a property of the wiring, not a heuristic — which is why zero are lost, on every surface.

Containment is region crossing (the mirror of ptrentry's same-region guard): the branch must leave the caller's entry-ordered region, all predecessors must be unconditional, the region must terminate, and the target must not open with a stack restore. Leave-one-out: drop region -> 514 splits; drop pure-predecessor -> 156; drop epilogue -> 12; drop terminating -> 0 but fewer entries.

Generalisation was checked, not assumed: split-half holdout gives 99.2% with 0 splits on the held-out half, per-project 90.3-100%, zero splits in every cell.

Two disclosures

  • u-boot (ARM Linux, A32) has 2 splits — +21 entries, 19 ground truth, 0 lost. It is the only non-zero split figure in the sequence. It was disclosed rather than gated away by restricting the pass to Cortex-M; a length floor would fix it and cost ~60 Cortex-M ground-truth entries, the same trade step 2 rejected.
  • The AIF gap-start re-walk (passes.rs:535) is measured and NOT folded in. It loses 109 entries (87 ground truth) and splits 1,013 bodies, and gets worse with tailcallentry on: a split leaves the decode closure fixed, but a re-seed adds to it and makes other stages fail is_undefined. It needs its own investigation rather than being attached to any step here.

Scoreboard

--mode aggressive is load-bearing for these measurements: betaflight is 533,396 B, so default auto resolves it to reliable, which builds no Listing at all (1 entry, 0% recall).

Remaining: step 4 only.

🤖 Generated with Claude Code

mahaloz added a commit that referenced this pull request Aug 5, 2026
…on, it is a point inside one (-1030 spurious entries, 0 real lost)

A kuna FunctionSymbol is an entry address with no extent: Database::add_function
takes an address and find_function answers "is a function registered AT this
address", never "is this address INSIDE one". Every discovery oracle's dedup is
therefore an equality test, and a candidate 12 bytes into a body passes it.

Three oracles do exactly that on ordinary compiler output, and --mode auto turns
all three on for anything under 500 KiB by resolving to `aggressive`:
eh_frame_full promotes each .gcc_except_table landing pad to a top-level function
(it is designed to), aif starts one at the first undecoded byte of an
unwinder-only region (routinely not an instruction boundary), and the prologue
patterns match an aligned `push rbp; mov rbp,rsp` inside a larger body. On a
g++ -O0 probe, probe_try_catch [0x2acf,0x2ba7) yields sub_2b0b / sub_2b1a /
sub_2b8a, all three surviving stripping, and sub_2b0b decompiles with an
uninitialised rbp so every local is a garbage dereference. IDA Pro 9.2 gives
get_func(0x2b0b).start_ea == 0x2acf; that is the model.

.eh_frame carries the missing extent: each FDE records ONE function's
[pcBegin, pcBegin+pcRange). kuna_fdeinterior.rs reuses scan_eh_frame_starts's
record walk and adds the one field it skips - pcRange, decoded with the CIE R
encoding's format bits only, since it is a length - and the commit filters the
FULLY MERGED entry set, after the deferred Listing consumers, because one
producer is aif.

Not every FDE describes one function: the linker gives the whole PLT a single
FDE and every stub inside it is real (the first prototype deleted every import).
A range is used only when no other named function start, no other FDE pcBegin,
and no .plt/.plt.sec/.plt.got/.iplt/.MIPS.stubs section falls inside it. An entry
AT an FDE start is never suppressed, so oracle 3's own product is preserved.

Gated and default-ON (DIV-60) because the measurement leaves no judgment call.
kuna functions off vs on over 72 stripped decbench x86-64 binaries, every dropped
entry classified against the matching unstripped binary's FUNC symbols (address
and size): 36,568 -> 35,538 entries, 1,030 dropped, 0 added, ZERO that are a real
function's entry, ZERO that carry a name, all 1,030 strictly inside a real body,
52 not even an instruction boundary. C++: big_O0.stripped 599 -> 449 (25% of the
list was junk), probe_O0.stripped 189 -> 162. Static glibc --mode aggressive
1,358 -> 1,087 with 0 real and 0 named lost. PE and ET_REL are inert.
Whole-binary decompile-all on five binaries: 0 functions added, 0 surviving
bodies changed and 0 surviving names changed.

#259 (tailcallentry) non-regression, measured on its own corpus and surface with
--option tailcallentry on: all 98 ARM images, entries 57,578 -> 57,578, zero
images changed - bare-metal ARM unwinds through .ARM.exidx and only 3 of 98
carry any .eh_frame FDE. The same argument covers draft PR #239.

Disclosed interaction: eh_frame_full's landing-pad product is now constrained by
this gate, so verify_eh_frame_full's option-on arm flips fdeinterior off to keep
testing what the LSDA decode produces.

Rebased onto 1cff8ec (#262, cppcallnames, DIV-59) and fully re-measured on that
tree: the C corpus, the C++ probes, the ARM corpus and every catalog counter
reproduce exactly. Both arms of every off/on comparison are the same build, so
#262's C++ callee renaming cancels; the added surviving_names_changed /
NAMED_LOST counters are 0 everywhere, so no entry this option removes was
shadowing a real symbol. phase_catalog.json re-captured and docs/options.md
regenerated from the post-rebase build; no stages XML added, so no corpus count
or stages baseline moves.

Bundle: docs/features/fdeinterior/. Gates: make test 675/675 PARITY OK (no
re-pin, no per-test opt-out), make test-stages 394/394 PARITY OK, make rust-test
green, make check-spec OK (strict), kuna catalog --check OK. Speed: timeit
-29.28% (15 samples); interleaved medians -21.68% to +0.06% (functions) and
-4.22% / -4.89% (decompile-all).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01McQC7imaNfzj5k5AVumSYN
mahaloz added a commit that referenced this pull request Aug 5, 2026
…on, it is a point inside one (-1030 spurious entries, 0 real lost)

A kuna FunctionSymbol is an entry address with no extent: Database::add_function
takes an address and find_function answers "is a function registered AT this
address", never "is this address INSIDE one". Every discovery oracle's dedup is
therefore an equality test, and a candidate 12 bytes into a body passes it.

Three oracles do exactly that on ordinary compiler output, and --mode auto turns
all three on for anything under 500 KiB by resolving to `aggressive`:
eh_frame_full promotes each .gcc_except_table landing pad to a top-level function
(it is designed to), aif starts one at the first undecoded byte of an
unwinder-only region (routinely not an instruction boundary), and the prologue
patterns match an aligned `push rbp; mov rbp,rsp` inside a larger body. On a
g++ -O0 probe, probe_try_catch [0x2acf,0x2ba7) yields sub_2b0b / sub_2b1a /
sub_2b8a, all three surviving stripping, and sub_2b0b decompiles with an
uninitialised rbp so every local is a garbage dereference. IDA Pro 9.2 gives
get_func(0x2b0b).start_ea == 0x2acf; that is the model.

.eh_frame carries the missing extent: each FDE records ONE function's
[pcBegin, pcBegin+pcRange). kuna_fdeinterior.rs reuses scan_eh_frame_starts's
record walk and adds the one field it skips - pcRange, decoded with the CIE R
encoding's format bits only, since it is a length - and the commit filters the
FULLY MERGED entry set, after the deferred Listing consumers, because one
producer is aif.

Not every FDE describes one function: the linker gives the whole PLT a single
FDE and every stub inside it is real (the first prototype deleted every import).
A range is used only when no other named function start, no other FDE pcBegin,
and no .plt/.plt.sec/.plt.got/.iplt/.MIPS.stubs section falls inside it. An entry
AT an FDE start is never suppressed, so oracle 3's own product is preserved.

Gated and default-ON (DIV-60) because the measurement leaves no judgment call.
kuna functions off vs on over 72 stripped decbench x86-64 binaries, every dropped
entry classified against the matching unstripped binary's FUNC symbols (address
and size): 36,568 -> 35,538 entries, 1,030 dropped, 0 added, ZERO that are a real
function's entry, ZERO that carry a name, all 1,030 strictly inside a real body,
52 not even an instruction boundary. C++: big_O0.stripped 599 -> 449 (25% of the
list was junk), probe_O0.stripped 189 -> 162. Static glibc --mode aggressive
1,358 -> 1,087 with 0 real and 0 named lost. PE and ET_REL are inert.
Whole-binary decompile-all on five binaries: 0 functions added, 0 surviving
bodies changed and 0 surviving names changed.

#259 (tailcallentry) non-regression, measured on its own corpus and surface with
--option tailcallentry on: all 98 ARM images, entries 57,578 -> 57,578, zero
images changed - bare-metal ARM unwinds through .ARM.exidx and only 3 of 98
carry any .eh_frame FDE. The same argument covers draft PR #239.

Disclosed interaction: eh_frame_full's landing-pad product is now constrained by
this gate, so verify_eh_frame_full's option-on arm flips fdeinterior off to keep
testing what the LSDA decode produces.

Rebased onto 1cff8ec (#262, cppcallnames, DIV-59) and fully re-measured on that
tree: the C corpus, the C++ probes, the ARM corpus and every catalog counter
reproduce exactly. Both arms of every off/on comparison are the same build, so
#262's C++ callee renaming cancels; the added surviving_names_changed /
NAMED_LOST counters are 0 everywhere, so no entry this option removes was
shadowing a real symbol. phase_catalog.json re-captured and docs/options.md
regenerated from the post-rebase build; no stages XML added, so no corpus count
or stages baseline moves.

Bundle: docs/features/fdeinterior/. Gates: make test 675/675 PARITY OK (no
re-pin, no per-test opt-out), make test-stages 394/394 PARITY OK, make rust-test
green, make check-spec OK (strict), kuna catalog --check OK. Speed: timeit
-29.28% (15 samples); interleaved medians -21.68% to +0.06% (functions) and
-4.22% / -4.89% (decompile-all).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01McQC7imaNfzj5k5AVumSYN
mahaloz added a commit that referenced this pull request Aug 5, 2026
…on, it is a point inside one (-1030 spurious entries, 0 real lost)

A kuna FunctionSymbol is an entry address with no extent: Database::add_function
takes an address and find_function answers "is a function registered AT this
address", never "is this address INSIDE one". Every discovery oracle's dedup is
therefore an equality test, and a candidate 12 bytes into a body passes it.

Three oracles do exactly that on ordinary compiler output, and --mode auto turns
all three on for anything under 500 KiB by resolving to `aggressive`:
eh_frame_full promotes each .gcc_except_table landing pad to a top-level function
(it is designed to), aif starts one at the first undecoded byte of an
unwinder-only region (routinely not an instruction boundary), and the prologue
patterns match an aligned `push rbp; mov rbp,rsp` inside a larger body. On a
g++ -O0 probe, probe_try_catch [0x2acf,0x2ba7) yields sub_2b0b / sub_2b1a /
sub_2b8a, all three surviving stripping, and sub_2b0b decompiles with an
uninitialised rbp so every local is a garbage dereference. IDA Pro 9.2 gives
get_func(0x2b0b).start_ea == 0x2acf; that is the model.

.eh_frame carries the missing extent: each FDE records ONE function's
[pcBegin, pcBegin+pcRange). kuna_fdeinterior.rs reuses scan_eh_frame_starts's
record walk and adds the one field it skips - pcRange, decoded with the CIE R
encoding's format bits only, since it is a length - and the commit filters the
FULLY MERGED entry set, after the deferred Listing consumers, because one
producer is aif.

Not every FDE describes one function: the linker gives the whole PLT a single
FDE and every stub inside it is real (the first prototype deleted every import).
A range is used only when no other named function start, no other FDE pcBegin,
and no .plt/.plt.sec/.plt.got/.iplt/.MIPS.stubs section falls inside it. An entry
AT an FDE start is never suppressed, so oracle 3's own product is preserved.

Gated and default-ON (DIV-61) because the measurement leaves no judgment call.
kuna functions off vs on over 72 stripped decbench x86-64 binaries, every dropped
entry classified against the matching unstripped binary's FUNC symbols (address
and size): 36,568 -> 35,538 entries, 1,030 dropped, 0 added, ZERO that are a real
function's entry, ZERO that carry a name, all 1,030 strictly inside a real body,
52 not even an instruction boundary. C++: big_O0.stripped 599 -> 449 (25% of the
list was junk), probe_O0.stripped 189 -> 162. Static glibc --mode aggressive
1,358 -> 1,087 with 0 real and 0 named lost. PE and ET_REL are inert.
Whole-binary decompile-all on eight binaries: 0 functions added, 0 surviving
bodies changed and 0 surviving names changed.

#259 (tailcallentry) non-regression, measured on its own corpus and surface with
--option tailcallentry on: all 98 ARM images, entries 57,578 -> 57,578, zero
images changed - bare-metal ARM unwinds through .ARM.exidx and only 3 of 98
carry any .eh_frame FDE. The same argument covers draft PR #239.

Disclosed interaction: eh_frame_full's landing-pad product is now constrained by
this gate, so verify_eh_frame_full's option-on arm flips fdeinterior off to keep
testing what the LSDA decode produces.

Rebased onto 890096b (#264 cppproto, DIV-60) on 1cff8ec (#262 cppcallnames,
DIV-59), and fully re-measured on that tree rather than carried forward, because
neither is inert here. #264 recovers out-of-line C++ member and namespace
definitions from DWARF, so an unstripped C++ binary now carries far more named
function symbols - the input to this option's "range holds no other named
function start" condition. The invariant holds against the new symbol set:
big_O0 now has 447 of its 450 surviving entries named (probe_O0 161 of 163) and
the filter still drops 150 with 0 real and 0 named lost, while the stripped
counterparts are unchanged at 449 / 162 (verified, not assumed - no DWARF there).
Both arms of every comparison are the same build, so #262's renaming and #264's
MAX_TYPE_DEPTH change cancel; coreutils fmt, the binary #264 altered, was
decompiled whole in both arms to keep the two unconflated (198 -> 191 entries, 0
surviving bodies changed; fmt-O2 151 -> 151).

Catalog counters were DERIVED from a fresh post-rebase catalog capture, not
incremented: 91 settables, 20 core / 41 transform / 30 analysis, 90 catalog rows.
#264 and this PR had made an identical off-by-one edit to the same three
assertions, so the merge resolution would have shipped the wrong number had it
been trusted. phase_catalog.json re-captured and docs/options.md regenerated from
the post-rebase build; no stages XML added, so no corpus count or stages baseline
moves.

Bundle: docs/features/fdeinterior/. Gates: make test 675/675 PARITY OK (no
re-pin, no per-test opt-out), make test-stages 394/394 PARITY OK, make rust-test
green, make check-spec OK (strict), kuna catalog --check OK. Speed: timeit
-29.28% (15 samples); interleaved medians -21.68% to +0.06% (functions) and
-4.22% / -4.89% (decompile-all).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01McQC7imaNfzj5k5AVumSYN
mahaloz added a commit that referenced this pull request Aug 5, 2026
…on, it is a point inside one (-1030 spurious entries, 0 real lost)

A kuna FunctionSymbol is an entry address with no extent: Database::add_function
takes an address and find_function answers "is a function registered AT this
address", never "is this address INSIDE one". Every discovery oracle's dedup is
therefore an equality test, and a candidate 12 bytes into a body passes it.

Three oracles do exactly that on ordinary compiler output, and --mode auto turns
all three on for anything under 500 KiB by resolving to `aggressive`:
eh_frame_full promotes each .gcc_except_table landing pad to a top-level function
(it is designed to), aif starts one at the first undecoded byte of an
unwinder-only region (routinely not an instruction boundary), and the prologue
patterns match an aligned `push rbp; mov rbp,rsp` inside a larger body. On a
g++ -O0 probe, probe_try_catch [0x2acf,0x2ba7) yields sub_2b0b / sub_2b1a /
sub_2b8a, all three surviving stripping, and sub_2b0b decompiles with an
uninitialised rbp so every local is a garbage dereference. IDA Pro 9.2 gives
get_func(0x2b0b).start_ea == 0x2acf; that is the model.

.eh_frame carries the missing extent: each FDE records ONE function's
[pcBegin, pcBegin+pcRange). kuna_fdeinterior.rs reuses scan_eh_frame_starts's
record walk and adds the one field it skips - pcRange, decoded with the CIE R
encoding's format bits only, since it is a length - and the commit filters the
FULLY MERGED entry set, after the deferred Listing consumers, because one
producer is aif.

Not every FDE describes one function: the linker gives the whole PLT a single
FDE and every stub inside it is real (the first prototype deleted every import).
A range is used only when no other named function start, no other FDE pcBegin,
and no .plt/.plt.sec/.plt.got/.iplt/.MIPS.stubs section falls inside it. An entry
AT an FDE start is never suppressed, so oracle 3's own product is preserved.

Gated and default-ON (DIV-61) because the measurement leaves no judgment call.
kuna functions off vs on over 72 stripped decbench x86-64 binaries, every dropped
entry classified against the matching unstripped binary's FUNC symbols (address
and size): 36,568 -> 35,538 entries, 1,030 dropped, 0 added, ZERO that are a real
function's entry, ZERO that carry a name, all 1,030 strictly inside a real body,
52 not even an instruction boundary. C++: big_O0.stripped 599 -> 449 (25% of the
list was junk), probe_O0.stripped 189 -> 162. Static glibc --mode aggressive
1,358 -> 1,087 with 0 real and 0 named lost. PE and ET_REL are inert.
Whole-binary decompile-all on eight binaries: 0 functions added, 0 surviving
bodies changed and 0 surviving names changed.

#259 (tailcallentry) non-regression, measured on its own corpus and surface with
--option tailcallentry on: all 98 ARM images, entries 57,578 -> 57,578, zero
images changed - bare-metal ARM unwinds through .ARM.exidx and only 3 of 98
carry any .eh_frame FDE. The same argument covers draft PR #239.

Disclosed interaction: eh_frame_full's landing-pad product is now constrained by
this gate, so verify_eh_frame_full's option-on arm flips fdeinterior off to keep
testing what the LSDA decode produces.

Rebased onto 890096b (#264 cppproto, DIV-60) on 1cff8ec (#262 cppcallnames,
DIV-59), and fully re-measured on that tree rather than carried forward, because
neither is inert here. #264 recovers out-of-line C++ member and namespace
definitions from DWARF, so an unstripped C++ binary now carries far more named
function symbols - the input to this option's "range holds no other named
function start" condition. The invariant holds against the new symbol set:
big_O0 now has 447 of its 450 surviving entries named (probe_O0 161 of 163) and
the filter still drops 150 with 0 real and 0 named lost, while the stripped
counterparts are unchanged at 449 / 162 (verified, not assumed - no DWARF there).
Both arms of every comparison are the same build, so #262's renaming and #264's
MAX_TYPE_DEPTH change cancel; coreutils fmt, the binary #264 altered, was
decompiled whole in both arms to keep the two unconflated (198 -> 191 entries, 0
surviving bodies changed; fmt-O2 151 -> 151).

Catalog counters were DERIVED from a fresh post-rebase catalog capture, not
incremented: 91 settables, 20 core / 41 transform / 30 analysis, 90 catalog rows.
#264 and this PR had made an identical off-by-one edit to the same three
assertions, so the merge resolution would have shipped the wrong number had it
been trusted. phase_catalog.json re-captured and docs/options.md regenerated from
the post-rebase build; no stages XML added, so no corpus count or stages baseline
moves.

Bundle: docs/features/fdeinterior/. Gates: make test 675/675 PARITY OK (no
re-pin, no per-test opt-out), make test-stages 394/394 PARITY OK, make rust-test
green, make check-spec OK (strict), kuna catalog --check OK. Speed: timeit
-29.28% (15 samples); interleaved medians -21.68% to +0.06% (functions) and
-4.22% / -4.89% (decompile-all).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01McQC7imaNfzj5k5AVumSYN
mahaloz added a commit that referenced this pull request Aug 5, 2026
…on, it is a point inside one (-1030 spurious entries, 0 real lost) (#263)

A kuna FunctionSymbol is an entry address with no extent: Database::add_function
takes an address and find_function answers "is a function registered AT this
address", never "is this address INSIDE one". Every discovery oracle's dedup is
therefore an equality test, and a candidate 12 bytes into a body passes it.

Three oracles do exactly that on ordinary compiler output, and --mode auto turns
all three on for anything under 500 KiB by resolving to `aggressive`:
eh_frame_full promotes each .gcc_except_table landing pad to a top-level function
(it is designed to), aif starts one at the first undecoded byte of an
unwinder-only region (routinely not an instruction boundary), and the prologue
patterns match an aligned `push rbp; mov rbp,rsp` inside a larger body. On a
g++ -O0 probe, probe_try_catch [0x2acf,0x2ba7) yields sub_2b0b / sub_2b1a /
sub_2b8a, all three surviving stripping, and sub_2b0b decompiles with an
uninitialised rbp so every local is a garbage dereference. IDA Pro 9.2 gives
get_func(0x2b0b).start_ea == 0x2acf; that is the model.

.eh_frame carries the missing extent: each FDE records ONE function's
[pcBegin, pcBegin+pcRange). kuna_fdeinterior.rs reuses scan_eh_frame_starts's
record walk and adds the one field it skips - pcRange, decoded with the CIE R
encoding's format bits only, since it is a length - and the commit filters the
FULLY MERGED entry set, after the deferred Listing consumers, because one
producer is aif.

Not every FDE describes one function: the linker gives the whole PLT a single
FDE and every stub inside it is real (the first prototype deleted every import).
A range is used only when no other named function start, no other FDE pcBegin,
and no .plt/.plt.sec/.plt.got/.iplt/.MIPS.stubs section falls inside it. An entry
AT an FDE start is never suppressed, so oracle 3's own product is preserved.

Gated and default-ON (DIV-61) because the measurement leaves no judgment call.
kuna functions off vs on over 72 stripped decbench x86-64 binaries, every dropped
entry classified against the matching unstripped binary's FUNC symbols (address
and size): 36,568 -> 35,538 entries, 1,030 dropped, 0 added, ZERO that are a real
function's entry, ZERO that carry a name, all 1,030 strictly inside a real body,
52 not even an instruction boundary. C++: big_O0.stripped 599 -> 449 (25% of the
list was junk), probe_O0.stripped 189 -> 162. Static glibc --mode aggressive
1,358 -> 1,087 with 0 real and 0 named lost. PE and ET_REL are inert.
Whole-binary decompile-all on eight binaries: 0 functions added, 0 surviving
bodies changed and 0 surviving names changed.

#259 (tailcallentry) non-regression, measured on its own corpus and surface with
--option tailcallentry on: all 98 ARM images, entries 57,578 -> 57,578, zero
images changed - bare-metal ARM unwinds through .ARM.exidx and only 3 of 98
carry any .eh_frame FDE. The same argument covers draft PR #239.

Disclosed interaction: eh_frame_full's landing-pad product is now constrained by
this gate, so verify_eh_frame_full's option-on arm flips fdeinterior off to keep
testing what the LSDA decode produces.

Rebased onto 890096b (#264 cppproto, DIV-60) on 1cff8ec (#262 cppcallnames,
DIV-59), and fully re-measured on that tree rather than carried forward, because
neither is inert here. #264 recovers out-of-line C++ member and namespace
definitions from DWARF, so an unstripped C++ binary now carries far more named
function symbols - the input to this option's "range holds no other named
function start" condition. The invariant holds against the new symbol set:
big_O0 now has 447 of its 450 surviving entries named (probe_O0 161 of 163) and
the filter still drops 150 with 0 real and 0 named lost, while the stripped
counterparts are unchanged at 449 / 162 (verified, not assumed - no DWARF there).
Both arms of every comparison are the same build, so #262's renaming and #264's
MAX_TYPE_DEPTH change cancel; coreutils fmt, the binary #264 altered, was
decompiled whole in both arms to keep the two unconflated (198 -> 191 entries, 0
surviving bodies changed; fmt-O2 151 -> 151).

Catalog counters were DERIVED from a fresh post-rebase catalog capture, not
incremented: 91 settables, 20 core / 41 transform / 30 analysis, 90 catalog rows.
#264 and this PR had made an identical off-by-one edit to the same three
assertions, so the merge resolution would have shipped the wrong number had it
been trusted. phase_catalog.json re-captured and docs/options.md regenerated from
the post-rebase build; no stages XML added, so no corpus count or stages baseline
moves.

Bundle: docs/features/fdeinterior/. Gates: make test 675/675 PARITY OK (no
re-pin, no per-test opt-out), make test-stages 394/394 PARITY OK, make rust-test
green, make check-spec OK (strict), kuna catalog --check OK. Speed: timeit
-29.28% (15 samples); interleaved medians -21.68% to +0.06% (functions) and
-4.22% / -4.89% (decompile-all).


Claude-Session: https://claude.ai/code/session_01McQC7imaNfzj5k5AVumSYN

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
@mahaloz

mahaloz commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

[AUTOMATED]

Step 5 measured and open: poolentry

step slug PR status result
1 cortexmvectors #248 merged +96 GT (81.4%, 0 lost); betaflight 1 -> 57 functions
2 ptrentry #255 merged recall 92.4% -> 96.3%; +1,613 GT at 95.2%, 0 splits, 0 lost
3 tailcallentry #259 merged +561 GT at 94.6%, 0 splits, 0 lost; Cortex-M 95.9% -> 97.2%
4 TBB/TBH resolution — not started the called class, 297 entries
5 poolentry #278 open +188 GT at 98.4%, 0 lost, 1 split — and 4,220 phantom entries retired, 0 of them GT, 0 real bodies made unreachable

Over 98 stripped ARM images / 48,553 DWARF addresses, baseline = steps 1-3 all ON
= 59,406 entries (measuring against bare aggressive re-banks merged work: betaflight
O0 is 5,798 vs 6,032).

new GT lost splits removed GT removed bodies unreachable
shipped config 191 188 (98.4%) 0 1 4,220 0 0

Cortex-M recall 97.25% -> 97.43%; u-boot A32 58.35% -> 60.65% — the first
thing in this sequence to move u-boot at all (steps 1-3 move it by zero, at 100%
precision and 0 splits here). Share of reported functions that are real DWARF
entries, Cortex-M: 77.1% -> 83.3%. On 20 x86-64 ELFs and 8 i386 PEs: 0 entries
added, 0 removed
. 199/199 betaflight bodies byte-identical off vs on, sampled as
the immediate successors of removed phantoms. make test PARITY OK 675/675,
make test-stages 405/405.

Four corrections this step's predictions needed

1. The split count was a bug in the reference scan, not a property of the
mechanism.
Two independent measurements put the additive half at 8-19 splits, and a
third at 718 with a $d oracle; all three concluded zero splits was unreachable. The
cause: the ARM SLEIGH prints the resolved [0x…] form only for
ldr rN,[pc,#imm]. vldr/ldrd print [pc,#imm] and resolve the target in the
semantic body (ARMneon.sinc:4337-4348, vldrRn). Every pool containing a float or
a 64-bit constant therefore under-ran, and the pass planted an entry on a pool
word
— pidInitFilters' "split" is .word 0x42aa0000 (85.0f), poly4d_eval's is
.word 0x00000000. Seven of the eight "splits" at the previous best config were data
phantoms, not code splits. Completing the literal set: 19 -> 1 split, 89.7% ->
98.4% GT
, and with bridging OFF.

2. "Additive is safe, subtractive cannot be made safe" is half wrong, in both
directions.
Unpaired suppression removes 0 ground-truth entries and destroys
531 real bodies — the bar counts addresses, so it scores that as zero harm.
Pairing (drop a phantom only when its pool end carries a replacement entry) makes the
removal a MOVE, and bodies-destroyed goes 531 -> 0 while still retiring 4,220
phantoms. That restores a wiring-level guarantee to the half that supposedly could
not have one. Conversely the additive half is not free: at every bridged
configuration it destroys bodies through the suppression half it feeds (62 at 1-word
bridging alone, 119 combined). Bridging is off.

3. This step's prize is precision, and the recall number is small. 19 of the
charter's 324 IDA O0 misses; +17 bodies kuna could not previously emit at any
address. 171 of the 188 new ground-truth entries were already being emitted two bytes
early — an address correction, not a recovery. The number worth quoting is the other
one: one in nine functions kuna functions reported on this corpus began inside a
literal pool, and not one was real.
decbench cannot see any of it, which is exactly
why four recall-metric lenses found a precision defect.

4. The $d mapping-symbol oracle systematically over-states the damage. It calls
the whole $d run a pool; reference-driven inference with a complete literal set
calls only referenced words a pool. Same corpus, same images: 73.6% GT / 718 splits
under the oracle, 98.4% / 1 under the implementation. The oracle is the right
instrument for sizing the phantom population (0 of 6,128 are ground truth, which
replicates: 0 of 4,220 here) and the wrong one for predicting a fix.

Two disclosures

  • One split, SCSI_RequestSense + 4 (0x8069c20) on betaflight O2-noinline, one
    image. A literal reference resolves onto the function's own first word, which the
    Listing never decoded. The only guard that removes it costs 108 of 189
    ground-truth entries. Disclosed rather than gated away, the same call step 3 made
    for u-boot's two, and pinned as current behaviour by a fixture shape so a future
    fix has a test to update. The second non-GT entry is crazyflie 0x8006a30, zero
    padding in no DWARF body.
  • Analysis-tier speed is over budget on ARM. Only the A32 figure reproduces
    cleanly across both builds: u-boot O2 +32.4% / +33.3%. betaflight O0 Thumb
    measured +14.3% on the measurement build and +3.5% on the shipping build, and
    x86-64 +1.5% / +9.1% — this box carried two other agents' workspace suites
    throughout (load ~90-100), so those two rows are inside the noise floor and are
    disclosed as a range, not a point. It is net-positive only because the retired
    phantoms stop being decompiled — whole-binary decompile-all on betaflight O0 goes
    262.8 -> 220.7 s, a single shot. An ARM image with pools but no phantoms pays the
    cost with no benefit. Default-OFF.

Where the rest of the gap is

3,255 of 5,491 interior ground-truth misses (59.3%) have a containing entry that IS
a real DWARF entry
— kuna absorbed a real function into its neighbour rather than
inventing one. That is step 4's territory and it is larger than everything steps 1-3
and 5 recovered together. After this step the sequence has not closed ARM entry
recall; it has closed the invented-entry half of it.

One more thing for whoever takes step 4: cortexmvectors, ptrentry,
tailcallentry and poolentry all sit in modes.rs::UNEVALUATED, i.e. unreachable
on every default surface. They compose — every number above is measured on top of
the other three, and 243 of the charter's 322 cases are already exact once ptrentry
is reachable. Preset membership should be one joint evaluation of the four, not four
separate flips.

🤖 Generated with Claude Code

https://claude.ai/code/session_01C8UQbPqALzdUQ3cLLjUeKH

mahaloz added a commit that referenced this pull request Aug 11, 2026
…ool inference, measured against the #239 bar

Refutation scaffolding for the "AIF literal-pool phantom entry" diagnosis, NOT a
shippable option. Everything is behind env gates and default-inert: with no
KUNA_POOL* variable set the entry sets are byte-identical to HEAD (verified on
betaflight O0) and `make test` is PARITY OK 675/675.

  kuna_poolentry.rs   pools = maximal stride-4 runs of word-aligned literal
                      targets, harvested from the Listing AND from the
                      speculatively-decoded bodies of the gap-discovered
                      routines (without the latter the scan cannot see the very
                      pools that produce the phantom).
  KUNA_POOLENTRY      additive half: an entry fact at each pool end.
  KUNA_POOLSUPPRESS   subtractive half: drop an AIF accept inside a pool.
  KUNA_POOL_MERGE_GAP bridge N unreferenced words inside a run (default 0).
  KUNA_POOL_AFTER_RET pool must abut a return-class terminal (additive half).
  KUNA_POOL_PAIRED    suppress only where the pool end has a replacement entry.
  KUNA_POOL_TRACE     dump pools / adds / suppressions.

Measured over 98 ARM images (48,553 DWARF entries), baseline = --mode aggressive
+ cortexmvectors/ptrentry/tailcallentry: the additive half never loses an entry
(0 in every configuration) but splits a real body at every operating point
(104 -> 60 -> 19 -> 8, never 0), and the subtractive half removes 0 ground-truth
entries yet makes 531 real function bodies unreachable unless it is paired to a
replacement entry with no gap bridging, which takes that to 0.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01C8UQbPqALzdUQ3cLLjUeKH
mahaloz added a commit that referenced this pull request Aug 11, 2026
… (98.4% GT, 4,220 phantom entries retired)

Step 5 of the ARM entry-recall sequence ([PROPOSAL] #239), and the first one that is a
PRECISION fix with a recall side-effect rather than the reverse.

`run_aif` slides its gap cursor one byte at a time with no instruction-alignment
filter, because `first_undefined_after` is byte-granular by construction. An ARM
PC-relative literal pool is data, hence an undefined gap, so the cursor probes every
byte of it. On STM32 Thumb the pool words are SRAM addresses 0x2000_xxxx whose HIGH
halfword decodes as `movs r0,#0`, which clears the 2-mnemonic fingerprint gate as
reliably as a real prologue; AIF plants an entry one halfword before the real function
and then jumps the cursor past the body, so the true entry is never probed. In A32 the
whole word decodes and the phantom lands on the word itself. Upstream Ghidra does not
have this: its reference analyzer defines pc-relative literal targets as DATA before
AIF runs.

The pass reconstructs the missing definition from the references that are already
there - every resolved [0x...] operand and every [pc,#imm] literal load, including the
second word of a 64-bit vldr/ldrd - and takes maximal runs of ADJACENT referenced
words as the pools. Completing the [pc,#imm] half is what made this shippable: without
it every pool holding a float or a 64-bit constant under-runs and the additive half
plants its entry ON a pool word, which is the difference between 19 splits at 89.7%
ground truth and 1 at 98.4%. The PC bias is read from the engine's ContextDatabase -
the same TMode the bytes were decoded under - so a language with no TMode disables the
[pc,#imm] form outright.

Two consumers, one option. RECALL: an additive entry fact at the end of a pool that
abuts a return-class terminal, so never-removes-an-entry is a property of the wiring
as in ptrentry and tailcallentry. PRECISION: drop an AIF accept inside an inferred
pool, but ONLY when the pool end carries a replacement entry - unpaired that predicate
removes 0 ground-truth entries and still destroys 531 real bodies, paired it destroys
zero. The pairing makes the removal a MOVE.

Measured on 98 stripped ARM images (48,553 DWARF addresses), baseline = steps 1-3 all
on = 59,406 entries:

  191 new entries, 188 ground truth (98.4%) - the best precision in the sequence
  0 ground-truth entries lost, 1 real body split (disclosed)
  4,220 phantom entries retired, 0 of them ground truth, 4,218 strictly inside a body
  0 real bodies made unreachable, +17 newly reachable
  Cortex-M recall 97.25% -> 97.43%; u-boot A32 58.35% -> 60.65% (the first thing in
  the sequence to move an A32 image at all, at 100% precision and 0 splits)
  share of reported functions that are real DWARF entries 76.4% -> 82.3%

Off-target: 20 x86-64 ELFs (8,171 entries) and 8 i386 PE images (1,405 entries) are
byte-identical - 0 added, 0 removed. 199/199 sampled betaflight bodies byte-identical.

Disclosed: one split, betaflight O2-noinline 0x8069c20, four bytes into
SCSI_RequestSense - a literal reference resolves onto the function's own first word,
which the Listing never decoded. The only guard that removes it costs 108 of 189
recovered entries. Pinned as current behaviour by a fixture shape. The one other
non-ground-truth entry is crazyflie 0x8006a30, zero padding in no DWARF body.
Analysis-tier speed is +14.3% (betaflight O0 Thumb) and +32.4% (u-boot O2 A32), over
the budget and net-positive only because the retired phantoms stop being decompiled
(whole-binary decompile-all on betaflight O0: 262.8 -> 220.7 s, single shot).

Default-OFF, so no DIV row. Parked in modes.rs UNEVALUATED next to its three sequence
siblings, which compose with it: every number above is measured on top of the other
three, so preset membership is one joint evaluation rather than four.

No tests/stages XML is possible - the harness never builds a Listing - so the gate is
the cross-crate two-pass kuna-console/tests/verify_poolentry.rs over a new committed
fixture carrying all three shapes (phantom that MOVES, unpaired phantom that is KEPT,
and the disclosed split), plus an `aif off` inertness pin.

Counts derived from a fresh `phase catalog` capture on a green build: settables 95 ->
96, analysis tier 34 -> 35, catalog JSON rows 95 -> 96, bytecompat fixture 95 -> 96,
the catalog-form comma count 94 -> 95, and PASS_GATES gains poolentry. Gates: make
test PARITY OK 675/675, make test-stages PARITY OK 405/405, make rust-test green, make
check-spec green in strict mode, kuna catalog --check OK.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01C8UQbPqALzdUQ3cLLjUeKH
mahaloz added a commit that referenced this pull request Aug 11, 2026
…ool inference, measured against the #239 bar

Refutation scaffolding for the "AIF literal-pool phantom entry" diagnosis, NOT a
shippable option. Everything is behind env gates and default-inert: with no
KUNA_POOL* variable set the entry sets are byte-identical to HEAD (verified on
betaflight O0) and `make test` is PARITY OK 675/675.

  kuna_poolentry.rs   pools = maximal stride-4 runs of word-aligned literal
                      targets, harvested from the Listing AND from the
                      speculatively-decoded bodies of the gap-discovered
                      routines (without the latter the scan cannot see the very
                      pools that produce the phantom).
  KUNA_POOLENTRY      additive half: an entry fact at each pool end.
  KUNA_POOLSUPPRESS   subtractive half: drop an AIF accept inside a pool.
  KUNA_POOL_MERGE_GAP bridge N unreferenced words inside a run (default 0).
  KUNA_POOL_AFTER_RET pool must abut a return-class terminal (additive half).
  KUNA_POOL_PAIRED    suppress only where the pool end has a replacement entry.
  KUNA_POOL_TRACE     dump pools / adds / suppressions.

Measured over 98 ARM images (48,553 DWARF entries), baseline = --mode aggressive
+ cortexmvectors/ptrentry/tailcallentry: the additive half never loses an entry
(0 in every configuration) but splits a real body at every operating point
(104 -> 60 -> 19 -> 8, never 0), and the subtractive half removes 0 ground-truth
entries yet makes 531 real function bodies unreachable unless it is paired to a
replacement entry with no gap bridging, which takes that to 0.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01C8UQbPqALzdUQ3cLLjUeKH
mahaloz added a commit that referenced this pull request Aug 11, 2026
… (98.4% GT, 4,220 phantom entries retired)

Step 5 of the ARM entry-recall sequence ([PROPOSAL] #239), and the first one that is a
PRECISION fix with a recall side-effect rather than the reverse.

`run_aif` slides its gap cursor one byte at a time with no instruction-alignment
filter, because `first_undefined_after` is byte-granular by construction. An ARM
PC-relative literal pool is data, hence an undefined gap, so the cursor probes every
byte of it. On STM32 Thumb the pool words are SRAM addresses 0x2000_xxxx whose HIGH
halfword decodes as `movs r0,#0`, which clears the 2-mnemonic fingerprint gate as
reliably as a real prologue; AIF plants an entry one halfword before the real function
and then jumps the cursor past the body, so the true entry is never probed. In A32 the
whole word decodes and the phantom lands on the word itself. Upstream Ghidra does not
have this: its reference analyzer defines pc-relative literal targets as DATA before
AIF runs.

The pass reconstructs the missing definition from the references that are already
there - every resolved [0x...] operand and every [pc,#imm] literal load, including the
second word of a 64-bit vldr/ldrd - and takes maximal runs of ADJACENT referenced
words as the pools. Completing the [pc,#imm] half is what made this shippable: without
it every pool holding a float or a 64-bit constant under-runs and the additive half
plants its entry ON a pool word, which is the difference between 19 splits at 89.7%
ground truth and 1 at 98.4%. The PC bias is read from the engine's ContextDatabase -
the same TMode the bytes were decoded under - so a language with no TMode disables the
[pc,#imm] form outright.

Two consumers, one option. RECALL: an additive entry fact at the end of a pool that
abuts a return-class terminal, so never-removes-an-entry is a property of the wiring
as in ptrentry and tailcallentry. PRECISION: drop an AIF accept inside an inferred
pool, but ONLY when the pool end carries a replacement entry - unpaired that predicate
removes 0 ground-truth entries and still destroys 531 real bodies, paired it destroys
zero. The pairing makes the removal a MOVE.

Measured on 98 stripped ARM images (48,553 DWARF addresses), baseline = steps 1-3 all
on = 59,406 entries:

  191 new entries, 188 ground truth (98.4%) - the best precision in the sequence
  0 ground-truth entries lost, 1 real body split (disclosed)
  4,220 phantom entries retired, 0 of them ground truth, 4,218 strictly inside a body
  0 real bodies made unreachable, +17 newly reachable
  Cortex-M recall 97.25% -> 97.43%; u-boot A32 58.35% -> 60.65% (the first thing in
  the sequence to move an A32 image at all, at 100% precision and 0 splits)
  share of reported functions that are real DWARF entries 76.4% -> 82.3%

Off-target: 20 x86-64 ELFs (8,171 entries) and 8 i386 PE images (1,405 entries) are
byte-identical - 0 added, 0 removed. 199/199 sampled betaflight bodies byte-identical.

Disclosed: one split, betaflight O2-noinline 0x8069c20, four bytes into
SCSI_RequestSense - a literal reference resolves onto the function's own first word,
which the Listing never decoded. The only guard that removes it costs 108 of 189
recovered entries. Pinned as current behaviour by a fixture shape. The one other
non-ground-truth entry is crazyflie 0x8006a30, zero padding in no DWARF body.
Analysis-tier speed is +14.3% (betaflight O0 Thumb) and +32.4% (u-boot O2 A32), over
the budget and net-positive only because the retired phantoms stop being decompiled
(whole-binary decompile-all on betaflight O0: 262.8 -> 220.7 s, single shot).

Default-OFF, so no DIV row. Parked in modes.rs UNEVALUATED next to its three sequence
siblings, which compose with it: every number above is measured on top of the other
three, so preset membership is one joint evaluation rather than four.

No tests/stages XML is possible - the harness never builds a Listing - so the gate is
the cross-crate two-pass kuna-console/tests/verify_poolentry.rs over a new committed
fixture carrying all three shapes (phantom that MOVES, unpaired phantom that is KEPT,
and the disclosed split), plus an `aif off` inertness pin.

Counts derived from a fresh `phase catalog` capture on a green build: settables 95 ->
96, analysis tier 34 -> 35, catalog JSON rows 95 -> 96, bytecompat fixture 95 -> 96,
the catalog-form comma count 94 -> 95, and PASS_GATES gains poolentry. Gates: make
test PARITY OK 675/675, make test-stages PARITY OK 405/405, make rust-test green, make
check-spec green in strict mode, kuna catalog --check OK.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01C8UQbPqALzdUQ3cLLjUeKH
mahaloz added a commit that referenced this pull request Aug 11, 2026
… (98.4% GT, 4,220 phantom entries retired) (#278)

* [AUTOMATED] measure(armentry): poolentry - reference-driven literal-pool inference, measured against the #239 bar

Refutation scaffolding for the "AIF literal-pool phantom entry" diagnosis, NOT a
shippable option. Everything is behind env gates and default-inert: with no
KUNA_POOL* variable set the entry sets are byte-identical to HEAD (verified on
betaflight O0) and `make test` is PARITY OK 675/675.

  kuna_poolentry.rs   pools = maximal stride-4 runs of word-aligned literal
                      targets, harvested from the Listing AND from the
                      speculatively-decoded bodies of the gap-discovered
                      routines (without the latter the scan cannot see the very
                      pools that produce the phantom).
  KUNA_POOLENTRY      additive half: an entry fact at each pool end.
  KUNA_POOLSUPPRESS   subtractive half: drop an AIF accept inside a pool.
  KUNA_POOL_MERGE_GAP bridge N unreferenced words inside a run (default 0).
  KUNA_POOL_AFTER_RET pool must abut a return-class terminal (additive half).
  KUNA_POOL_PAIRED    suppress only where the pool end has a replacement entry.
  KUNA_POOL_TRACE     dump pools / adds / suppressions.

Measured over 98 ARM images (48,553 DWARF entries), baseline = --mode aggressive
+ cortexmvectors/ptrentry/tailcallentry: the additive half never loses an entry
(0 in every configuration) but splits a real body at every operating point
(104 -> 60 -> 19 -> 8, never 0), and the subtractive half removes 0 ground-truth
entries yet makes 531 real function bodies unreachable unless it is paired to a
replacement entry with no gap bridging, which takes that to 0.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01C8UQbPqALzdUQ3cLLjUeKH

* [AUTOMATED] measure(armentry): poolentry - complete the literal-reference set ([pc,#imm] + 64-bit two-word literals)

The reference-driven pool scan only read the resolved `[0x..]` display form, which
the ARM SLEIGH prints for `ldr rN,[pc,#imm]` but NOT for `vldr`/`ldrd` (ARMneon.sinc
`vldrRn` resolves the target in the semantic body). Float/64-bit literal words were
therefore invisible, every pool holding one under-ran, and the additive half planted
an entry ON a pool word. Completing the set takes the additive arm from 19 splits
(no bridging) / 8 (1-word bridging) to 1, at 98.4% ground truth, with bridging OFF -
and bridging is what destroyed 62 reachable bodies in the suppression half.

Measurement shim only: the Thumb/A32 PC bias is derived from the presence of 16-bit
instructions. Production must read the TMode context the entry tier paints.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01C8UQbPqALzdUQ3cLLjUeKH

* [AUTOMATED] feat(p1): poolentry - the ARM literal pool AIF never sees (98.4% GT, 4,220 phantom entries retired)

Step 5 of the ARM entry-recall sequence ([PROPOSAL] #239), and the first one that is a
PRECISION fix with a recall side-effect rather than the reverse.

`run_aif` slides its gap cursor one byte at a time with no instruction-alignment
filter, because `first_undefined_after` is byte-granular by construction. An ARM
PC-relative literal pool is data, hence an undefined gap, so the cursor probes every
byte of it. On STM32 Thumb the pool words are SRAM addresses 0x2000_xxxx whose HIGH
halfword decodes as `movs r0,#0`, which clears the 2-mnemonic fingerprint gate as
reliably as a real prologue; AIF plants an entry one halfword before the real function
and then jumps the cursor past the body, so the true entry is never probed. In A32 the
whole word decodes and the phantom lands on the word itself. Upstream Ghidra does not
have this: its reference analyzer defines pc-relative literal targets as DATA before
AIF runs.

The pass reconstructs the missing definition from the references that are already
there - every resolved [0x...] operand and every [pc,#imm] literal load, including the
second word of a 64-bit vldr/ldrd - and takes maximal runs of ADJACENT referenced
words as the pools. Completing the [pc,#imm] half is what made this shippable: without
it every pool holding a float or a 64-bit constant under-runs and the additive half
plants its entry ON a pool word, which is the difference between 19 splits at 89.7%
ground truth and 1 at 98.4%. The PC bias is read from the engine's ContextDatabase -
the same TMode the bytes were decoded under - so a language with no TMode disables the
[pc,#imm] form outright.

Two consumers, one option. RECALL: an additive entry fact at the end of a pool that
abuts a return-class terminal, so never-removes-an-entry is a property of the wiring
as in ptrentry and tailcallentry. PRECISION: drop an AIF accept inside an inferred
pool, but ONLY when the pool end carries a replacement entry - unpaired that predicate
removes 0 ground-truth entries and still destroys 531 real bodies, paired it destroys
zero. The pairing makes the removal a MOVE.

Measured on 98 stripped ARM images (48,553 DWARF addresses), baseline = steps 1-3 all
on = 59,406 entries:

  191 new entries, 188 ground truth (98.4%) - the best precision in the sequence
  0 ground-truth entries lost, 1 real body split (disclosed)
  4,220 phantom entries retired, 0 of them ground truth, 4,218 strictly inside a body
  0 real bodies made unreachable, +17 newly reachable
  Cortex-M recall 97.25% -> 97.43%; u-boot A32 58.35% -> 60.65% (the first thing in
  the sequence to move an A32 image at all, at 100% precision and 0 splits)
  share of reported functions that are real DWARF entries 76.4% -> 82.3%

Off-target: 20 x86-64 ELFs (8,171 entries) and 8 i386 PE images (1,405 entries) are
byte-identical - 0 added, 0 removed. 199/199 sampled betaflight bodies byte-identical.

Disclosed: one split, betaflight O2-noinline 0x8069c20, four bytes into
SCSI_RequestSense - a literal reference resolves onto the function's own first word,
which the Listing never decoded. The only guard that removes it costs 108 of 189
recovered entries. Pinned as current behaviour by a fixture shape. The one other
non-ground-truth entry is crazyflie 0x8006a30, zero padding in no DWARF body.
Analysis-tier speed is +14.3% (betaflight O0 Thumb) and +32.4% (u-boot O2 A32), over
the budget and net-positive only because the retired phantoms stop being decompiled
(whole-binary decompile-all on betaflight O0: 262.8 -> 220.7 s, single shot).

Default-OFF, so no DIV row. Parked in modes.rs UNEVALUATED next to its three sequence
siblings, which compose with it: every number above is measured on top of the other
three, so preset membership is one joint evaluation rather than four.

No tests/stages XML is possible - the harness never builds a Listing - so the gate is
the cross-crate two-pass kuna-console/tests/verify_poolentry.rs over a new committed
fixture carrying all three shapes (phantom that MOVES, unpaired phantom that is KEPT,
and the disclosed split), plus an `aif off` inertness pin.

Counts derived from a fresh `phase catalog` capture on a green build: settables 95 ->
96, analysis tier 34 -> 35, catalog JSON rows 95 -> 96, bytecompat fixture 95 -> 96,
the catalog-form comma count 94 -> 95, and PASS_GATES gains poolentry. Gates: make
test PARITY OK 675/675, make test-stages PARITY OK 405/405, make rust-test green, make
check-spec green in strict mode, kuna catalog --check OK.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01C8UQbPqALzdUQ3cLLjUeKH

* [AUTOMATED] docs(poolentry): record the shipping-build speed re-run and the final gate numbers

The analysis-tier speed table now carries both runs - the env-gated measurement build
and a re-run on the shipping build - with the contention disclosed. Only the A32 row
(+33%) reproduces cleanly; the Thumb and x86-64 rows are inside this box's current
noise floor (two other agents' workspace suites were running throughout), so the
betaflight figure is stated as a range rather than a point estimate.

Also records the two hard-coded count sites beyond the planned list that a green run
surfaced, and the production-vs-measurement delta (removals 4,238 -> 4,220).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01C8UQbPqALzdUQ3cLLjUeKH

* [AUTOMATED] docs(poolentry): re-derive the shared counters after the funcboundflow rebase

Rebased onto 11f40f4 (funcboundflow, #280, DIV-67), which registered a kuna
option of its own. Both sides of the rebase had made the SAME textual 95 -> 96
edit at four counter sites, so git auto-merged them silently to 96 with no
conflict shown -- the correct post-rebase value is 97. Every shared counter was
re-derived from a live catalog on a green build rather than carried over:

  settables                 96 -> 97   (counted from `kuna catalog --json`)
  tier split                (20 core, 42 transform, 35 analysis)
  bytecompat fixture        96 -> 97   (recaptured via the decomp_dbg recipe;
                                        byte-identical to the merge result)
  catalog trailing commas   95 -> 96
  xml.rs corpus count       194        (funcboundflow's; poolentry adds no XML)
  docs/options.md           regenerated, identical to the merge result
  docs/baseline-stages.json unchanged (407/407 PARITY OK against main's)

Feature re-verified on the rebased tree rather than assumed: funcboundflow
changes function boundaries, so the entry-set it produces was compared on and
off across four arms on three Cortex-M images -- IDENTICAL in every arm, and
betaflight O0 reproduces the recorded per-image delta exactly (+15 / -786).
No measured figure moved.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01C8UQbPqALzdUQ3cLLjUeKH

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
mahaloz added a commit that referenced this pull request Aug 27, 2026
… preset (DIV-90)

cortexmvectors (#248), ptrentry (#255), tailcallentry (#259) and poolentry (#278)
all shipped default-OFF and sat on the UNEVALUATED list in modes.rs, so they were
absent from AGGRESSIVE_OVERRIDES. `auto` resolves to `aggressive` under 500 KiB,
and the preset is what the whole-binary surfaces actually run, so all four were
INERT on every default path -- the DIV-64 itaniumrtti trap, four times over. The
default path's stripped-ARM entry recall had not moved since they merged.

They are flipped jointly because they compose, which is exactly what the
UNEVALUATED comment demanded before any flip.

Measured over the 110 stripped non-x86-64 decbench twins against their unstripped
twins' symbol tables (50,724 ground-truth function starts), --mode aggressive:

  arm       entries   exact   midbody   recall     added  added_exact  lost_exact
  base        55006   44957      8333   88.63%         -            -           -
  cortexm     55142   45093      8333   88.90%       136          136           0
  ptr         56594   46522      8333   91.72%      1588         1565           0
  tail        55655   45602      8337   89.90%       649          645           0
  pool        53956   45122      7116   88.96%       167          165           0
  all4        56188   47330      7117   93.31%      2402         2373           0

Recall and precision improve together: +2,373 real entries (98.8% of everything
added is a real function start) while mid-body false entries FALL 8,333 -> 7,117.
No ground-truth entry is lost by any arm -- poolentry's 1,217 removals contain
zero ground-truth addresses. 0 of 110 binaries lose recall.

Restricted to the 105 binaries `auto` actually sends to `aggressive` (< 500 KiB),
the default-path number is 90.92% -> 96.06%. The 5 images at/over the threshold
resolve to `reliable` and are disclosed in the DIV row rather than papered over.

Non-ARM inertness is measured: identical entry sets over 90 x86-64 twins and the
12 i386 PE images in the ARM corpus, byte-identical emitted C over 8 x86-64
binaries. Speed, interleaved min-of-4: decompile-all cf2.elf -5.8% (a speedup),
nuttx +3.5%, x86-64 controls at noise; discovery-only `kuna functions` +6.2%,
which is more work for more output on the one surface that only does discovery.

The 0/675 ablation is proven, not asserted: a throwaway build with all four forced
ON as engine defaults -- strictly stronger than preset membership, which the XML
harness never applies -- still reports 675/675 and 538/538 PARITY OK.

Also lands PR #239's two doc corrections, repointed at the shipped feature docs
rather than at its unshipped-proposal directory: the recall-measurement.md
mechanism/noise correction and the missing-ghidra-analyses.md
OperandReferenceAnalyzer row (its "function creation is subsumed by entry-disc"
claim is what ptrentry disproved).

[AUTOMATED] Generated by Claude Code.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011KpG7qK6BDFZyPnyo4r1c1
mahaloz added a commit that referenced this pull request Aug 27, 2026
…e aggressive preset (DIV-93) (#345)

* feat(modes): the four ARM entry-discovery options join the aggressive preset (DIV-90)

cortexmvectors (#248), ptrentry (#255), tailcallentry (#259) and poolentry (#278)
all shipped default-OFF and sat on the UNEVALUATED list in modes.rs, so they were
absent from AGGRESSIVE_OVERRIDES. `auto` resolves to `aggressive` under 500 KiB,
and the preset is what the whole-binary surfaces actually run, so all four were
INERT on every default path -- the DIV-64 itaniumrtti trap, four times over. The
default path's stripped-ARM entry recall had not moved since they merged.

They are flipped jointly because they compose, which is exactly what the
UNEVALUATED comment demanded before any flip.

Measured over the 110 stripped non-x86-64 decbench twins against their unstripped
twins' symbol tables (50,724 ground-truth function starts), --mode aggressive:

  arm       entries   exact   midbody   recall     added  added_exact  lost_exact
  base        55006   44957      8333   88.63%         -            -           -
  cortexm     55142   45093      8333   88.90%       136          136           0
  ptr         56594   46522      8333   91.72%      1588         1565           0
  tail        55655   45602      8337   89.90%       649          645           0
  pool        53956   45122      7116   88.96%       167          165           0
  all4        56188   47330      7117   93.31%      2402         2373           0

Recall and precision improve together: +2,373 real entries (98.8% of everything
added is a real function start) while mid-body false entries FALL 8,333 -> 7,117.
No ground-truth entry is lost by any arm -- poolentry's 1,217 removals contain
zero ground-truth addresses. 0 of 110 binaries lose recall.

Restricted to the 105 binaries `auto` actually sends to `aggressive` (< 500 KiB),
the default-path number is 90.92% -> 96.06%. The 5 images at/over the threshold
resolve to `reliable` and are disclosed in the DIV row rather than papered over.

Non-ARM inertness is measured: identical entry sets over 90 x86-64 twins and the
12 i386 PE images in the ARM corpus, byte-identical emitted C over 8 x86-64
binaries. Speed, interleaved min-of-4: decompile-all cf2.elf -5.8% (a speedup),
nuttx +3.5%, x86-64 controls at noise; discovery-only `kuna functions` +6.2%,
which is more work for more output on the one surface that only does discovery.

The 0/675 ablation is proven, not asserted: a throwaway build with all four forced
ON as engine defaults -- strictly stronger than preset membership, which the XML
harness never applies -- still reports 675/675 and 538/538 PARITY OK.

Also lands PR #239's two doc corrections, repointed at the shipped feature docs
rather than at its unshipped-proposal directory: the recall-measurement.md
mechanism/noise correction and the missing-ghidra-analyses.md
OperandReferenceAnalyzer row (its "function creation is subsumed by entry-disc"
claim is what ptrentry disproved).

[AUTOMATED] Generated by Claude Code.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011KpG7qK6BDFZyPnyo4r1c1

* docs(decbench): retire the two round-ledger claims DIV-90 falsifies

features-round4.md Rank 6 was a filed, still-open recommendation to flip
`tailcallentry` into the preset ("aggressive does not carry it"); DIV-90 does
exactly that, so it is marked SHIPPED with the sweep it asked for. features.md
still called step 3 "in flight" and did not know about step 5 (`poolentry`, #278).

[AUTOMATED] Generated by Claude Code.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011KpG7qK6BDFZyPnyo4r1c1

* docs: state the ARM restriction precisely -- poolentry has no arch gate

cortexmvectors/ptrentry/tailcallentry each early-return on
`object::Architecture::Arm`; poolentry does not, and is ARM-only in EFFECT
because it keys on PC-relative literal pools. The measured inertness is the same
either way (identical entry sets on 90 x86-64 twins and 12 i386 PE images), but
"all four are ARM-gated" overstated the mechanism for one of them.

[AUTOMATED] Generated by Claude Code.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011KpG7qK6BDFZyPnyo4r1c1

* docs(history): add the leave-one-out direction to the DIV-90 evidence

Dropping each option from the combination loses 27 / 1427 / 645 / 136 ground-truth
entries respectively, and dropping poolentry is the only one that also raises
mid-body false entries (7117 -> 8337). No option is redundant given the others.

[AUTOMATED] Generated by Claude Code.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011KpG7qK6BDFZyPnyo4r1c1

* docs: renumber the ARM-preset divergence to DIV-93

[AUTOMATED] DIV-90/91/92 were claimed by #341/#342/#344 while this branch was
in flight; the row and every reference move to DIV-93.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011KpG7qK6BDFZyPnyo4r1c1

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
@mahaloz mahaloz closed this Aug 27, 2026
@mahaloz

mahaloz commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

[AUTOMATED] Closing as superseded: three of this proposal's four steps shipped, and the fourth needs re-scoping from scratch.

step state
1. cortexmvectors shipped — #248
2. ptrentry shipped — #255 (+1,613 entries, 95.2% ground truth)
3. tailcallentry shipped — #259 (+561 entries, 94.6%)
— (unplanned) poolentry shipped — #278
4. Listing-tier TBB/TBH resolution not started, still a real gap

The doc bundle here argues throughout that the fixes are unshipped, which is now false, so it is not merge-able as written; the shipped analyses live in docs/features/{cortexmvectors,ptrentry,tailcallentry,poolentry}/. This proposal's two genuine doc corrections — the mechanism/noise paragraph in docs/decbench/recall-measurement.md and the missing-ghidra-analyses.md §6 OperandReferenceAnalyzer row — were cherry-picked onto main in #345, repointed at docs/features/ptrentry/analysis.md.

Scouting this proposal turned up something worth more than its remaining step, which shipped as #345 (DIV-93): all four of those options were default-OFF and on the UNEVALUATED list in modes.rs, so they were absent from AGGRESSIVE_OVERRIDES and therefore inert on every default path (auto resolves to aggressive under 500 KiB). Measured over the 110 stripped non-x86-64 decbench twins, flipping them into the preset moves entry recall 88.63% → 93.31% (+2,373 ground-truth functions) while mid-body false entries fall 8,333 → 7,117, with zero ground-truth entries lost.

Step 4 (TBB/TBH) should be filed fresh against today's code if it is still wanted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant