RFR: 8349525: RBTree: provide leftmost, rightmost, and a simple way to print trees

Thomas Stuefe stuefe at openjdk.org
Thu Feb 6 13:13:11 UTC 2025


On Thu, 6 Feb 2025 08:06:04 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> For things I currently work on (compilation memory statistic), I need this functionality.
> 
> Changes:
> 
> - added leftmost() and rightmost() (pretty self-explanatory)
> - added print_on(outputStream*) (likewise)
> - const correctness
> - other minor cleanups
> - gtests for all added functions
> 
> Tests: GHA (all clean), manual tests on Linux x64

src/hotspot/share/utilities/rbTree.inline.hpp line 484:

> 482: template <typename F>
> 483: inline void RBTree<K, V, COMPARATOR, ALLOCATOR>::visit_in_order(F f) const {
> 484:   const RBNode* to_visit[64];

Note to self or others: This needs at least an assertion, better a visit-stop on release builds

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23486#discussion_r1944698782


More information about the hotspot-dev mailing list