RFR: 8266789: devirtualize find_node and remove of LinkedList
Xin Liu
xliu at openjdk.java.net
Thu May 27 00:18:07 UTC 2021
On Mon, 10 May 2021 07:49:49 GMT, Xin Liu <xliu at openjdk.org> wrote:
> Devirtualize find, find_node and remove. This patch make both LinkedListImpl
> and SortedLinkedList more generic. If the client doesn't use those member functions,
> it's not necessary to define equals() for the user-defined class E.
>
> Remove those 3 member functions from the pure interface LinkedList. subclasses
> implement them using regular member functions.
hi, Ioi,
Thank you for reviewing it. Yes, what you said is 100% correct.
Look, this is the very problem of this LinkedList. You pay for what you don't use. It's very not c++.
To support non-existence use case, C++ has to instantiate template member functions and calll them via vtable.
(That's how Java works because Java has dynamic solution for devirtualization.)
LinkedList is a ADL container. What's the point to support class hierarchy for it? Why do we need late binding for find()?
SortedLinkedList<VirtualMemoryAllocationSite, compare_allocation_site> allocation_sites;
...
site = allocation_sites.find(tmp);
This is real code.
I didn't overthrow the design. I just would like to free up from this equals(). I actually don't use find at all.
https://github.com/openjdk/jdk/pull/3135/files#diff-31de33d2853a803965fd4381172f11904a44f42a125b02caec206f72c94f89d6R103
-------------
PR: https://git.openjdk.java.net/jdk/pull/3944
More information about the hotspot-dev
mailing list