RFR: 8375621: Move RBTree implementation to inline file to minimize included headers [v2]

Casper Norrbin cnorrbin at openjdk.org
Mon Jan 19 14:54:32 UTC 2026


> Hi everyone,
> 
> The red-black tree implementation is split across `rbTree.hpp` and `rbTree.inline.hpp`. Some small `AbstractRBTree` functions are kept in `rbTree.hpp`, and also all of `RBTree`'s implementation. This makes the file less readable and requires extra header inclusions, notably the `os` class, which in turn includes additional unnecessary dependancies.
> 
> In this PR I have moved all implementation code `rbTree.inline.hpp` instead. As a result, `rbTree.hpp` now only contains declarations, making it cleaner and limiting header inclusions to what is strictly necessary. Implementation-specific headers are now only included in the inline file.
> 
> Additionally, I changed `RBTreeCHeapAllocator` to use `AllocateHeap`/`FreeHeap` from `allocation` instead of `os::malloc`/`os::free`, which allows us to get rid of the `os` dependancy altogether.
> 
> Note: This PR is dependant on #29082, which adds arena-style tree allocators, which this PR then moves to the inline file.
> 
> Testing:
> - Oracle tiers 1-5

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/29295/files
  - new: https://git.openjdk.org/jdk/pull/29295/files/80897eec..89521527

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

  Stats: 58 lines in 1 file changed: 38 ins; 1 del; 19 mod
  Patch: https://git.openjdk.org/jdk/pull/29295.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29295/head:pull/29295

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


More information about the hotspot-dev mailing list