Skip to content

Skip generating DWARF info for dead code#3498

Merged
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
adamrk:skip-debug-for-dead-code
Nov 8, 2021
Merged

Skip generating DWARF info for dead code#3498
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
adamrk:skip-debug-for-dead-code

Conversation

@adamrk
Copy link
Copy Markdown
Contributor

@adamrk adamrk commented Oct 31, 2021

Here's an attempt at fixing #3403

When encountering a subprogram that is dead code (as indicated by the
dead code proposal
https://dwarfstd.org/ShowIssue.php?issue=200609.1), don't generate debug
output for the subprogram or any of its children.

}

if is_dead_code(entry) {
skip_children = true;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not personally really all that familiar with this code, but it seems to me like skip_children should be reset back to false at some point after all children have been skipped?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, of course. I'll fix that and update the test to make sure it's done properly.

@adamrk adamrk force-pushed the skip-debug-for-dead-code branch from 33a83b0 to 2ee62ab Compare November 4, 2021 21:54
Copy link
Copy Markdown
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading over this some more it appears that the depth_delta and skip_at_depth variables are used as an alternative form of skipping here? Is that something where these two methods of skipping can get unified into one which uses next_sibling and/or next_dfs?

@adamrk adamrk force-pushed the skip-debug-for-dead-code branch from 2ee62ab to 08e55fd Compare November 7, 2021 07:33
@adamrk
Copy link
Copy Markdown
Contributor Author

adamrk commented Nov 7, 2021

Is that something where these two methods of skipping can get unified into one which uses next_sibling and/or next_dfs?

Yeah good point. Looking at skip_at_depth more carefully, I think it is used for skipping a node and all its children, so we can just reuse that here. I added some comments describing how it works.

@adamrk adamrk force-pushed the skip-debug-for-dead-code branch from 08e55fd to dde0d01 Compare November 7, 2021 07:45
When encountering a subprogram that is dead code (as indicated by the
dead code proposal
https://dwarfstd.org/ShowIssue.php?issue=200609.1), don't generate debug
output for the subprogram or any of its children.
@adamrk adamrk force-pushed the skip-debug-for-dead-code branch from dde0d01 to 221fe7d Compare November 7, 2021 07:51
@alexcrichton alexcrichton merged commit 12bfbdf into bytecodealliance:main Nov 8, 2021
@alexcrichton
Copy link
Copy Markdown
Member

Thanks!

bnjbvr pushed a commit that referenced this pull request Nov 19, 2021
When encountering a subprogram that is dead code (as indicated by the
dead code proposal
https://dwarfstd.org/ShowIssue.php?issue=200609.1), don't generate debug
output for the subprogram or any of its children.
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.

2 participants