RFR: 8352067: Remove the NMT treap and replace its uses with the utilities red-black tree [v2]

Casper Norrbin cnorrbin at openjdk.org
Wed Aug 6 11:07:42 UTC 2025


> Hi everyone,
> 
> The utilities red-black tree and the NMT treap serve similar functions. Given the red-black tree's versatility and stricter time complexity, the treap can be removed in favour of it.
> 
> I made some modifications to the red-black tree to make it compatible with previous treap usages:
> - Updated the `visit_in_order` and `visit_range_in_order` functions to require the supplied callback to return a bool, which allows us to stop traversing early.
> - Improved const-correctness by ensuring that invoking these functions on a const reference provides const pointers to nodes, while non-const references provide mutable pointers. Previously the two functions behaved differently.
> 
> Changes to NMT include:
> - Modified components to align with the updated const-correctness of the red-black tree functions
> - Renamed structures and variables to remove "treap" from their names to reflect the new tree
> 
> The treap was also used in one place in C2. I changed this to use the red-black tree and its cursor interface, which I felt was most fitting for the use case.

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

  feedback fixes

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/26655/files
  - new: https://git.openjdk.org/jdk/pull/26655/files/97107f5b..a495e291

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

  Stats: 4 lines in 3 files changed: 0 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/26655.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26655/head:pull/26655

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


More information about the hotspot-dev mailing list