Skip to content

[AUTOMATED] feat(p6): paramcopyhoist - anchor an unmodified parameter's copy-shadow in the entry block - #250

Merged
mahaloz merged 1 commit into
mainfrom
feat/decbench-paramcopyhoist
Aug 3, 2026
Merged

mahaloz merged 1 commit into
mainfrom
feat/decbench-paramcopyhoist

Conversation

@mahaloz

@mahaloz mahaloz commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What

gcc -O0 gives every parameter a stack home, and the source idiom
if (p && !*p) p = NULL; leaves a MULTIEQUAL at the guard's join whose incoming
slots are the raw input register. Merge::mergeOp cannot merge the
input-register HighVariable with the address-tied stack-slot HighVariable, so
Merge::trimOpInput snips each offending slot into a COPY and places it at the
tail of that slot's predecessor block — and that COPY is what prints as
vN = aM;.

For the first parameter the guard's join predecessors intersect at the entry
block, so buildDominantCopy's findCommonBlock lands the copy there and it
renders correctly. For every later parameter the intersection is the previous
guard's join, so the copy sinks below that guard and splits the source's single
entry block in two. kuna is internally inconsistent about the identical
construct; upstream Ghidra sinks it the same way, so this ships as an option
(paramcopyhoist, default-OFF), not as a bug fix.

Both producing sub-cases are covered:

  • two-or-more trimmed slots — later collapsed by buildDominantCopy
    (witness e2fsck save_output 0x4eeb6);
  • exactly one trimmed slot — no dominant-copy pass runs at all, so the single
    opInsertEnd is the final placement (witness e2fsck ea_refcount_free
    0x4a9e9).

Before / after

kuna decompile ~/…/O0/e2fsprogs/stripped/e2fsck --addr 0x4eeb6

   v11 = *(unsigned long *)(v4 + 0x28);
   v7 = a0;
-  if ((a0) && (!*a0))
-    v7 = NULL;
-  v6 = a1;                     // outside the entry block: +1 CFG node
-  if ((a1) && (!*a1))
-    v6 = NULL;
-  v5 = a2;                     // outside the entry block: +1 CFG node
-  if ((a2) && (!*a2))
-    v5 = NULL;
+  v5 = a2;
+  v6 = a1;
+  if ((a0) && (!*a0))
+    v7 = NULL;
+  if ((a1) && (!*a1))
+    v6 = NULL;
+  if ((a2) && (!*a2))
+    v5 = NULL;
   if (((!v7) && (!v6)) && (!v5))
     return 0;

Second sub-case, --addr 0x4a9e9:

-  if (!a0)
-    return;
   v1 = a0;
+  if (!a0)
+    return;
   if (*(int8 *)(a0 + 0x18))
     ext2fs_free_mem(a0 + 0x18);

GED

scripts.decbench.rescore --case O0-e2fsprogs-e2fsck-save_output --option paramcopyhoist on

nodes edges GED
source 46 72 —
before 53 77 29.0
after 51 77 17.0

−12 GED, and the round-2 refuter separately measured the alternative of
deleting the copies entirely and writing through the parameter (literally what
the source does) at 17.0 as well — so the hoist is GED-optimal for this
construct and there is nothing left on the table here.

Breadth (four O0 binaries, 3,031 functions)

off on
top-level param copy-shadows outside the entry block 200 108
top-level param copy-shadows in the entry block 318 479
functions with at least one sunk copy 121 63
new decompile errors — 0

116 functions change. All 116 were diffed: 99 are pure re-orderings of
vN = aM;; 17 have a secondary rendering effect — mostly a comma side-effect
inside a short-circuit condition becoming a plain statement (an improvement);
2 leave an empty if (c) { } then-branch. 0 semantic regressions.

Three things that had to be measured, not reasoned

Each of these produced wrong C and was found by building the change and
diffing decompiled output over all 3,031 functions. They are why the shipped
pass looks the way it does.

  1. Merge::trimOpInput is the wrong hook site (the mechanism the triage
    record proposed). trimOpInput exists to give the snipped slot a tiny Cover
    so mergeOp's test passes; widening it there makes that test fail, mergeOp
    falls through to trimOpOutput, and markInternalCopies hides both resulting
    COPYs. On e2fsck ext2fs_read_inode2 (0x7f6bb) the assignment vanished:
    -      if ((int4)a3 <= (int4)v10)
    -        v10 = a3;
    +      if ((int4)a3 <= (int4)v10) {
    +      }
           memcpy(a2, ..., (int8)(int4)v10);   // v10 never receives a3
    The legality question is also unanswerable there: mergeAddrTied has run but
    ActionMergeCopy has not, so the stack slot's other definitions are still in a
    different HighVariable and the entry-block clobber is invisible.
  2. Running before ActionFinalStructure perturbs structuring. Moving a COPY
    out of a block changes what the P8 duplication/dedup passes see —
    e2fsck sub_544cc lost an if (!a0) return; early return. The pass now runs
    last in universal_sched, so the only observable effect is which basic
    block's statement list holds the COPY.
  3. The Cover test cannot see two definitions converging. It judges each move
    against where the other definitions sit today, so two definitions of one
    variable can both be admitted — each dead where the other is live, never
    intersecting — and after both moves the second kills the first.
    e2fsck sub_7431a started returning a2 unconditionally. Hence
    one_per_high.

Mechanism as shipped

p6_variables/kuna_paramcopyhoist.rs — ActionParamCopyHoist (ELEM 4120), the
last action in universal_sched. A candidate must be a printing COPY whose
input occupies a formal parameter's storage (Varnode::isInput alone also
admits globals and read-before-written stack slots), at least one of whose reads
is a MULTIEQUAL and all of whose reads are MULTIEQUAL/INDIRECT (the
INDIRECT-only case is mergeIndirect's call-adjacent snip, deliberately out of
scope), whose HighVariable has exactly one candidate, and which passes
buildDominantCopy's own Cover test re-run against the hypothetical hoisted
placement and the final high — with the a_cover def point taken at the
start of the entry block so it over-approximates and errs toward rejecting.
That test is what correctly declines ext2fs_read_inode2.

The only ported-core edit is one // (kuna) visibility widening:
FuncdataCoverCtx becomes pub(crate).

Default

OFF, opt-in. The default-ON ablation is clean on the datatests —
675/675, PARITY OK, no re-pin — and the speed gate passes, but:

  • with the flip the stage corpus regresses 1 assertion (condfold #3, a
    comma-side-effect promotion);
  • the decbench aggregate ablation the triage record named as the second gate
    for this feature has not been run;
  • 2 of the 116 audited functions render a locally worse empty then-branch.

CLAUDE.md states 0/675 + speed as a necessary condition for default-ON, not
a sufficient one, so the flip is left to a follow-up with the aggregate measured.
No DIV row.

Speed

scripts.pipeline.timeit --option paramcopyhoist ... on the witness, three
independent runs while the box was also running a 40-way IDA batch plus sibling
build agents:

repeat off (ms) on (ms) delta
7 322.5 314.6 −2.4%
7 663.9 225.7 −66.0%
11 304.7 221.1 −27.4%

All three are within the +5% budget; the spread is load noise, not signal
(the option cannot make decompilation faster — the pass is one iter_alive scan
plus one Cover build per candidate, and on most functions it finds no candidate
at all). The honest reading is "no measurable cost".

Gates

make test        -> datatests: 675/675 assertions passed   PARITY OK
make test-stages -> datatests: 361/361 assertions passed   PARITY OK
make rust-test   -> green
make check-spec  -> check-spec OK (strict mode)
kuna catalog --check -> catalog OK: documents exactly the registered kuna options

Artifacts

docs/features/paramcopyhoist/ — analysis.md, plan.md, record.json.
Test: tests/stages/ghdec-paramcopyhoist.xml (two-pass; pass 1 option paramcopyhoist off asserts the bug, pass 2 on asserts the fix).
Spec: docs/spec/06-variables-and-merge.md §6.4.

🤖 Generated with Claude Code

…'s copy-shadow in the entry block

gcc -O0 gives every parameter a stack home, and the source idiom
`if (p && !*p) p = NULL;` puts a MULTIEQUAL at the guard's join whose incoming
slots are the raw input register. Merge::mergeOp cannot merge the input-register
HighVariable with the address-tied stack-slot HighVariable, so Merge::trimOpInput
snips each offending slot into a COPY and places it at the tail of that slot's
PREDECESSOR block -- and that COPY is what prints as `vN = aM;`.

For the FIRST parameter the guard's join predecessors intersect at the entry
block, so buildDominantCopy's findCommonBlock lands the copy there and it renders
correctly; for every later parameter the intersection is the previous guard's
join, so the copy sinks below that guard and splits the source's single entry
block in two. kuna is internally inconsistent about the identical construct, and
upstream Ghidra sinks it the same way, so this ships as an option.

Both producing sub-cases are covered: two-or-more trimmed slots (collapsed by
buildDominantCopy; witness e2fsck save_output 0x4eeb6) and exactly one trimmed
slot (no dominant-copy pass at all; witness e2fsck ea_refcount_free 0x4a9e9).

ActionParamCopyHoist (p6_variables/kuna_paramcopyhoist.rs, ELEM 4120) runs LAST
in universal_sched, after every HighVariable AND the structured tree are final.
That placement, and two of the predicate's clauses, were arrived at by building
the change and diffing decompiled C over 3,031 functions -- each alternative
produced wrong C:

  * hooking Merge::trimOpInput directly (the mechanism the triage proposed)
    defeats the trim's own purpose, so mergeOp falls through to trimOpOutput and
    markInternalCopies hides both resulting COPYs -- e2fsck ext2fs_read_inode2
    lost `v10 = a3;` entirely, leaving an empty `if` body;
  * running the move before ActionFinalStructure perturbs the P8 duplication
    passes (e2fsck sub_544cc lost an early return);
  * the Cover test cannot see two definitions of one variable converging on the
    entry block -- each is dead where the other is live, so neither intersects,
    yet after both moves the second kills the first (e2fsck sub_7431a returned
    a2 unconditionally). Hence one_per_high.

Legality is buildDominantCopy's own Cover test re-run against the hypothetical
hoisted placement and the FINAL high, with the a_cover def point taken at the
START of the entry block so it over-approximates and errs toward rejecting. That
is what correctly declines ext2fs_read_inode2.
@mahaloz
mahaloz merged commit d89a4d9 into main Aug 3, 2026
9 checks passed
@mahaloz
mahaloz deleted the feat/decbench-paramcopyhoist branch August 3, 2026 08:19
mahaloz added a commit that referenced this pull request Aug 3, 2026
…ion lowering

`RuleSubRight::apply_op` (`p3_dataflow/ruleaction_6.rs`, upstream
`ruleaction.cc:7271`) was a port stub: only the leading `doesSpecialPrinting` /
`isPieceStructured` half was transcribed and the body then returned 0 under a
`// Remainder transcribed for the next wave ... W6` comment, so upstream's
`sub(V,c) => sub(V>>c*8,0)` rewrite never ran.  Every SUBPIECE with a NONZERO
byte offset therefore reached the printer, which renders one as the raw p-code
operator.  `SUB41` / `SUB81` / `SUB84` are undeclared identifiers -- kuna emits
no header defining them -- so those function bodies were not compilable C:

    unsigned long sub_4cd60(unsigned long a0,unsigned long a1)  // openssh ssh
    {                                                           // sshbuf_put_u64
      ...
      *v2 = SUB81(a1,7);          ->   *v2 = (char)((uint8)a1 >> 0x38);
      v2[1] = SUB81(a1,6);        ->   v2[1] = (char)((uint8)a1 >> 0x30);
      ...
      v2[7] = (char)a1;                v2[7] = (char)a1;

Ghidra emits `*local_18 = (char)((ulong)param_2 >> 0x38);` and the source is a
plain shift (`((u_char *)(p))[0] = (__v >> 56) & 0xff;`).  The last line of
kuna's own pre-fix pane is the proof the printer was never at fault: the
offset-0 SUBPIECE already rendered `(char)a1`.

The ~45-line tail is now transcribed from `ruleaction.cc:7291-7340`
(GHIDRA_REV=cef869af) with every guard upstream applies, because each one
protects a rendering kuna already gets right: the `c == 0` bail; the
address-tied `overlap == c` bail that leaves ActionCopyMarker's storage markers
alone; and the already-ported `isPieceStructured` special-print branch.  Then
the rewrite proper, including the lone-`INT_RIGHT`/`INT_SRIGHT`-descendant
lumping (declining an `INT_RIGHT` whose combined amount would evaluate to zero,
clamping `INT_SRIGHT` to the sign bit).  Nothing needed wiring: the rule was
already registered in upstream's own schedule position
(`rrow!("subright", "cleanup", ...)`, `infra/universalaction.rs:552`).

One kuna-side deviation, marked `// (kuna)`: the type-factory availability check
is hoisted above the first mutation, so a hand-built Funcdata with no type
factory cannot leave a half-applied transform behind.

No option.  `SUBnn` is an undeclared identifier, so this is a strict correctness
fix, and it restores upstream Ghidra's own behavior from a port stub rather than
making a judgment call -- there is no honest `use_when` prose for a `subright`
option.  The switch already exists anyway: `subright` is a registered rule-group
name, so `option togglerule subright off` reproduces the pre-fix rendering for
bisection.  An independent decider subagent returned `ungated`; its verdict is
recorded verbatim in `docs/features/subright/record.json`.  Recorded in
docs/history.md under Convergences, not as a DIV row -- a port defect whose fix
moves kuna back onto upstream's default earns no DIV row.

Breadth (two release builds of this worktree, stubbed vs ported, 7 whole-binary
`decompile-all --mode reliable` runs over x86-64 -O0/-O2 and ARM Cortex-M;
totals over the 14,720 functions common to both panes, so the 120 s
per-function watchdog cannot move them on a loaded box): nonzero-offset raw
`SUBnn` operators 1,912 -> 95 (95.0%), functions carrying one 733 -> 20, blast
radius 728 functions (4.95%), emitted lines +0.011%.  Every one of the 95
residuals is a case upstream's own guards decline: 42 address-tied global-array
stores (round 1's separately-filed `rodata-phantom-store`), 47 address-tied
local partial-symbol writes (the P6 thread that renders `sym._2_2_` upstream),
6 piece-structured field extractions.  Measured cost: exactly two functions in
14,720 gain a dead partial-register shift statement
(`(undefined7)((uint8)a2 >> 8)` in bzip2 sub_da00 and one
`(undefined3)((uint4)v11 >> 8)` on ARM) -- the form upstream lowers the same
way; corpus-wide count of that shape 0 -> 2.

GED unchanged by construction on both mined cluster cases (netns_add 8.0 -> 8.0,
applyLedFixedLayers 25.0 -> 25.0): the rewrite changes expressions inside blocks
and moves no block.  Rank this by correctness, not by the metric.

Speed (interleaved medians, `decompile-all --mode reliable`): openssh ssh
@0x4cd60 2,307 -> 2,165 ms (-6.16%, 9 pairs), gzip -O0 3,387 -> 3,325 ms
(-1.84%, 7), bzip2 -O2 12,016 -> 11,512 ms (-4.20%, 7), e2fsck -O2 21,378 ->
21,430 ms (+0.24%, 5) -- worst case +0.24%, inside the +5% budget.

Gates (on main @d89a4d95): make test 675/675 PARITY OK (docs/baseline.json NOT
re-pinned); make test-stages 369/369 PARITY OK (baseline re-recorded, purely
additive 361 -> 369 keys, no existing assertion moved); make rust-test green;
make check-spec OK (lenient + strict); kuna catalog --check OK.  No catalog
surface is touched -- the diff vs main for phases.toml, src/p0_knowledge/,
kuna-decomp/tests/ and docs/options.md is empty, and the settable-row count
stays at #250's 85.  Corpus file count 186 -> 187.

#250's ActionParamCopyHoist is a default-OFF P6 pass and this is a P3 cleanup
rule; confirmed rather than assumed, `decompile-all --mode reliable` with
`--option paramcopyhoist on` vs default is identical on openssh ssh, gzip -O0
and bzip2 -O2 (residual raw operators 0/0 each, subright output shapes 23->23,
12->12, 1->1) and the witness at 0x4cd60 is byte-identical either way.  `tests/stages/ghdec-subright.xml` is two-pass
(1 of 8 assertions passes pre-fix, 8/8 post-fix) plus two new rule-level unit
tests pinning the guards that must not be dropped.

Provenance: decbench round-2 triage, case `novel-concat-subpiece-soup`, NOVEL
pool (the CONCAT half of that cluster is disproven as a kuna defect and is not
touched here).

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
…ion lowering (#251)

`RuleSubRight::apply_op` (`p3_dataflow/ruleaction_6.rs`, upstream
`ruleaction.cc:7271`) was a port stub: only the leading `doesSpecialPrinting` /
`isPieceStructured` half was transcribed and the body then returned 0 under a
`// Remainder transcribed for the next wave ... W6` comment, so upstream's
`sub(V,c) => sub(V>>c*8,0)` rewrite never ran.  Every SUBPIECE with a NONZERO
byte offset therefore reached the printer, which renders one as the raw p-code
operator.  `SUB41` / `SUB81` / `SUB84` are undeclared identifiers -- kuna emits
no header defining them -- so those function bodies were not compilable C:

    unsigned long sub_4cd60(unsigned long a0,unsigned long a1)  // openssh ssh
    {                                                           // sshbuf_put_u64
      ...
      *v2 = SUB81(a1,7);          ->   *v2 = (char)((uint8)a1 >> 0x38);
      v2[1] = SUB81(a1,6);        ->   v2[1] = (char)((uint8)a1 >> 0x30);
      ...
      v2[7] = (char)a1;                v2[7] = (char)a1;

Ghidra emits `*local_18 = (char)((ulong)param_2 >> 0x38);` and the source is a
plain shift (`((u_char *)(p))[0] = (__v >> 56) & 0xff;`).  The last line of
kuna's own pre-fix pane is the proof the printer was never at fault: the
offset-0 SUBPIECE already rendered `(char)a1`.

The ~45-line tail is now transcribed from `ruleaction.cc:7291-7340`
(GHIDRA_REV=cef869af) with every guard upstream applies, because each one
protects a rendering kuna already gets right: the `c == 0` bail; the
address-tied `overlap == c` bail that leaves ActionCopyMarker's storage markers
alone; and the already-ported `isPieceStructured` special-print branch.  Then
the rewrite proper, including the lone-`INT_RIGHT`/`INT_SRIGHT`-descendant
lumping (declining an `INT_RIGHT` whose combined amount would evaluate to zero,
clamping `INT_SRIGHT` to the sign bit).  Nothing needed wiring: the rule was
already registered in upstream's own schedule position
(`rrow!("subright", "cleanup", ...)`, `infra/universalaction.rs:552`).

One kuna-side deviation, marked `// (kuna)`: the type-factory availability check
is hoisted above the first mutation, so a hand-built Funcdata with no type
factory cannot leave a half-applied transform behind.

No option.  `SUBnn` is an undeclared identifier, so this is a strict correctness
fix, and it restores upstream Ghidra's own behavior from a port stub rather than
making a judgment call -- there is no honest `use_when` prose for a `subright`
option.  The switch already exists anyway: `subright` is a registered rule-group
name, so `option togglerule subright off` reproduces the pre-fix rendering for
bisection.  An independent decider subagent returned `ungated`; its verdict is
recorded verbatim in `docs/features/subright/record.json`.  Recorded in
docs/history.md under Convergences, not as a DIV row -- a port defect whose fix
moves kuna back onto upstream's default earns no DIV row.

Breadth (two release builds of this worktree, stubbed vs ported, 7 whole-binary
`decompile-all --mode reliable` runs over x86-64 -O0/-O2 and ARM Cortex-M;
totals over the 14,720 functions common to both panes, so the 120 s
per-function watchdog cannot move them on a loaded box): nonzero-offset raw
`SUBnn` operators 1,912 -> 95 (95.0%), functions carrying one 733 -> 20, blast
radius 728 functions (4.95%), emitted lines +0.011%.  Every one of the 95
residuals is a case upstream's own guards decline: 42 address-tied global-array
stores (round 1's separately-filed `rodata-phantom-store`), 47 address-tied
local partial-symbol writes (the P6 thread that renders `sym._2_2_` upstream),
6 piece-structured field extractions.  Measured cost: exactly two functions in
14,720 gain a dead partial-register shift statement
(`(undefined7)((uint8)a2 >> 8)` in bzip2 sub_da00 and one
`(undefined3)((uint4)v11 >> 8)` on ARM) -- the form upstream lowers the same
way; corpus-wide count of that shape 0 -> 2.

GED unchanged by construction on both mined cluster cases (netns_add 8.0 -> 8.0,
applyLedFixedLayers 25.0 -> 25.0): the rewrite changes expressions inside blocks
and moves no block.  Rank this by correctness, not by the metric.

Speed (interleaved medians, `decompile-all --mode reliable`): openssh ssh
@0x4cd60 2,307 -> 2,165 ms (-6.16%, 9 pairs), gzip -O0 3,387 -> 3,325 ms
(-1.84%, 7), bzip2 -O2 12,016 -> 11,512 ms (-4.20%, 7), e2fsck -O2 21,378 ->
21,430 ms (+0.24%, 5) -- worst case +0.24%, inside the +5% budget.

Gates (on main @d89a4d95): make test 675/675 PARITY OK (docs/baseline.json NOT
re-pinned); make test-stages 369/369 PARITY OK (baseline re-recorded, purely
additive 361 -> 369 keys, no existing assertion moved); make rust-test green;
make check-spec OK (lenient + strict); kuna catalog --check OK.  No catalog
surface is touched -- the diff vs main for phases.toml, src/p0_knowledge/,
kuna-decomp/tests/ and docs/options.md is empty, and the settable-row count
stays at #250's 85.  Corpus file count 186 -> 187.

#250's ActionParamCopyHoist is a default-OFF P6 pass and this is a P3 cleanup
rule; confirmed rather than assumed, `decompile-all --mode reliable` with
`--option paramcopyhoist on` vs default is identical on openssh ssh, gzip -O0
and bzip2 -O2 (residual raw operators 0/0 each, subright output shapes 23->23,
12->12, 1->1) and the witness at 0x4cd60 is byte-identical either way.  `tests/stages/ghdec-subright.xml` is two-pass
(1 of 8 assertions passes pre-fix, 8/8 post-fix) plus two new rule-level unit
tests pinning the guards that must not be dropped.

Provenance: decbench round-2 triage, case `novel-concat-subpiece-soup`, NOVEL
pool (the CONCAT half of that cluster is disproven as a kuna defect and is not
touched here).


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
…cost this round

Docs-only. No .rs, no phases.toml, no baselines, no tests.

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.

docs/decbench/features.md
- Round-1 menu replaced by round-2 outcomes, keeping the file's shape and its
  rank-by-correctness thesis: #248 cortexmvectors, #249 funcptralign,
  #250 paramcopyhoist, #251 subright, #252 returncopysplit, #253 itecondlist
  (merged) and #254 peimportcall (IN FLIGHT), each with its measured effect.
- Named the structural finding that outlives them: three separate ported passes
  were dead -- RuleSubRight (stub body), RuleFuncPtrEncoding (live body, stubbed
  input) and ActionDeindirect (live body, a gate bit set nowhere). Each was
  invisible to every test and each had large breadth, so "grep for
  registered-but-unreachable passes" is now a mining route of its own.
- Carried forward what did not ship: undefname-leak (283 functions, 221 with
  uninitialised reads) and 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: make check-spec OK (lenient and strict); make test 675/675 PARITY OK;
make test-stages 381/381 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

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]>
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