JfrJavaSupport::new_string does not check if the result from java_lang_String::create_oop_from_str is nullptr or if there's a pending exception (which should be the same thing, nullptr = OOME) before moving on to allocating a local handle jni handle for the result. Inside the local jni handle allocation, there is a check in an assert to see if the obj we're creating a handle for is in the heap, which should always be false for nullptr.
We should revise this by adding an exception check to the result by using a CHECK variant instead of just passing THREAD. This way we don't try to allocate a local jni handle for a nullptr result.
const oop result = java_lang_String::create_oop_from_str(c_str, THREAD);
const oop result = java_lang_String::create_oop_from_str(c_str, CHECK_NULL);
All callers of java_lang_String::create_oop_from_str use CHECK to see if there's a pending exception, so all should be good.
We should revise this by adding an exception check to the result by using a CHECK variant instead of just passing THREAD. This way we don't try to allocate a local jni handle for a nullptr result.
const oop result = java_lang_String::create_oop_from_str(c_str, THREAD);
const oop result = java_lang_String::create_oop_from_str(c_str, CHECK_NULL);
All callers of java_lang_String::create_oop_from_str use CHECK to see if there's a pending exception, so all should be good.
- links to
-
Review(master)
openjdk/jdk/30118