[PATCH] D78950: Adds LRU caching of compile units in DWARFContext.

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 21:33:08 PDT 2020


ikudrin added a comment.

Is it possible to add some tests for the LRU logic?



================
Comment at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:119-126
+  // LRU mechanism of compile units to manage memory usage.
+  using unit_queue_type = std::list<DWARFUnit *>;
+  using unit_queue_iterator = unit_queue_type::iterator;
+  using unit_map_type = std::unordered_map<DWARFUnit *, unit_queue_iterator>;
+  unit_queue_type CompileUnitQueue;
+  unit_map_type CompileUnitMap;
+  const int CompileUnitLRUSize;
----------------
Can this be a separate utility class? No need to overburden `DWARFContext`.


================
Comment at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:333
+  // management purpose. When it's referred to again, it'll be re-populated.
+  void clearLineTableForUnit(DWARFUnit *U);
+
----------------
Does this method need to be in the public interface of the class? Right now, it looks like an implementation detail that should be hidden from users.


================
Comment at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:416
+  // Refer a compile unit so that it's pushed back in LRU.
+  void referCompileUnit(DWARFUnit *CU);
+
----------------
It looks like this should also be private, no?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78950/new/

https://reviews.llvm.org/D78950





More information about the llvm-commits mailing list