This is an archive of the discontinued LLVM Phabricator instance.

[nfc] [lldb] Align `user_id_t` format to the current `DIERef` format
ClosedPublic

Authored by jankratochvil on Oct 29 2020, 11:44 AM.

Details

Summary

Current user_id_t format is:
63{isDebugTypes} 62..32{dwo || 7fffffff} 31..0 {die_offset}
while current DIERef format is (I have made up the bit positions but the field widths do match):
63{m_section==isDebugTypes} 62{m_dwo_num_valid} 61..32{m_dwo_num} 31..0 {m_die_offset}

Proposing to change user_id_t to:
63{isDebugTypes} 62{dwo_is_valid} 61..32{dwo; 0 if !valid} 31..0 {die_offset}

There is no benefit of having 31-bits wide dwo_num in user_id_t when it gets converted to 30-bits width in DIERef.

This patch is for future DWZ patchset which extends the dwo_is_valid bit into a 2-bit field (normal, DWO, DWZ, DWZcommon) so that both user_id_t and DIERef can be changed then the same way.

It would be best to somehow unify user_id_t and DIERef but I do not plan to do that. user_id_t should probably remain a number for the Python API compatibility while there still needs to be some class with all the methods to access it.

SymbolFileDWARF::GetDwpSymbolFile() and SymbolFileDWARF::GetDIE use 0x3fffffff for DWP but that does not clash:
formerly:

  • 31bits32..62:0x7fffffff = normal unit / not any DWO
  • 31bits32..62:0x3fffffff = DWP
  • 31bits32..62:others = DWO unit number

after this patch:

  • bit62=0 30bits32..61:any = normal unit / not any DWO
  • bit62=1 30bits32..61:0x3fffffff = DWP
  • bit62=1 30bits32..61:others = DWO unit number

Diff Detail

Event Timeline

jankratochvil created this revision.Oct 29 2020, 11:44 AM
jankratochvil requested review of this revision.Oct 29 2020, 11:44 AM
labath accepted this revision.Oct 30 2020, 7:38 AM

Sounds good. I like how this makes the user ids small for the common case.

This revision is now accepted and ready to land.Oct 30 2020, 7:38 AM
This revision was landed with ongoing or failed builds.Oct 30 2020, 8:51 AM
This revision was automatically updated to reflect the committed changes.