RFR: 8367142: Simplify java mirror handling in JNI methods [v2]

Coleen Phillimore coleenp at openjdk.org
Wed Sep 10 11:44:29 UTC 2025


On Wed, 10 Sep 2025 09:39:28 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> There are 54 cases where we call as_Klass(JNIHandles::resolve_non_null(x)), so I think it would be nice to have a way to write less code.

> I think you should deal with that by adding a helper function inside jni.cpp instead of extending the *Klass functions to take a jobject.

I agree with this.  I don't think you should move any more jobjects into the runtime code.  The jobjects should stop at jni/jvm. They don't everywhere but that's something that over time we should fix. For instance, the ci creates jobjects but it should use OopHandles instead, except per-thread OopStorage isn't implemented yet.

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

PR Comment: https://git.openjdk.org/jdk/pull/27158#issuecomment-3274573970


More information about the serviceability-dev mailing list