RFR: 8319709: Make GrowableArrayCHeap copyable [v2]
David Holmes
dholmes at openjdk.org
Thu Nov 9 07:38:59 UTC 2023
On Thu, 9 Nov 2023 07:16:04 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
>> 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.
Hmmm I'd guess I'd normally store pointers then, because I generally may not want to either move or copy the object that is accessible through the container. But thanks for clarifying.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16559#discussion_r1387593971
More information about the hotspot-dev
mailing list