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. ------------- Commit messages: - Remove AnyObj new operator taking an allocation_type - Use more specific allocation types Changes: https://git.openjdk.org/jdk/pull/10745/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10745&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8295475 Stats: 458 lines in 152 files changed: 67 ins; 37 del; 354 mod Patch: https://git.openjdk.org/jdk/pull/10745.diff Fetch: git fetch https://git.openjdk.org/jdk pull/10745/head:pull/10745 PR: https://git.openjdk.org/jdk/pull/10745
