RFR: 8202634: Metaspace: simplify SpaceManager lists

Thomas Stüfe thomas.stuefe at gmail.com
Mon May 7 15:29:39 UTC 2018

Hi all,

may I please have reviews for this small simplification.

Bug: https://bugs.openjdk.java.net/browse/JDK-8202634
webrev: http://cr.openjdk.java.net/~stuefe/webrevs/8202634-simplify-spacemanager/webrev.00/webrev/

This replaces the four separate in-use-chunk-lists in SpaceManager
with a single one. The reasoning behind this is that we do not need to
keep the chunks sorted by chunk size, a single list containing all
chunks of all sizes in use by this SpaceManager is enough, and it
simplifies the coding.

There is only one place where we really did use the former
by-chunktype lists - that is to count how many chunks per chunk type
there are.

However, arguably that is better done with running counters, so this
is what I did. The added benefit is that in
SpaceManager::calc_chunk_size() we do not need to walk the lists
anymore to sum up chunks.

Changes in detail:

- removed the "ChunkIndex" argument in
ChunkManager::return_single_chunk() and
Chunkmanager::return_chunk_list() - that argument was unnecessary,
since the Metachunk we return knows its index.

- Unfolded SpaceManager::initialize into Spacemanager constructor (I
prefer initializing members in ctor init lists)

- replaces SpaceManager::sum_count_chunks_in_use() with running counters.

- I dumbed down the logging inside ChunkManager::return_chunk_list()
somewhat. Should anyone miss the former details, I can reinstate it.

Thank you,


More information about the hotspot-runtime-dev mailing list