RFR: 8295475: Move non-resource allocation strategies out of ResourceObj [v4]
David Holmes
dholmes at openjdk.org
Thu Nov 10 04:59:38 UTC 2022
On Wed, 9 Nov 2022 14:20:57 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:
>> Background to this patch:
>>
>> This prototype/patch has been discussed with a few HotSpot devs, and I've gotten feedback that I should send it out for broader discussion/review. It could be a first step to make it easier to talk about our allocation super classes and strategies. This in turn would make it easier to have further discussions around how to make our allocation strategies more flexible. E.g. do we really need to tie down utility classes to a specific allocation strategy? Do we really have to provide MEMFLAGS as compile time flags? Etc.
>>
>> PR RFC:
>>
>> HotSpot has a few allocation classes that other classes can inherit from to get different dynamic-allocation strategies:
>>
>> MetaspaceObj - allocates in the Metaspace
>> CHeap - uses malloc
>> ResourceObj - ...
>>
>> The last class sounds like it provide an allocation strategy to allocate inside a thread's resource area. This is true, but it also provides functions to allow the instances to be allocated in Areanas or even CHeap allocated memory.
>>
>> This is IMHO misleading, and often leads to confusion among HotSpot developers.
>>
>> I propose that we simplify ResourceObj to only provide an allocation strategy for resource allocations, and move the multi-allocation strategy feature to another class, which isn't named ResourceObj.
>>
>> In my proposal and prototype I've used the name AnyObj, as short, simple name. I'm open to changing the name to something else.
>>
>> The patch also adds a new class named ArenaObj, which is for objects only allocated in provided arenas.
>>
>> The patch also removes the need to provide ResourceObj/AnyObj::C_HEAP to `operator new`. If you pass in a MEMFLAGS argument it now means that you want to allocate on the CHeap.
>
> Stefan Karlsson has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains eight commits:
>
> - Fix after merge
> - Merge remote-tracking branch 'upstream/master' into 8295475_split_allocation_types
> - Remove riscv empty destructors
> - Merge remote-tracking branch 'upstream/master' into 8295475_split_allocation_types
> - Work around gtest exception compilation issues
> - Fix Shenandoah
> - Remove AnyObj new operator taking an allocation_type
> - Use more specific allocation types
Marked as reviewed by dholmes (Reviewer).
-------------
PR: https://git.openjdk.org/jdk/pull/10745
More information about the hotspot-dev
mailing list