[llvm-branch-commits] [llvm] [clang-tools-extra] [libcxx] [lldb] [libc] [flang] [clang] [mlir] [BOLT] Embed cold mapping info into function entry in BAT (PR #76903)

Rafael Auler via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jan 11 14:48:44 PST 2024


================
@@ -119,6 +130,7 @@ class BoltAddressTranslation {
                          uint64_t FuncAddress);
 
   std::map<uint64_t, MapTy> Maps;
+  std::map<uint64_t, MapTy> ColdMaps;
----------------
rafaelauler wrote:

Kind of weird that this is only used for write(), and not during parsing. There is a lost symmetry between write() and parse() after this diff. Maybe move ColdMaps to live inside write() method then, since it is never used outside of it.

Once we write(), we're not able to call translate(), since we lost cold functions in Maps. Not that this workflow was ever used, but if this class was meant to have any sort of "serialize/deserialize" workflow, now they are out of sync, and design-wise it feels off. So maybe we should use both a private "Maps" / "ColdMaps" during write(), so the code doesn't read as if "translate" depends on either write or parse -- it should depends only on parse. And maybe write() should be a stateless static method.

https://github.com/llvm/llvm-project/pull/76903


More information about the llvm-branch-commits mailing list