RFR: 8189088: Add intrusive doubly-linked list utility [v3]

Kim Barrett kbarrett at openjdk.org
Sat Oct 7 21:07:04 UTC 2023


On Thu, 5 Oct 2023 10:24:00 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> Kim Barrett has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   add IntrusiveListEntry::is_attached()
>
> src/hotspot/share/utilities/intrusiveList.hpp line 63:
> 
>> 61:  * in a list are externally managed, rather than being embedded values
>> 62:  * in the list, the actual type of such objects may be more specific
>> 63:  * than the list's element type.
> 
> Okay, is there a reason that this shouldn't be true? I assume that what you're saying is that we can have:
> 
> ```c++
> struct Super { IntrusiveListEntry entry; };
> struct SubA : public Super {};
> struct SubB : public Super {};
> void foo() {
>   IntrusiveList<Super> my_list; // This my_list may contain SubA, SubB, and Super
> }
> 
> 
> And this seems like it should be true for any reasonable intrusive list in C++.

Yes, that works.  I mentioned it because I think it's a consequence of
intrusive data structures that might not be obvious to someone familiar
with things like standard containers or our GrowableArray or the like.  (I've
not found a term for distinguishing those from the intrusive kind.)

> src/hotspot/share/utilities/intrusiveList.hpp line 66:
> 
>> 64:  *
>> 65:  * * T is the class of the elements in the list.  Must be a possibly
>> 66:  * const-qualified class type.
> 
> I don't know what it means to be a 'possibly const-qualified class type'.

Perhaps "a class type, possibly const-qualified" would be clearer?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15896#discussion_r1349574231
PR Review Comment: https://git.openjdk.org/jdk/pull/15896#discussion_r1349574201


More information about the hotspot-dev mailing list