RFR: 8338526: Don't store abstract and interface Klasses in class metaspace

Thomas Stuefe stuefe at openjdk.org
Sat Aug 24 10:56:05 UTC 2024


On Fri, 23 Aug 2024 19:26:46 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> Yes, is_in_klass_space was just to direct where to deallocate the metaspace pointer. In your patch isn't the contains metaspace call still very slow? Or I suppose for class space, it's not because it's a fixed space. But it's not an inlined call at all because I had to search in cpp files for the range check.
> 
> * const bool is_class = Metaspace::contains_in_class_space(ptr);
> 
> I sort of think it might be better for the outside runtime code to control this and the metaspace call assert if its wrong.

No, I think my way is better and it will be needed anyway for TinyCP/Lilliput. We only need to do two address comparisons, that should be simple and fast. 

I opened a PR to separate the change, and in that PR I also inline the check. 

https://github.com/openjdk/jdk/pull/20701

I don't think the costs for two address comparisons matter, not with the comparatively few deallocations that happen (few hundreds or few thousand). If deallocate is hot, we are using metaspace wrong.

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

PR Comment: https://git.openjdk.org/jdk/pull/19157#issuecomment-2308352940


More information about the core-libs-dev mailing list