8341788: Fix ExceptionOccurred in hotspot

Reviewed-by: dholmes
This commit is contained in:
Justin Lu 2024-10-30 21:49:26 +00:00
parent 9a9ac1d005
commit 7461dfe9c6
7 changed files with 13 additions and 13 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -133,7 +133,7 @@ static void log_and_throw(jvmtiError error, TRAPS) {
static void check_exception_and_log(JNIEnv* env, TRAPS) {
assert(env != nullptr, "invariant");
if (env->ExceptionOccurred()) {
if (env->ExceptionCheck()) {
// array index out of bound
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(THREAD));
ThreadInVMfromNative tvmfn(THREAD);

View File

@ -1464,15 +1464,15 @@ JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class))
ThreadToNativeFromVM ttnfv(thread);
int status = env->RegisterNatives(MHN_class, MHN_methods, sizeof(MHN_methods)/sizeof(JNINativeMethod));
guarantee(status == JNI_OK && !env->ExceptionOccurred(),
guarantee(status == JNI_OK && !env->ExceptionCheck(),
"register java.lang.invoke.MethodHandleNative natives");
status = env->RegisterNatives(MH_class, MH_methods, sizeof(MH_methods)/sizeof(JNINativeMethod));
guarantee(status == JNI_OK && !env->ExceptionOccurred(),
guarantee(status == JNI_OK && !env->ExceptionCheck(),
"register java.lang.invoke.MethodHandle natives");
status = env->RegisterNatives(VH_class, VH_methods, sizeof(VH_methods)/sizeof(JNINativeMethod));
guarantee(status == JNI_OK && !env->ExceptionOccurred(),
guarantee(status == JNI_OK && !env->ExceptionCheck(),
"register java.lang.invoke.VarHandle natives");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -116,6 +116,6 @@ static JNINativeMethod NEP_methods[] = {
JNI_ENTRY(void, JVM_RegisterNativeEntryPointMethods(JNIEnv *env, jclass NEP_class))
ThreadToNativeFromVM ttnfv(thread);
int status = env->RegisterNatives(NEP_class, NEP_methods, sizeof(NEP_methods)/sizeof(JNINativeMethod));
guarantee(status == JNI_OK && !env->ExceptionOccurred(),
guarantee(status == JNI_OK && !env->ExceptionCheck(),
"register jdk.internal.foreign.abi.NativeEntryPoint natives");
JNI_END

View File

@ -669,7 +669,7 @@ static jclass Unsafe_DefineClass_impl(JNIEnv *env, jstring name, jbyteArray data
}
env->GetByteArrayRegion(data, offset, length, body);
if (env->ExceptionOccurred()) {
if (env->ExceptionCheck()) {
goto free_body;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -187,6 +187,6 @@ static JNINativeMethod UL_methods[] = {
JNI_ENTRY(void, JVM_RegisterUpcallLinkerMethods(JNIEnv *env, jclass UL_class))
ThreadToNativeFromVM ttnfv(thread);
int status = env->RegisterNatives(UL_class, UL_methods, sizeof(UL_methods)/sizeof(JNINativeMethod));
guarantee(status == JNI_OK && !env->ExceptionOccurred(),
guarantee(status == JNI_OK && !env->ExceptionCheck(),
"register jdk.internal.foreign.abi.UpcallLinker natives");
JNI_END

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -50,7 +50,7 @@ static JNINativeMethod UH_methods[] = {
*/
JVM_LEAF(void, JVM_RegisterUpcallHandlerMethods(JNIEnv *env, jclass UH_class))
int status = env->RegisterNatives(UH_class, UH_methods, sizeof(UH_methods)/sizeof(JNINativeMethod));
guarantee(status == JNI_OK && !env->ExceptionOccurred(),
guarantee(status == JNI_OK && !env->ExceptionCheck(),
"register jdk.internal.foreign.abi.UpcallStubs natives");
JVM_END

View File

@ -428,5 +428,5 @@ void CONT_RegisterNativeMethods(JNIEnv *env, jclass cls) {
ThreadToNativeFromVM trans(thread);
int status = env->RegisterNatives(cls, CONT_methods, sizeof(CONT_methods)/sizeof(JNINativeMethod));
guarantee(status == JNI_OK, "register jdk.internal.vm.Continuation natives");
guarantee(!env->ExceptionOccurred(), "register jdk.internal.vm.Continuation natives");
guarantee(!env->ExceptionCheck(), "register jdk.internal.vm.Continuation natives");
}