feat(decompiler): wire cooperative analysis budget into flow_analysis (#35-3b)#233
Merged
Conversation
…#35-3b) Consult the DecompileBudgetTracker (shipped inert in #35-3a) at the flow-following yield point. Each processed instruction counts as one per-pass iteration; when the budget is engaged and the per-pass cap is reached, flow truncates exactly as the existing max-instruction cap does (artificial HALT, no fall-through) and records a one-time partial-result diagnostic ("Exceeded decompilation budget: Some flow is truncated"). A new console option `decompilebudget <N>` engages the tracker with an N-iteration per-pass cap. Architecture gains an inert DecompileBudgetTracker member that nothing in production engages, so the disengaged default costs a single bool test per instruction and leaves every existing decompile byte-identical (full 678-case datatest suite stays green). Also fixes an ElementId id collision the new option surfaced: decompilebudget was assigned id 289, already held by ELEM_BITFIELD, so the console `option` lookup dispatched to the wrong optionmap entry and never engaged the budget. Reassigned decompilebudget to 290 (the prior next-open index) and bumped ELEM_UNKNOWN's sentinel to 291. Tests: new functional datatest datatests/decompbudget.xml asserts the truncation warning header end-to-end; new testbudget.cc case budget_engage_and_caps_survive_reset pins that engage()/caps survive a per-function reset(). certification.manifest gains the datatest entry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Closes #232.
Summary
Wires the
DecompileBudgetTracker(shipped inert in#35-3a) into theflow_analysisyield point. Each processed instruction counts as one per-pass iteration; when the budget is engaged and the per-pass cap is reached, flow truncates exactly as the existing max-instruction cap does (artificialHALT, no fall-through) and records a one-time partial-result diagnostic (Exceeded decompilation budget: Some flow is truncated).A new console option
decompilebudget <N>engages the tracker with anN-iteration per-pass cap.Architecturegains an inertDecompileBudgetTrackermember — nothing in production engages it, so the disengaged default adds only a single bool test per instruction and leaves every existing decompile byte-identical.Incidental fix
The new option surfaced an
ElementIdid collision:decompilebudgetwas assigned id 289, already held byELEM_BITFIELD, so the consoleoptionlookup dispatched to the wrongoptionmapentry and silently never engaged the budget. Reassigneddecompilebudgetto 290 (the prior next-open index) and bumpedELEM_UNKNOWN's sentinel to 291.Test plan
make decomp_test_dbg— clean build, no warnings./decomp_test_dbg unittests— 315/315 (incl. newbudget_engage_and_caps_survive_reset)./decomp_test_dbg datatests— 678/678 (incl. newdecompbudget)gradle cppRaiiAudit— 229 protected files cleangradle :Decompiler:ip— green (newdatatests/decompbudget.xmlmanifest entry)Proudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/