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

duke duke at openjdk.org
Thu May 8 13:06:04 UTC 2025


On Thu, 8 May 2025 12:21:08 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.
>
> Casper Norrbin has updated the pull request incrementally with one additional commit since the last revision:
> 
>   changed key_leq to assert_key_leq

@caspernorrbin 
Your change (at version f29fa7277932aa44106a4514c28295481049c3b4) is now ready to be sponsored by a Committer.

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

PR Comment: https://git.openjdk.org/jdk/pull/24658#issuecomment-2862976528


More information about the hotspot-runtime-dev mailing list