Repository navigation
[AUTOMATED] feat(p1): poolentry - the ARM literal pool AIF never sees (98.4% GT, 4,220 phantom entries retired) - #278
Merged
Merged
Conversation
This was referenced Aug 11, 2026
Closed
mahaloz
force-pushed
the
feat/armentryoffset
branch
from
August 11, 2026 19:04
ced6190 to
c34c739
Compare
This was referenced 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
…ence 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
… (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
…nd 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
…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
mahaloz
force-pushed
the
feat/armentryoffset
branch
from
August 11, 2026 21:46
c34c739 to
c699f9d
Compare
mahaloz
added a commit
that referenced
this pull request
Aug 11, 2026
…try rebase The rebase onto #278 (poolentry) landed guardarm's three GUARDARM assertions and the KUNA-CATALOG #7 rename on top of main's BRANCHFLIP-ARMSWAP six, so the hand-merged data_footer was stale. Re-recorded from a live run rather than hand-merged: 413 -> 416, +3 GUARDARM keys and the #7 text update, nothing removed. Every shared counter was likewise re-derived from the BUILT artifact rather than by arithmetic, which caught two the rebase auto-merged at the wrong value with no conflict marker: catalog_bytecompat.rs (97, must be 98) and xml.rs's corpus file count (195, must be 196). 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
…by code layout (+297 GED-perfect / 32,339 O0 functions) (#281) * [AUTOMATED] feat(p8): guardarm - break the ruleBlockIfNoExit arm TIE by code layout, not by out-index (+297 GED-perfect over 32,339 O0 functions) `CollapseStructure::rule_block_if_no_exit` folds the condition block and ONE terminal out-arm into a `BlockIf`; the other arm survives as the fall-through. Upstream walks the out-edges in index order. Usually only one arm is eligible and there is no choice -- but when the condition guards a fatal no-return call and the other side is the function's own `return`, BOTH arms are eligible and index order decides a coin flip. A `KUNA_RS_DEBUG` decision trace added to the rule (also in this commit) shows the mechanism: `negateCondition`'s `swapEdges` re-orients the block between the two `collapse_all` runs the action pool performs, so the arm at out(0) in the deciding run is not the arm the branch was assembled with. `dpkg-query control_list` has both outcomes in ONE function -- its two guards are the same shape and the halt lands on out(0) for one and out(1) for the other, so one comes out flat and the other inverted. `option guardarm on` (default-off opt-in) resolves the tie by code layout: of the two eligible arms, the one whose front leaf lies earlier in the address space becomes the clause, because an unoptimized compiler emits the taken clause of `if (c) A; B;` in front of `B`. Ties only; a single eligible arm is byte-identical to upstream. The predicate deliberately does NOT read the `op_mark_halt` no-return bit. Preferring the no-return arm fixes `scp xcalloc` and `control_list` but inverts `make-prime-list xalloc`, whose source really is `if (p) return p; ...; exit(1);` Layout order gets all three right; `tail xlseek` and `xalloc` are byte-identical with the option on. Measured bidirectionally over the whole decbench O0 slice (32,339 scored functions, 265 slices): 6,821 bodies change, GED 230,291 -> 227,646 (-2,645), perfect 14,785 -> 15,082 (+297), 316 moved to perfect against 19 moved off (16.6:1, McNemar z = +16.2). All 6,821 changed bodies audited: identical callee and string multisets, gotos 1,021 -> 1,019, labels 620 -> 619, `while( true )` and `// no-return` counts unchanged. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01C8UQbPqALzdUQ3cLLjUeKH * [AUTOMATED] chore(p0): re-record the stages baseline after the poolentry rebase The rebase onto #278 (poolentry) landed guardarm's three GUARDARM assertions and the KUNA-CATALOG #7 rename on top of main's BRANCHFLIP-ARMSWAP six, so the hand-merged data_footer was stale. Re-recorded from a live run rather than hand-merged: 413 -> 416, +3 GUARDARM keys and the #7 text update, nothing removed. Every shared counter was likewise re-derived from the BUILT artifact rather than by arithmetic, which caught two the rebase auto-merged at the wrong value with no conflict marker: catalog_bytecompat.rs (97, must be 98) and xml.rs's corpus file count (195, must be 196). 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 11, 2026
…e stages baseline Rebased onto #278/#281/#283. Every shared counter re-derived from the BUILT artifact rather than by arithmetic: live catalog 100, phases.toml 100, catalog_bytecompat.rs 100, kuna_phases/tests.rs 100 / tiers (21, 44, 35) / `},\n` 99, phase_catalog.json 100 (recaptured), docs/options.md 100 (regenerated), xml.rs corpus 198. `kuna-catalog.xml` structure-recovery stays 25 because calloverlap is a correctness-fix, not a structure-recovery row. Stages baseline re-recorded on the merged base: 419 -> 425, +6 CALLOVERLAP keys, none removed. 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
…call-overlap guards (GH-275) (#284) * [AUTOMATED] fix(p3): calloverlap - complete the two stubbed upstream call-overlap guards (GH-275) Squashed from the branch's four commits (the fix, the two catalog-count bumps, the flip-guidance prose and the post-funcboundflow reconciliation) so the merge train replays one commit instead of four rounds of the same shared-counter edit. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01C8UQbPqALzdUQ3cLLjUeKH * [AUTOMATED] chore(p0): re-derive the shared counters and re-record the stages baseline Rebased onto #278/#281/#283. Every shared counter re-derived from the BUILT artifact rather than by arithmetic: live catalog 100, phases.toml 100, catalog_bytecompat.rs 100, kuna_phases/tests.rs 100 / tiers (21, 44, 35) / `},\n` 99, phase_catalog.json 100 (recaptured), docs/options.md 100 (regenerated), xml.rs corpus 198. `kuna-catalog.xml` structure-recovery stays 25 because calloverlap is a correctness-fix, not a structure-recovery row. Stages baseline re-recorded on the merged base: 419 -> 425, +6 CALLOVERLAP keys, none removed. 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 11, 2026
…e stages baseline Rebased onto #278/#281/#283/#284. Every shared counter re-derived from the BUILT artifact rather than by arithmetic: live catalog 101, phases.toml 101, catalog_bytecompat.rs 101, kuna_phases/tests.rs 101 / tiers (21, 45, 35) / `},\n` 100, phase_catalog.json 101 (recaptured), docs/options.md 101 (regenerated), xml.rs corpus 199, kuna-catalog.xml structure-recovery 26. Stages baseline re-recorded on the merged base: 425 -> 433, +8 orchain keys and the #7 text update, nothing removed. DIV-69 re-checked against origin/main immediately before pushing: main's highest row is DIV-68 (#277), so 69 stands unrenumbered. 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
…chain of a short-circuit (DIV-69) (#285) * [AUTOMATED] feat(p8): orchain - returndup must not split the operand chain of a short-circuit (DIV-69) DIV-54 flipped `returndup` on evidence from two of the three optimisation levels. Extended to all three (795 slices / 85,195 scored functions) the pass is +640 GED-perfect corpus-wide but -192 at -O0, and one sub-shape carries essentially all of that harm and almost none of the optimized benefit: the split that permanently blocks `CollapseStructure::rule_block_or`. `returndup` gives every predecessor of a shared bare-epilogue RETURN its own private return. For a guard clause that recovers the source; but the operand blocks of a short-circuit expression are predecessors of that same block, and the shared out-target IS ruleBlockOr's entire precondition. ActionReturnDup runs in fullloop's `returnsplit` group and collapse_conditions runs later, so the fold is lost for good and one source `return a || (b && (c || d));` prints as a five-return constant-guard cascade (iproute2 ip::sci_complete, GED 21 against 0). New option `orchain on|off` (default ON, DIV-69, ELEM 4122). `kuna_orchain.rs (shortcircuit_shared_targets)` replays collapse_conditions read-only on the bblocks CFG, mirroring ruleBlockOr's own admission test rather than approximating it (one in-edge, two out-edges, not a switch, not BlockBasic::isComplex, a shared out-target, sibling's other target is not the head), and `returndup_apply` declines the whole function's splits when one of its own candidates is a recorded target. It also protects a block joining two or more single-exit arms that are themselves fold targets, because the first returndup invocation of the fullloop still sees the constant-materialisation blocks in between. Sweep over the same corpus (base = shipped defaults at merge-base 82dd39a): O0 +611 GED-perfect / -2,816 GED, O2 -13 / +1,232, O2-noinline -15 / +617 -- +583 net and -967 aggregate, 781 functions to perfect against 198 off (3.94 : 1). That is 92% of the +630 the post-hoc "a short-circuit was lost" signal prices as a ceiling, at a smaller optimized-level cost than the ceiling itself (-28 vs -35). Predicate fidelity to that signal: 2,933 of 2,951 O0 positives recognised (99.4% recall) at 126 further firings (95.9% precision); 94.2% of firings reproduce the `option returndup off` body byte for byte. Default-ON rather than an `aggressive` preset member because `returndup` is a shipped default in every mode and 45% of the corpus (38,216 of 85,195 functions, 36 of 795 slices) is over the 500 KiB `auto` threshold and runs `reliable`, where a preset-only gate never runs -- measured: with the gate in the preset only, the no-option arm reproduced the ungated body on iproute2 ip (76 functions), bash (366), sshd (201). 675/675 PARITY OK with the raw flip, zero assertion movement and no per-test opt-out; stages 415/415 with the new two-pass tests/stages/ghdec-orchain.xml; rust-test 4,540 passed / 0 failed; check-spec OK lenient + strict; catalog --check OK. Speed worst +1.01% (two of four probes are net speedups). Rebased onto #280 (funcboundflow, DIV-67): every shared counter re-derived from the built artifact on the rebased tree (97 settables, tiers 20/43/34, xml corpus 195), and DIV-68 was renumbered to 69 after Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01C8UQbPqALzdUQ3cLLjUeKH * [AUTOMATED] chore(p0): re-derive the shared counters and re-record the stages baseline Rebased onto #278/#281/#283/#284. Every shared counter re-derived from the BUILT artifact rather than by arithmetic: live catalog 101, phases.toml 101, catalog_bytecompat.rs 101, kuna_phases/tests.rs 101 / tiers (21, 45, 35) / `},\n` 100, phase_catalog.json 101 (recaptured), docs/options.md 101 (regenerated), xml.rs corpus 199, kuna-catalog.xml structure-recovery 26. Stages baseline re-recorded on the merged base: 425 -> 433, +8 orchain keys and the #7 text update, nothing removed. DIV-69 re-checked against origin/main immediately before pushing: main's highest row is DIV-68 (#277), so 69 stands unrenumbered. 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
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
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
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
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 5 of the ARM entry-recall sequence ([PROPOSAL] #239), after
cortexmvectors(#248),
ptrentry(#255) andtailcallentry(#259). Unlike its three predecessorsthis one is a precision fix with a recall side-effect, not the reverse.
The defect
run_aifslides its gap cursor one byte at a time on a reject, with noinstruction-alignment filter, because
Listing::first_undefined_afterisbyte-granular by construction. An ARM PC-relative literal pool is data, so it is an
undefined gap, and the cursor probes every byte of it.
On an STM32 Cortex-M image the pool words are SRAM addresses
0x2000_xxxx. Storedlittle-endian, the halfword at
pool_word + 2is0x2000, which decodes asmovs r0,#0— andmovsfollowed by whatever comes next clears the two-mnemonicfingerprint gate as reliably as a real prologue does (measured:
fingerprint(+2) >= 4in 96/96 betaflight and 48/48 cleanflight cases,
fingerprint(+0) >= 4in 0/96 and0/48, a clean separation). AIF accepts an entry one halfword before the real
function, falls through into it, reaches its
bx lr— and on accept advances thecursor to
body_max + 1, so the true entry two bytes later is never probed at all.Traced on the sequence charter's own witness (instrumented build, betaflight O0):
In A32 there is no halfword granularity and conditional execution makes almost any
32-bit word a legal instruction, so the same mechanism plants the phantom on the
pool word itself. That is why the offset distribution is
4n - 2in Thumb and4nin A32, and why the charter's "sub-8-byte" framing is the wrong boundary.Upstream Ghidra does not have this and needs no equivalent pass: its reference
analyzer defines pc-relative literal targets as DATA before AIF runs, so those bytes
are not an undefined gap there. kuna's Listing has no literal-pool data-definition
step; the AIF module's own LOSS note ("context-mode ARM gap probing is NOT handled")
is the same gap seen from the other side.
Ablated on three binaries and two ISAs with
--option aif offand nothing else:betaflight O0 36/36 witnesses vanish, cleanflight+betaflight
pool+2144/144 vanish,u-boot O2 318/323 vanish.
funcstart_patterns,addrtable,operand_refs,fid,eh_frame_fullandfast_funcdisceach leave every witness in place.Corpus-wide, with a
$dmapping-symbol oracle: 6,128 of the 56,929 functionskuna functionsreports on 98 ARM images begin inside a literal pool — one in nine —and zero of them are ground truth. Every additive step in this sequence leaves all
6,128 in the output by construction. 18.5% of them carry corrupted C, because the
dead leading
movs r0,#immkills the first argument register and the decompilerconstant-folds it through the body (
getACCdrops a real parameter;ibusReadRawRCreturns 0 where the true entry returns a float load;
blackboxCalculatePDenomemitsreturn 0 / a1). decbench cannot see any of it — the phantoms relabel to nothing andare dropped — which is why four recall-metric lenses aimed at this class found a
precision defect.
What ships
One option, both consumers, because they are one predicate with a measured
interaction: 373 of the removals only happen because the additive half supplied the
replacement entry, and on A32 that number is 107 of 107.
The pool predicate. A word counts as a literal only when some instruction
actually loads it: the resolved absolute
[0x…]operand the ARM disassembly printsfor
ldr rN,[pc,#imm], or the unresolved[pc,#imm]form thatvldr/ldrdprintbecause they resolve the target in the semantic body (
ARMneon.sincvldrRn), plusthe second word of a 64-bit literal, which nothing loads on its own. A pool is a
maximal run of adjacent referenced words — an unreferenced word breaks the run,
which is strictly more conservative than a
$doracle. The scan reads the decodedListing and the speculatively-decoded bodies of the gap-discovered routines,
because a pool sandwiched between two gap-discovered functions is referenced only
from inside one; a Listing-only scan finds nothing at the charter's own witness.
The
[pc,#imm]PC bias needs the decode mode, and production reads it from theengine's
ContextDatabase— the sameTModethe bytes at that address weredecoded under, whichever pass painted it. Reading the database rather than
re-deriving the paints is load-bearing: betaflight's initial SP is
0x1000fff0(CCMRAM, not SRAM), so the shipped vector-table signature does not match and only
cortexmvectors' widened scan paints the image Thumb. A language with noTModeregister answers "no mode" and the
[pc,#imm]form is disabled outright.RECALL, additive — emit an entry fact at the first address after a pool that
abuts a return-class terminal, when it is still undefined and passes AIF's own
fingerprint and valid-subroutine tests. The return class is what separates an
inter-function pool (which follows
bx lr/pop {..pc}) from an intra-functionpool (which follows the unconditional
bthe compiler emits to jump over it). Thefact never re-seeds the walk, so "never removes an entry" is a property of the wiring
exactly as in
ptrentryandtailcallentry.PRECISION, subtractive — drop an AIF accept inside an inferred pool, but only
when the pool's end carries a replacement entry. That clause is the whole safety
argument, and it is not the one the proposal predicted (see below).
Measured
98 stripped ARM images (91 unique by md5) from the decbench corpus, 48,553 DWARF
ground-truth addresses with the Thumb bit masked off
low_pcandhigh_pc.Baseline =
--mode aggressive --option cortexmvectors on --option ptrentry on --option tailcallentry on= 59,406 entries, so nothing merged in steps 1-3 isre-banked (bare
aggressiveis 5,798 on betaflight O0 vs 6,032 with steps 1-3).Everything the bar does not count but the refuters correctly said it should:
Per ISA:
u-boot alone is +109 new entries, 109 ground truth, 100%, 0 splits — the first
thing in this sequence to move an A32 image at all (steps 1-3 move it by zero).
Configuration ablation, all on the same 98 images — this is why the shipping config
is what it is:
Off-target, re-measured on the shipping build with
--option listing on --option aif onforced: 20 x86-64 ELFs (8,171 entries) and 8 i386 PE images (1,405entries) — 0 entries added, 0 removed, byte-identical entry sets. x86-64
RIP-relative loads target
.rodatarather than.textinterstices and i386 has noPC-relative addressing at all, so the predicate is vacuous by ISA, not by luck.
Emitted C: 199 of 199 betaflight bodies byte-identical off vs on, sampled as 120
immediate successors of removed phantoms plus 80 random survivors, decompiled in one
decompile-all --addrload per arm. On betaflight O0 the option removes 786 AIFaccepts and adds 15 entries (771 net), and perturbs no surviving function.
Every figure above is re-measured on the shipping build, not on the env-gated
measurement build. The full 98-image sweep is set-identical to the measurement arm on
96 of 98 images; the two that differ are the byte-identical crazyflie O2-noinline pair,
where the production
TModereader is slightly more conservative and keeps 9 phantomseach that the image-wide Thumb shim retired. That is the whole delta: removals 4,238 ->
4,220, new/GT/lost/splits unchanged at 191/188/0/1, and nothing is added or lost
that the measurement arm did not have.
The correction that made this shippable
Two independent measurements put the additive half at 8-19 splits, and a third at
718 with a
$doracle, and all three concluded zero splits was unreachable. Thatwas not the pool heuristic failing — it was the reference scan missing half the
literals.
The ARM SLEIGH prints the resolved
[0x…]display form only forldr rN,[pc,#imm].vldrandldrdprint[pc,#0x18]and resolve the target in thesemantic body. Every pool holding a float or a 64-bit constant therefore under-ran,
and the additive half planted its entry on a pool word. The disassembly at the
split witnesses shows it directly:
pidInitFilters' "split" at0x803a2f0is.word 0x42aa0000(85.0f);poly4d_eval's at0x8029f84is.word 0x00000000.Seven of the eight "splits" at the previous best config were data phantoms, not code
splits. Completing the literal set moves the additive half from 19 splits / 89.7%
GT to 1 / 98.4%, with bridging OFF — which matters, because bridging is what
destroyed 62-119 reachable bodies in the suppression half.
The pairing invariant
"Additive is safe, subtractive cannot be made safe" is half wrong, in both
directions.
Unpaired suppression removes 0 ground-truth entries and still destroys 531 real
functions — they lose their only decompilable entry and stop being emitted at any
address. The #239 bar counts entry addresses, so it scores that as zero harm; a
blind 21-case sample decompiled at both addresses says 11 of 21 phantom bodies are
byte-identical to the true-entry body, so roughly 276 of the 531 are correct output
being deleted. Dropping a phantom only when its pool end carries a replacement entry
makes the removal a MOVE: bodies destroyed goes 531 -> 0 while 4,220 phantoms are
still retired. 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. Bridging is off.
Two disclosures
0x8069c20, 4 bytes intoSCSI_RequestSense@0x8069c1c, one image. A literal reference resolves ontothe function's own first word, which the Listing never decoded, so the inference
cannot tell that word from a pool word. The only guard that removes it — refusing
to emit at a known branch target — costs 108 of 189 recovered ground-truth
entries and is dominated. Disclosed rather than gated away, the same call step 3
made for u-boot's two.
verify_poolentry.rs::poolentry_split_residue_is_pinnedpins the shape as current behaviour and names it, so a future fix has a test to
update.
0x8006a30, in no DWARF body: zeropadding between
rand's pool andstrlen. It appears twice in the raw countsbecause
cf2.elfandfirmware.elfare the same bytes.Speed — disclosed, and over budget on the analysis tier
Analysis tier only (
kuna functions), interleaved min-of-3, both on the measurementbuild and re-run on the shipping build. The box carried two other agents' workspace
suites throughout (load average ~90-100), so read the spread, not the point estimate:
Only the A32 figure reproduces cleanly, and it is the honest headline: +33% on the
analysis tier, well over the 5% budget. The Thumb and x86-64 rows are inside the
noise floor this box currently has, so treat the betaflight number as "somewhere
between +3% and +14%" rather than either endpoint. The cost is real either way — the
pass re-decodes every gap-discovered body to harvest its literal references.
Whole-binary
decompile-allon betaflight O0 goes 262.8 s -> 220.7 s (-16%) — asingle shot, so treat the magnitude as indicative, though the direction is structural
(771 fewer functions decompiled, at ~0.5 s each). An ARM image with pools but no
phantoms pays the analysis-tier cost with no benefit, which is one more reason this
is default-OFF.
Wiring, tests, counts
Computed inside the existing
arch.analysis_listing && arch.analysis_aifblock inpasses.rs, afterrun_aifand afterptrentry's targets exist: the additivefact is computed over the completed walk and never re-seeds it, and the removal is a
partition of a list, not a Listing rebuild. The additive entries are pushed under
their own
poolentryid so the commit gate inengine.rsmirrors the pre-invocationcheck; the subtractive half rides the
aifstream it filters.No
tests/stages/*.xml, and one cannot exist. The stages/datatest harness embedsraw
<bytechunk>s with explicit<symbol>s and never constructs a load image, sothe Listing tier is never built there —
tests/stages/kuna-listing-flag.xmlsays soin its own comment, and
fdeinterior/DIV-61 shipped an entry-removing default-ONflip at 675/675 PARITY OK with no per-test opt-out for the same reason. The gate is
the cross-crate two-pass
kuna-console/tests/verify_poolentry.rs, over a newcommitted fixture
cortexm_poolentry_le32(+ its byte-by-byte generator, built likecortexm_ptrentry_le32.py). Twentymovs ; movs ; movs ; bx lrhelpers clear AIF's20-function floor and its 4-occurrence fingerprint threshold at once, and the image
then carries all three shapes:
AloadsPOOL1 = 0x20001000; off, AIF mintssub_800014aandBat
0x0800014cis absent, and the phantom's deadmovs r0,#0shows up asreturn 0x600000000. On, the entry MOVES tosub_800014c.POOL2, exceptDopensmovs ; adds, afingerprint nothing shares, so no replacement entry exists and the
sub_800015ephantom is KEPT with the option on. This is the assertion that would have caught
the 531 destroyed bodies.
G's literal resolves ontoF's own first word, the entry moves tosub_8000174and losesmovs r0,#7 ; movs r1,#8. The disclosed residue, pinned.Plus unit tests for both literal display forms, including
tbb [pc,r3]/tbh [pc,r3,lsl #1]returningNone(they print the same[pcprefix), theno-bridging run property, and the return-class gate.
Every shared counter is derived from a fresh
phase catalogcapture on a greenbuild, not by arithmetic — and re-derived from scratch after the rebase onto
funcboundflow(#280, DIV-67), which registered an option of its own: settables96 -> 97, analysis tier 34 -> 35, transform tier 42 (unchanged by this
PR), catalog JSON rows 96 -> 97, bytecompat fixture 96 -> 97, catalog
trailing-comma tally 95 -> 96. The 97 and the (20 core, 42 transform, 35
analysis) split are counted off a live
kuna catalog --json; the bytecompat fixturewas recaptured with the documented
decomp_dbg openfile writerecipe.tests/stages/kuna-catalog.xmlis untouched (its assertions are exact-name matcheson other options, ranges, or counts of
source_decompiler: angr/structure-recovery/opt-in-tool, none of which this row is),kuna-base/src/xml.rsis untouched by this PR (no stages XML added — its 194 is
funcboundflow's), anddocs/baseline-stages.jsonis unchanged.No DIV row. Default-OFF and default output byte-identical, the same call
ptrentryandtailcallentrymade. Parked inmodes.rsUNEVALUATEDnext to itsthree sequence siblings, with the reason recorded:
cortexmvectors,ptrentry,tailcallentryandpoolentrycompose — every number above is measured on topof the other three — so preset membership is one joint evaluation, not four.
Gates
All four re-run in full on the rebased tree (base
11f40f46):make test— PARITY OK 675/675make test-stages— PARITY OK 407/407 (407 not 405 because [AUTOMATED] feat(p2): funcboundflow - bound fall-through at a known function entry, so a function ending in an unproven no-return call stops instead of absorbing the next function (DIV-67) #280 addedtests/stages/funcboundflow.xml; checked against main'sdocs/baseline-stages.json, which this PR leaves unchanged — no re-record)make rust-test— green: 307 result blocks, 4,549 tests passed, 0 failed, 37 ignored, exit 0. This PR is internal, so CI skips the workspace suite ([AUTOMATED] ci: scope the workspace suite to fork PRs and to main #274) and this local run is the gate.make check-spec— green in strict modekuna catalog --check— catalog OKRe-verified after the rebase
funcboundflow(#280) is default-ON and changes function boundaries, and this isa function-entry pass, so the headline was re-measured rather than assumed. Four
arms per image — baseline and
poolentry on, each withfuncboundflowat itsdefault and forced off — comparing exact entry-address sets from
kuna functions --json --mode aggressive --option cortexmvectors on --option ptrentry on --option tailcallentry on:poolentry onfuncboundflowon vs offfuncboundflowmoves the analysis-tier entry set by zero addresses in every arm— it is a P2 flow-follower gate and never reaches the tier these numbers are measured
on — and betaflight O0 reproduces this PR's own recorded per-image delta exactly
(
+15 / -786, 771 net), off a baseline of 6,032 that also matches. No figure abovemoved; the corpus-wide 191 / 188 GT / 0 lost / 1 split and 4,220 retired stand as
measured.
verify_poolentry.rspasses all four cases on the rebased build(
poolentry_moves_the_entry_to_the_pool_end,poolentry_keeps_an_unpaired_phantom,poolentry_split_residue_is_pinned,poolentry_is_inert_without_aif).What this does NOT close
ground-truth misses corpus-wide (59.3%) have a containing entry that IS a real
DWARF entry — kuna absorbed a real function into its neighbour rather than
inventing one. This sequence has closed the invented-entry half of ARM entry
recall, not ARM entry recall.
charter's 324-case IDA O0 pool, +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. The headline is the other column.
result rests on it, and a mixed A32+Thumb image with VFP literals is unmeasured.
decbench has no aarch64/MIPS/PPC/RISC-V image at all; inertness there is reasoned
(those targets route constants to
.rodata/.sdata), not measured.fdeinteriorseam inkuna-console/src/engine.rsis the architecturally correcthome and would let the pairing test see entries from
ptrentry/tailcallentry/cortexmvectors. That variant is unmeasured; it is afollow-up with its own sweep, not this PR.
fdeinterior's warrant does not transfer. An FDE is an extent the compilerwrote into the binary; an inferred pool is a guess. The 0-of-4,220 figure is
measured against DWARF from unstripped twins that the runtime predicate does not
have.
(41.8%) strictly inside a real body, with no
fdeinteriorprotection because thatpass is ELF-only. Not fixed, not broken, not covered.
🤖 Generated with Claude Code
https://claude.ai/code/session_01C8UQbPqALzdUQ3cLLjUeKH