RFR: 8296776: Stop using mtNone as marker for CHeap allocations in GrowableArray [v2]

Stefan Karlsson stefank at openjdk.org
Fri Nov 11 08:15:30 UTC 2022


On Fri, 11 Nov 2022 07:33:46 GMT, Xin Liu <xliu at openjdk.org> wrote:

>> Stefan Karlsson has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains one commit:
>> 
>>   8296776: Stop using mtNone as marker for CHeap allocations in GrowableArray
>
> src/hotspot/share/utilities/growableArray.hpp line 734:
> 
>> 732:   }
>> 733: 
>> 734:   GrowableArray(MEMFLAGS memflags, int initial_capacity = 2) :
> 
> I feel it's too dangerous to have two constructors with convertible parameters. 
> eg. GrowableArray(int initial_capacity)  and   GrowableArray(MEMFLAGS memflags, int initial_capacity = 2) are very close. what if someone has code like this:
> 
> short t = 2;
> GrowableArray(2); // it's very vague to me which ctor will be selected.
> 
> 
> I think it's a good idea to use 'explicit constructor' for one of them. in case implicit conversation takes place unconsciously.

MEMFLAGS is defined as a class enum, so integers will not be automatically converted to MEMFLAGS. I'll add explicit to the constructors.

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

PR: https://git.openjdk.org/jdk/pull/11086


More information about the hotspot-dev mailing list