RFR: 8338929: Make Metaspace::deallocate space-aware

Thomas Stuefe stuefe at openjdk.org
Mon Aug 26 13:03:04 UTC 2024


On Mon, 26 Aug 2024 12:25:34 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> For ucoming Lilliput changes, as well as to simplify [JDK-8338526](https://bugs.openjdk.org/browse/JDK-8338526), we should make Metaspace::deallocate space-aware (as in, instead of having to tell it where the pointed-to block resides, it should know it on its own). 
>> 
>> As of now, callers need to tell the function of the deallocated block is in class space or in non-class metaspace. That is unnecessary and won't work for TinyCP. The deallocation function can do this better on itself by doing a range check on the class space range.
>
> src/hotspot/share/memory/metaspace.hpp line 134:
> 
>> 132:   // Returns true if pointer points into one of the metaspace regions, or
>> 133:   // into the class space.
>> 134:   static bool is_in_shared_metaspace(const void* ptr);
> 
> This comment doesn't make sense to me.  Isn't this just pointing to the CDS region, which includes class and non-class data?  But is this in the range of class space?

You are absolutely right, the comment is wrong. Sorry for the confusion. This is just the CDS portion.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20701#discussion_r1731207097


More information about the hotspot-runtime-dev mailing list