RFR: 8345314: Add a red–black tree as a utility data structure [v17]

Casper Norrbin cnorrbin at openjdk.org
Wed Jan 29 10:17:01 UTC 2025


On Wed, 29 Jan 2025 06:30:21 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:

>> Casper Norrbin has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 36 commits:
>> 
>>  - merge fixes
>>  - Merge branch 'master' into rb-tree
>>  - readd find_enclosing_range
>>  - Merge branch 'master' into rb-tree
>>  - treap swap fix
>>  - const functions
>>  - thomas feedback
>>  - axel feedback
>>  - clarified comment
>>  - Improved comments
>>  - ... and 26 more: https://git.openjdk.org/jdk/compare/ad01dfb6...b7219a93
>
> src/hotspot/share/utilities/rbTree.hpp line 79:
> 
>> 77: 
>> 78:     RBNode* parent() const { return (RBNode*)(_parent & ~0x1); }
>> 79:     void set_parent(RBNode* new_parent) {_parent = (_parent & 0x1) | ((uintptr_t)new_parent & ~0x1); }
> 
> When would `new_parent` not have a valid `RBNode*` pointer value? AFAICT it is only called with valid pointers. The lsb masking is unnecessary. If it is actually required from somewhere, I missed it, in which case we should use `uintptr_t`.

You're right, the masking here does nothing. I removed it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22360#discussion_r1933603794


More information about the hotspot-dev mailing list