RFR: 8338929: Make Metaspace::deallocate space-aware [v2]

Coleen Phillimore coleenp at openjdk.org
Mon Aug 26 14:56:06 UTC 2024


On Mon, 26 Aug 2024 14:15:28 GMT, Thomas Stuefe <stuefe 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.
>
> Thomas Stuefe has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
> 
>  - improve comments
>  - Merge branch 'master' into make-deallocate-space-aware
>  - copyrights
>  - fast is-in-class-space check

Nit comment change and question for my own clarification, but this looks fine.

src/hotspot/share/memory/metaspace.hpp line 145:

> 143:   static inline bool is_in_class_space(const void* ptr) {
> 144:     return ptr < _class_space_end && ptr >= _class_space_start;
> 145:   }

So this does _not_ include the Klasses in the CDS archive, it really is only useful for deallocation.  I don't need this to be a comment update, just making sure I follow.

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

Marked as reviewed by coleenp (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/20701#pullrequestreview-2260883907
PR Review Comment: https://git.openjdk.org/jdk/pull/20701#discussion_r1731371161


More information about the hotspot-runtime-dev mailing list