RFR: 8295475: Move non-resource allocation strategies out of ResourceObj [v2]

Stefan Karlsson stefank at openjdk.org
Tue Oct 18 13:42:40 UTC 2022


> 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 incrementally with one additional commit since the last revision:

  Fix Shenandoah

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/10745/files
  - new: https://git.openjdk.org/jdk/pull/10745/files/bafa0229..4e8ac797

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10745&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10745&range=00-01

  Stats: 4 lines in 4 files changed: 0 ins; 0 del; 4 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


More information about the serviceability-dev mailing list