Repository navigation
programs-react: read variables across a gather - #342
Merged
Merged
Conversation
All of a context's keys apply, and so do all of a `gather`'s contexts, so the variables at an instruction are every `variables` list in its context: its own and each gathered context's. The extractor stopped at the context's own list, so at bugc's inlined code (the callee's locals beside a gather that held the storage variables) the storage variables disappeared. Entries for one variable (the same identifier and declaration, as in the gather schema's example) now compose into one.
gnidan
force-pushed
the
inline-variables-reader
branch
from
October 6, 2026 06:51
56d20ce to
e3381a3
Compare
Contributor
|
Only one of a `pick`'s contexts holds, so of a pick the extractor lists only the variables that all of its contexts list alike: the same identifier, declaration and pointer. Entries compose into one only for the same identifier and declaration (compared by source and range, whatever the order of keys) in the same frame; an entry without a declaration stays apart, as one did before.
Of a pick, an entry the contexts agree on keeps its type only where they all give the same type: otherwise the type holds in only one of them.
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.
extractVariablesFromInstructionreturned a context's ownvariablesand never looked into itsgatherwhen it had them. But all of a context's keys apply, and so do all of a gather's contexts, so a context can say which variables are in scope in more than one place. bugc did exactly that at inlined code (the callee's locals beside a gather whose callee branch held the storage variables), and the debugger demo losttotalandcallsat every inlined step ofweights.bugat O2.Now the extractor reads every
variableslist: the context's own and each gathered context's. Only one of apick's contexts holds, so of a pick it lists only the variables that all of its contexts list alike (the same identifier, declaration and pointer), where before it took the first context with any; picks and gathers nest the same way. Entries for one variable compose into one, as in the two-entry example in the ethdebug/format/program/context/gather schema, but only for the same identifier and declaration (compared by source and range) in the sameframe. An entry without a declaration stays apart, since two such entries can be different variables, and facts from different frames are not merged.bugc now emits one flat list there (#341), but readers should take any valid shape, so this stands on its own.