================
@@ -603,6 +640,16 @@ class ProfiledBinary {
     return ProbeDecoder.getInlinerDescForProbe(Probe);
   }
 
+  void addMMapNonTextEvent(MMapEvent MMap) {
+    MMapNonTextEvents.push_back(MMap);
----------------
mingmingl-llvm wrote:

My understanding is that it's rare for the virtual address ranges (i.e., the 
intervals formed by `[MMapEvent.Address, MMapEvent.Address + MMap.Size)`) of 
mmap events to overlap with each other. Assuming this is true, I think there 
are two implementation options here:

1)  Make llvm-profgen to validate mmap events don't have overlapping virtual 
address (and report 'unimplemented error' otherwise). This way, the 
implementation can use a map to do efficient address canonicalization and 
handle the common case. The updated change implements this option.
  
2) llvm-profgen doesn't validate address interval and cannot assume 
non-overlapping address ranges. The implementation uses a vector to record the 
mmap events in the order they are added and reverse iterate the map to do data 
address canonicalization. While a linear reverse iteration is probably 
acceptable given the number of non-text mmap events is observed to be 3 in most 
cases, I think option 1) does the better trade-off. 

Let me know your thoughts and I'd be glad to follow up.


https://github.com/llvm/llvm-project/pull/148013
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to