RFR: 8331193: Return references when possible in GrowableArray [v3]

Johan Sjölen jsjolen at openjdk.org
Thu May 2 13:00:10 UTC 2024


On Tue, 30 Apr 2024 09:00:18 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> src/hotspot/share/utilities/growableArray.hpp line 153:
>> 
>>> 151:   E* adr_at(int i) const {
>>> 152:     assert(0 <= i && i < _len, "illegal index %d for length %d", i, _len);
>>> 153:     return &_data[i];
>> 
>> (GitHub won't let me put comment on the `adr_at` signature.)
>> 
>> I think there should similarly be const and non-const adr_at, returning pointer to const and non-const respectively.
>
> Done!

Alright,

I'm reverting this change. The issue is that C1 and C2 aren't very `const`-correct, and fixing this would make the size of the PR blow up.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18975#discussion_r1587591026


More information about the hotspot-dev mailing list