From 09e8c8c64abf4178a042c79b92d7e08e54467331 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Fri, 19 Nov 2021 17:48:43 +0000 Subject: [PATCH] 8277342: vmTestbase/nsk/stress/strace/strace004.java fails with SIGSEGV in InstanceKlass::jni_id_for Reviewed-by: dholmes, hseigel --- src/hotspot/share/oops/instanceKlass.cpp | 19 ++++--------------- src/hotspot/share/oops/instanceKlass.hpp | 2 -- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp index 1e237de66ec..b4ee9c5dc0b 100644 --- a/src/hotspot/share/oops/instanceKlass.cpp +++ b/src/hotspot/share/oops/instanceKlass.cpp @@ -2061,25 +2061,14 @@ Method* InstanceKlass::lookup_method_in_all_interfaces(Symbol* name, return NULL; } -/* jni_id_for_impl for jfieldIds only */ -JNIid* InstanceKlass::jni_id_for_impl(int offset) { - MutexLocker ml(JfieldIdCreation_lock); - // Retry lookup after we got the lock - JNIid* probe = jni_ids() == NULL ? NULL : jni_ids()->find(offset); - if (probe == NULL) { - // Slow case, allocate new static field identifier - probe = new JNIid(this, offset, jni_ids()); - set_jni_ids(probe); - } - return probe; -} - - /* jni_id_for for jfieldIds only */ JNIid* InstanceKlass::jni_id_for(int offset) { + MutexLocker ml(JfieldIdCreation_lock); JNIid* probe = jni_ids() == NULL ? NULL : jni_ids()->find(offset); if (probe == NULL) { - probe = jni_id_for_impl(offset); + // Allocate new static field identifier + probe = new JNIid(this, offset, jni_ids()); + set_jni_ids(probe); } return probe; } diff --git a/src/hotspot/share/oops/instanceKlass.hpp b/src/hotspot/share/oops/instanceKlass.hpp index d55b021b370..c2ad122e92b 100644 --- a/src/hotspot/share/oops/instanceKlass.hpp +++ b/src/hotspot/share/oops/instanceKlass.hpp @@ -1199,8 +1199,6 @@ private: void initialize_impl (TRAPS); void initialize_super_interfaces (TRAPS); void eager_initialize_impl (); - /* jni_id_for_impl for jfieldID only */ - JNIid* jni_id_for_impl (int offset); void add_initialization_error(JavaThread* current, Handle exception); oop get_initialization_error(JavaThread* current);