Page MenuHomePhabricator

DWARF: Avoid storing DIERefs in long-lived containers

Authored by labath on Jun 14 2019, 1:09 AM.



A user_id_t carries the same information as a DIERef, but it takes up
less space.

Furthermore, DIERef::operator<'s implementation is very
questionable, as it does not take the cu_offset and section fields into
account. Using just the die offset was correct it the days when all
debug info lived in a single section, but since we started supporting
DWO debug info, this was no longer true. The comparison operator could
be fixed, but it seems like using the user_id_t for these purposes is a
better idea overall.

I think this did not cause any bugs, because the only place the
comparison operator was used is in m_function_scope_qualified_name_map,
and this one is local to a dwo file, but I am not 100% sure of that.

Diff Detail


Event Timeline

labath created this revision.Jun 14 2019, 1:09 AM
This revision is now accepted and ready to land.Jun 14 2019, 9:33 AM
clayborg accepted this revision.Jun 14 2019, 10:32 AM
aprantl added inline comments.Jun 14 2019, 1:13 PM
2970 ↗(On Diff #204717)

If you find the time:

if (!die)
  return {};
auto *type_system = GetTypeSystemForLanguage(die.GetCU()->GetLanguageType());
if (!type_system)
  return {};
 DWARFASTParser *dwarf_ast = type_system->GetDWARFParser();
if (!dwarf_ast)
  return {};
labath marked 2 inline comments as done.Jun 17 2019, 12:29 AM
labath added inline comments.
2970 ↗(On Diff #204717)


This revision was automatically updated to reflect the committed changes.
labath marked an inline comment as done.
Herald added a project: Restricted Project. · View Herald TranscriptJun 17 2019, 12:31 AM