RFR: 8341788: Fix ExceptionOccurred in hotspot
David Holmes
dholmes at openjdk.org
Mon Oct 28 03:16:31 UTC 2024
On Fri, 25 Oct 2024 21:51:53 GMT, Justin Lu <jlu at openjdk.org> wrote:
> A trivial JNI refactoring in Hotspot to use `ExceptionCheck()` over `ExceptionOccurred()` when the usage is treating the return value as a boolean. This is part of the bigger umbrella issue: [JDK-8341542](https://bugs.openjdk.org/browse/JDK-8341542).
>
>
>
>> ExceptionCheck
>> We introduce a convenience function to check for pending exceptions without creating a local reference to the exception object.
>>
>> jboolean ExceptionCheck(JNIEnv *env);
>>
>> Returns JNI_TRUE when there is a pending exception; otherwise, returns JNI_FALSE.
@justin-curtis-lu you have missed a large number of usages:
./share/prims/nativeEntryPoint.cpp: guarantee(status == JNI_OK && !env->ExceptionOccurred(),
./share/prims/methodHandles.cpp: guarantee(status == JNI_OK && !env->ExceptionOccurred(),
./share/prims/methodHandles.cpp: guarantee(status == JNI_OK && !env->ExceptionOccurred(),
./share/prims/methodHandles.cpp: guarantee(status == JNI_OK && !env->ExceptionOccurred(),
./share/prims/upcallLinker.cpp: guarantee(status == JNI_OK && !env->ExceptionOccurred(),
./share/prims/unsafe.cpp: if (env->ExceptionOccurred()) {
./share/prims/upcallStubs.cpp: guarantee(status == JNI_OK && !env->ExceptionOccurred(),
./share/runtime/continuation.cpp: guarantee(!env->ExceptionOccurred(), "register jdk.internal.vm.Continuation natives");
Thanks
-------------
Changes requested by dholmes (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/21724#pullrequestreview-2397848145
More information about the serviceability-dev
mailing list