llvm-project
76e43e06 - [BOLT] Create and release .dwo DWARF contexts incrementally

Commit
12 days ago
[BOLT] Create and release .dwo DWARF contexts incrementally BOLT opened a DWARFContext for every .dwo during readDebugInfo and kept them all alive until teardown. On large split-DWARF targets that is tens of GiB held resident through emission, the point of peak RSS. Make the DWOCUs map a lazily-populated cache instead: * Use the newly added DWARFUnit::clearDWO()/hasDWO() to directly manage DWARFUnit's DIE caching mechanism. * BinaryContext::getDWOCU() opens a context on demand (keyed off a stable DWOId -> skeleton CU map). * Release contexts as soon as they are done with: all of them at the end of readDebugInfo, and per-bucket at the DWARF rewrite merge point. * Remove DWOCUs map, which became redundant and whose purpose can now be served by the new id-to-skeleton map, and then fetching the split CU from the skeleton via getNonSkeletonUnitDIE(). Also drop DWARFRewriter::writeDWOFiles()'s use of getDWOContext(), which dereferenced an arbitrary DWOCUs entry -- with contexts now being freed concurrently that would be a use-after-free. The CU's own context answers the .dwp question identically.
Author
Committer
Parents
Loading