Request for review (s) - NPG: Replace the ChunkList implementation with class FreeList<Metachunk>

Mikael Gerdin mikael.gerdin at oracle.com
Tue Apr 2 14:42:44 UTC 2013


Jon,

On 2013-04-02 00:13, Jon Masamitsu wrote:
> For the perm gen removal project the ChunkList class
> which implemented a simple freelist of Metachunk's was added.
> This change replaces ChunkList with FreeList<Metachunk>.
>
> Changes include
>
> - Deletion of ChunkList
> - Code to initialize the freelists in the FreeList style
> - Replacement of call to ChunkList methods with the
> equivalent calls to FreeList methods.
>
> http://cr.openjdk.java.net/~jmasa/8011173

This looks like a good cleanup step.
I'm fine with you pushing this as is, these are just my thoughts about 
the FreeList<> stuff.

Regarding your comment in ChunkManager::return_chunks I think it could 
be resolved by making SpaceManager::_chunks_in_use[] into an array of 
ChunkList, similar to ChunkManager::_free_chunks.

The name FreeList is kind of a misnomer since it's actually just the 
head of a generic linked list.

Maybe we should consider encapsulating the managing of the _next and 
_prev fields only through the FreeList<> template by making the setters 
to them private and friend:ing FreeList<Metachunk> in class Metachunk 
and only ever letting FreeList manage the links?

It's confusing to have FreeList handle the links through link_prev and 
link_next and other parts of the code using set_next and set_prev.

/Mikael


>
> Thanks.
>
> Jon



More information about the hotspot-gc-dev mailing list