Integrated: 8354433: Assert in AbstractRBTree::visit_range_in_order(const K& from, const K& to, F f) is wrong

Casper Norrbin cnorrbin at openjdk.org
Thu May 8 16:23:59 UTC 2025


On Tue, 15 Apr 2025 12:03:39 GMT, Casper Norrbin <cnorrbin at openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: 1e8927dd
Author:    Casper Norrbin <cnorrbin at openjdk.org>
Committer: Johan Sjölen <jsjolen at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/1e8927dded2d6d7049dc277564c77dff81ff1047
Stats:     77 lines in 3 files changed: 36 ins; 19 del; 22 mod

8354433: Assert in AbstractRBTree::visit_range_in_order(const K& from, const K& to, F f) is wrong

Reviewed-by: jsjolen, aboldtch

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

PR: https://git.openjdk.org/jdk/pull/24658


More information about the hotspot-runtime-dev mailing list