RFR: 8296776: Stop using mtNone as marker for CHeap allocations in GrowableArray [v3]
Stefan Karlsson
stefank at openjdk.org
Mon Nov 14 10:09:31 UTC 2022
On Mon, 14 Nov 2022 00:12:45 GMT, David Holmes <dholmes at openjdk.org> wrote:
> > When looking at the changes to the usages of CHeap-backed GrowableArrays it becomes apparent that all of these usages where forced to provide a value for the initial capacity. When MEMFLAGS move to the front, we can now skip having to figure an initial capacity.
>
> The default initial capacity is 2, the explicit initial capacities are not 2 and in many case >>>2. So without an explicit capacity passed in these GrowableArrays would likely waste a lot of time unnecessarily growing. I don't think either of these parameters should really have a default value - in which case the order could have remained as it was.
Sure, that's an alternative. Before committing to doing that, could you take a look at the similar change to CHeap allocated BitMaps #11084? I want the two classes to be similar in where we put the "allocation strategy". With both these changes I've pushed them to the beginning of the parameter list. With your suggestion I either have to make GrowableArray and CHeapBitMap inconsistent, or I need to change CHeapBitMap to also have the MEMFLAGS at the end, which would force all users to set the `clear` parameter. I'm fine with either approach, but I'd like to get feedback on that before moving ahead with this PR.
-------------
PR: https://git.openjdk.org/jdk/pull/11086
More information about the hotspot-dev
mailing list