Skip to content

[DWARF] Avoid reprocessing types repeated in every compilation unit - #8406

Open
bdash wants to merge 4 commits into
devfrom
test_dwarf_type_dedup
Open

[DWARF] Avoid reprocessing types repeated in every compilation unit#8406
bdash wants to merge 4 commits into
devfrom
test_dwarf_type_dedup

Conversation

@bdash

@bdash bdash commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Placeholders are built once per type rather than per declaration, and a definition already committed under its name is not committed again.

This decreases the number of types that the DWARF processor attempts to define on the view by two orders of magnitudes in some cases. Previously the duplicates were discarded by core within DefineTypes, but not before expensive work had been performed on each submitted type.

@bdash
bdash requested a review from negasora August 11, 2026 18:09
bdash added 3 commits August 12, 2026 13:20
Every anonymous subroutine type produces the same placeholder regardless
of its return type, because a named type reference takes only its class,
width and alignment from its target, and function types set neither.
A placeholder is fully determined by its name plus the class, structure
variant, width and alignment of its target, which are the only things
`InitNamedType` reads from it.
The name was recorded after the branches that commit it, so it was also
recorded on the two paths that log an error and commit nothing. That
dated from when there was a single commit path and the two were the same
event. A name left behind by a failed commit made a later type of that
name get deconflicted against something that was never stored.
Comment thread plugins/dwarf/dwarf_import/src/dwarfdebuginfo.rs Outdated
…ration

Debug info describes a type in every compilation unit that includes its
header. Committing each occurrence made the core walk the whole member
tree and re-resolve every named reference in it. Only the first
occurrence is committed now, and later ones describing the same
definition are skipped.

A typedef's own type is the self-referential placeholder that stands in
for it while its children are built, so the comparison uses the target
that gets committed instead.
@bdash
bdash force-pushed the test_dwarf_type_dedup branch from b10ca94 to 30df27f Compare August 12, 2026 21:48
@bdash
bdash requested a review from negasora August 12, 2026 21:49
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