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

Casper Norrbin cnorrbin at openjdk.org
Thu May 8 12:21:08 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.

Casper Norrbin has updated the pull request incrementally with one additional commit since the last revision:

  changed key_leq to assert_key_leq

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/24658/files
  - new: https://git.openjdk.org/jdk/pull/24658/files/3748e564..f29fa727

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=24658&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=24658&range=01-02

  Stats: 7 lines in 2 files changed: 1 ins; 2 del; 4 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