RFR: 8375621: Move RBTree implementation to inline file to minimize included headers [v4]
Johan Sjölen
jsjolen at openjdk.org
Tue Feb 17 11:03:44 UTC 2026
On Tue, 17 Feb 2026 10:34:29 GMT, Casper Norrbin <cnorrbin at openjdk.org> wrote:
>> 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:
>
> - Merge branch 'master' into rbtree-to-inline
> - Merge branch 'master' into rbtree-to-inline
> - sort forward declarations
> - feedback fixes
> - Updated copyright headers
> - move to rbtree.inline
> - Add allocators
Marked as reviewed by jsjolen (Reviewer).
-------------
PR Review: https://git.openjdk.org/jdk/pull/29295#pullrequestreview-3813277845
More information about the hotspot-dev
mailing list