RFR: 8350334: Add final keywords to FFM methods

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Feb 21 15:02:12 UTC 2025


On Wed, 19 Feb 2025 14:23:04 GMT, Per Minborg <pminborg at openjdk.org> wrote:

> This PR proposes to add the `final` keyword to some classes and methods in order to assist compiler devirtualization (e.g. in Graal native image).
> 
> Passes `make test TEST=jdk_foreign`

I have no objection with this -- but I do think that before we embark on such changes we should somehow have some evidence that making such changes would be beneficial performance-wise. In terms of making the code clearer, I guess I'd prefer to see `final` only where it really matters -- for instance, we in `MemorySessionImpl::checkValidStateRaw` -- because in that case we truly care for the impl not to be split across multiple implementations. In other cases, IMHO adding `final` everywhere just makes refactoring harder -- so I'm a bit on the fence.

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

PR Review: https://git.openjdk.org/jdk/pull/23696#pullrequestreview-2633312389


More information about the core-libs-dev mailing list