Repository navigation
regionstructure: default-on (DIV-12) - #85
Merged
Merged
Conversation
…rimary structuring path Flip `regionstructure` on by default: kuna's S8 now structures the CFG by walking the KunaRegionIdentifier region tree and matching angr Phoenix/SAILR schemas (acyclic sequence + ITE + cyclic loops [Inc 3] + acyclic switch-case [Inc 4] + Inc 5 short-circuit && / || condition folding) instead of running Ghidra's CollapseStructure unconditionally. On an un-collapsible region (irreducible / multi-entry loops) it falls back to CollapseStructure, so it is never worse than upstream. `option regionstructure off` restores the unconditional Ghidra CollapseStructure path. The full 675-assertion datatest corpus is byte-identical with the region structurer on vs off (Inc 5 closed the last divergence, elseif.xml Else-if #14, via && / || folding), so `make test` stays PARITY OK 675/675 with no baseline regeneration; docs/baseline.json is untouched. This is not a correctness fix — it is a deliberate structure-recovery default and the foundation the later irreducible/SAILR goto-reduction increments build on. - architecture.rs: region_structure defaults true (struct ctor + resetDefaults), copied into the per-function seam in build_arch_handle as before. - stages.toml: regionstructure row default on; summary/use_when updated. - docs/assertions.md regenerated (catalog default off -> on). - docs/divergences.md: DIV-12 entry. make test PARITY OK 675/675; make test-stages PARITY OK 203/203; kuna catalog --check OK. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
mahaloz
added a commit
that referenced
this pull request
Jun 26, 2026
Finishing fixes on top of the WIP loop-carried-guard jump-table recovery (option switchsharedcase, default-off opt-in). The feature itself (the S2 JumpBasic::kuna_try_loop_carried_guard_table walk, the arch flag + full registration, the b2sum stage test) was already committed; these are the remaining gate fixes: - Regenerate tests/fixtures/stage_catalog.json (the catalog_bytecompat golden). It carried a PRE-EXISTING drift inherited from the PR #85 regionstructure-default-on merge — the fixture said `default: off` while stages.toml said `on` — so full_catalog_matches_cpp_byte_for_byte was already red on the branch parent. The regen fixes that drift AND adds the new `switchsharedcase` settable row (captured from `stage catalog`, no program loaded, no `current` field). - catalog_bytecompat.rs: bump the settable count 49 -> 50 (fixture_has_all_50_settables) for the new row. - docs/PROGRESS.md: session entry (root cause, before/after, default + the measured +27% on-vs-off speed, gate results). Gates: `make test` PARITY OK 675/675 (docs/baseline.json untouched), `make test-stages` PARITY OK 205/205, `kuna catalog --check` OK, docs/assertions.md in sync. ElementId switchsharedcase=4103 (unique 4000+). Co-Authored-By: Claude Opus 4.8 (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.
regionstructure: default-on (DIV-12)
Flip
regionstructureon by default — the region-driven (angr Phoenix/SAILR) structurerbecomes kuna's primary S8 structuring path, replacing the unconditional Ghidra
CollapseStructure.This is the closeout of the region-structurer foundation (Inc 0–6). kuna's S8 now structures the
CFG by walking the
KunaRegionIdentifierregion tree and matching the Phoenix/SAILR schemas(acyclic sequence + ITE + cyclic loops [Inc 3] + acyclic switch-case [Inc 4] + Inc 5 short-circuit
&&/||condition folding). When a function cannot be collapsed to a single structured root(irreducible / multi-entry loops) it falls back to
CollapseStructure, so it is never worsethan upstream.
option regionstructure offrestores the unconditional Ghidra path.Parity
The full 675-assertion datatest corpus is byte-identical with the region structurer on vs off
— Inc 5 (#79) closed the last divergence (
elseif.xmlElse-if #14) via&&/||conditionfolding, so on now reproduces Ghidra's
CollapseStructureoutput exactly across the whole corpus.make test→ PARITY OK 675/675 (no baseline regeneration;docs/baseline.jsonuntouched)make test-stages→ PARITY OK 203/203kuna catalog --check→ OKWhy default-on if it's byte-identical?
On the reducible datatest corpus the output is identical to Ghidra, but the region structurer is
the foundation the later irreducible/SAILR goto-reduction and region-refinement increments
build on — making it the default now means those passes extend the primary path. It is a
deliberate structure-recovery default (like DIV-10), not a correctness fix.
Changes
architecture.rs:region_structuredefaultstrue(struct-literal ctor +resetDefaults);carried into the per-function seam in
build_arch_handleas before.stages.toml:regionstructurerowdefault = "on"; summary/use_when updated.docs/assertions.mdregenerated (catalog default off → on).docs/divergences.md: DIV-12 entry.🤖 Generated with Claude Code