RFR: 8205683: Refactor heap allocation to separate concerns
Erik Österlund
erik.osterlund at oracle.com
Tue Jun 26 15:13:56 UTC 2018
Hi,
After a bunch of stuff was added to the CollectedHeap object allocation
path, it is starting to look quite ugly. It has function pointers passed
around with arguments to be sent to them, mixing up allocation,
initialization, tracing, sampling and exception handling all over the place.
I propose to improve the situation by having an abstract MemAllocator
stack object own the allocation path, with suitable subclasses,
ObjAllocator, ClassAllocator and ObjArrayAllocator for allocating the 3
types we support allocating on the heap. Variation points now simply use
virtual calls, and most of the tracing/sampling code can be moved out
from the allocation path. This should make it easier to understand what
is going on here, and the different concerns are more separated.
A collector can override the virtual member functions for allocating
objects, arrays, and classes, and inject their own variation points into
this framework. For example for installing a forwarding pointer in the
cell header required by Brooks pointers, if you are into that kind of stuff.
Bug:
https://bugs.openjdk.java.net/browse/JDK-8205683
Webrev:
http://cr.openjdk.java.net/~eosterlund/8205683/webrev.02/
Thanks,
/Erik
More information about the hotspot-gc-dev
mailing list