RFR: 8251158: Implementation of JEP 387: Elastic Metaspace [v11]

Thomas Stuefe stuefe at openjdk.java.net
Sun Oct 11 07:08:13 UTC 2020


On Tue, 6 Oct 2020 13:53:34 GMT, Richard Reingruber <rrich at openjdk.org> wrote:

>> The idea is good, but at the moment _next_in_vs==NULL marks the last chunk within one root chunk area, and is used e.g.
>> as loop stop. I would have to make Metachunk aware of the root chunk it lives in, which I rather avoid.
>
> Ok.

Thought about this a bit more, your proposal does not work.

Metachunk are stored in C-Heap and are physically separated from the chunks they represent. _next_in_vs points to the
MetaChunk header **representing** the chunk following the current chunk. Sort of like this:

+---------+                       +---------+                       +---------+
|MetaChunk| <--next/prev_in_vs--> |MetaChunk| <--next/prev_in_vs--> |MetaChunk|
+---------+                       +---------+                       +---------+
    |                                 |                                  |
   base                              base                               base
    |                                 /                                  |
   /        --------------------------                                  /
  /        /          --------------------------------------------------
 |         |         /
 v         v         v
+---------+---------+---------+---------+
|  chunk  |  chunk  |  chunk  |  chunk  |
+---------+---------+---------+---------+

Given a pointer to the start of a chunk (or, payload), there is no way to get to the MetaChunk representing it.
Therefore Metachunk::end() is no help. Therefore I need to store _prev_in_vs and _next_in_vs in the MetaChunk Header.

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

PR: https://git.openjdk.java.net/jdk/pull/336



More information about the hotspot-gc-dev mailing list