[Lldb-commits] [PATCH] D74759: Treat RangeDataVector as an augmented BST
Jaroslav Sevcik via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Feb 18 05:40:54 PST 2020
jarin added a comment.
Thanks for putting this together, some comments below. Let us see what Pavel thinks.
================
Comment at: lldb/include/lldb/Utility/RangeMap.h:634
+ // We can treat the vector as a flattened BST, augmenting it with upper bounds (max of
+ // range endpoints) for every index allows us to query for intersections in O(log n) time.
----------------
BST -> binary search tree
================
Comment at: lldb/include/lldb/Utility/RangeMap.h:642
+ B ComputeUpperBounds(int lo, int hi) {
+ if (lo > hi) return B();
+
----------------
Here, B() should be the min value of type B, no? Perhaps this should be `std::numeric_limits<B>::min()` instead of `B()`?
================
Comment at: lldb/include/lldb/Utility/RangeMap.h:745
+ void FindEntryIndexesThatContain(B addr, int lo, int hi,
+ std::vector<uint32_t> &indexes) {
+ if (lo > hi) return;
----------------
Hmm, weird, I am surprised this is not `std::vector<T> &indexes` (I realize this was in the code before).
================
Comment at: lldb/include/lldb/Utility/RangeMap.h:849
Compare m_compare;
+ bool upper_bound_computed;
};
----------------
I am guessing this should have the `m_` prefix?
Repository:
rLLDB LLDB
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74759/new/
https://reviews.llvm.org/D74759
More information about the lldb-commits
mailing list