Skip to content

ethdebug: Attach semantic debug info to Yul nodes - #2

Open
djolertrk wants to merge 1 commit into
feature/ethdebug-resourcesfrom
feature/ethdebug-yul-side-table
Open

ethdebug: Attach semantic debug info to Yul nodes#2
djolertrk wants to merge 1 commit into
feature/ethdebug-resourcesfrom
feature/ethdebug-yul-side-table

Conversation

@djolertrk

Copy link
Copy Markdown
Collaborator

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.

…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.
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