RFR: 8354433: Assert in AbstractRBTree::visit_range_in_order(const K& from, const K& to, F f) is wrong
Casper Norrbin
cnorrbin at openjdk.org
Tue Apr 15 12:11:03 UTC 2025
There was an assert in `AbstractRBTree::visit_range_in_order` that could incorrectly trigger when:
- The range contains no nodes, **but**
- Nodes exist **outside** that range.
The assert checked `from <= to` indirectly via `from <= start <= to`, but `start` could be valid outside that range.
To fix this, I added the ability to supply a direct key comparison for intrusive trees to the `COMPARATOR` template. This already existed in the non-intrusive RBTree, and works the same as the other extra `cmp` function.
Additionally, I found another wrong assert in `replace_at_cursor` that is also fixed here.
-------------
Commit messages:
- assert fix with key comparator for intrusive trees
Changes: https://git.openjdk.org/jdk/pull/24658/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24658&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8354433
Stats: 93 lines in 3 files changed: 55 ins; 18 del; 20 mod
Patch: https://git.openjdk.org/jdk/pull/24658.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/24658/head:pull/24658
PR: https://git.openjdk.org/jdk/pull/24658
More information about the hotspot-runtime-dev
mailing list