RFR: 8319709: Make GrowableArrayCHeap copyable [v2]
Johan Sjölen
jsjolen at openjdk.org
Thu Nov 9 07:19:57 UTC 2023
On Thu, 9 Nov 2023 06:18:11 GMT, David Holmes <dholmes at openjdk.org> wrote:
> What is the motivation for this? Please add something to JBS. Also see query below.
>
> Thanks
I need this feature because I want to store `GrowableArray` s within `GrowableArray`s without an unnecessary pointer indirection. I'll add this justification to JBS.
> src/hotspot/share/utilities/growableArray.hpp line 835:
>
>> 833: this->grow(other._len);
>> 834: for (int i = 0; i < other._len; i++) {
>> 835: this->_data[i] = other._data[i];
>
> Does this imply that anything you put in a `GrowableArrayCHeap` must itself also be copyable now?
Hi,
No, if you never call the assignment operator then it won't be generated and so does not imply that. If you have something `NONCOPYABLE` and you do call the assignment operator then compilation will fail.
However, just to be clear: It is already the case that everything we put into a `GrowableArray`, CHeap or not, must be copyable. This is a direct consequence of the fact that we do not allow for move semantics in HotSpot.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16559#issuecomment-1803280833
PR Review Comment: https://git.openjdk.org/jdk/pull/16559#discussion_r1387576498
More information about the hotspot-dev
mailing list