ethdebug: Attach semantic debug info to Yul nodes - #2
Open
djolertrk wants to merge 1 commit into
Open
Conversation
…t round trip Attach the scope records of the side table to Yul AST nodes through DebugData, keyed by (AST ID, instance), and keep them across the Yul -> text -> Yul reparse the compiler performs after optimization: records are collected from the AST into the retained table before printing and reattached by their @ast-id annotations after parsing. Attaching re-checks every pointer against the current code: a materialized variable (or update) whose pointer reads a generated Yul local that no longer exists becomes optimized-out instead of keeping a stale pointer. The check is scoped per object. Scope instances travel in the new @ast-id-instance annotation next to @ast-id, so passes that clone code can give each copy its own records; code generation only produces instance 0. Contract-level scopes attach to the top-level block of each object, which now carries the contract's AST ID. Blocks generated by the function grouper and hoister keep locations only, so they do not inherit another node's identity. CompilerStack stores the attached table on the contract; it pairs with the unoptimized IR, whose generated locals it references. EthdebugTest exposes it as Contract.semantic for the golden tests.
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.
Attach the scope records of the side table to Yul AST nodes through
DebugData, keyed by (AST ID, instance), and keep them across theYul -> text -> Yulreparse the compiler performs after optimization: records are collected from the AST into the retained table before printing and reattached by their @ast-id annotations after parsing.Attaching re-checks every pointer against the current code: a materialized variable (or update) whose pointer reads a generated Yul local that no longer exists becomes optimized-out instead of keeping a stale pointer. The check is scoped per object.
Scope instances travel in the new
@ast-id-instanceannotation next to@ast-id, so passes that clone code can give each copy its own records; code generation only produces instance 0. Contract-level scopes attach to the top-level block of each object, which now carries the contract's AST ID. Blocks generated by the function grouper and hoister keep locations only, so they do not inherit another node's identity.CompilerStack stores the attached table on the contract; it pairs with the unoptimized IR, whose generated locals it references. EthdebugTest exposes it as Contract.semantic for the golden tests.