diff -r 85bb1e6db5cb src/share/vm/classfile/javaClasses.cpp --- a/src/share/vm/classfile/javaClasses.cpp Fri Mar 11 17:02:04 2016 +0100 +++ b/src/share/vm/classfile/javaClasses.cpp Sat Mar 12 01:01:22 2016 +0300 @@ -931,6 +931,16 @@ return java_class->obj_field(_class_loader_offset); } +oop java_lang_Class::name(InstanceKlass* java_class, TRAPS) { + assert(_name_offset != 0, "must be set"); + oop o = java_class->java_mirror()->obj_field(_name_offset); + if (o == NULL) { + o = StringTable::intern(java_class->external_name(), THREAD); + java_class->java_mirror()->obj_field_put(_name_offset, o); + } + return o; +} + oop java_lang_Class::create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS) { // This should be improved by adding a field at the Java level or by // introducing a new VM klass (see comment in ClassFileParser) @@ -1112,6 +1122,10 @@ k, vmSymbols::classLoader_name(), vmSymbols::classloader_signature()); + compute_offset(_name_offset, + k, vmSymbols::name_name(), + vmSymbols::string_signature()); + compute_offset(_component_mirror_offset, k, vmSymbols::componentType_name(), vmSymbols::class_signature()); @@ -2107,8 +2121,7 @@ // Fill in class name ResourceMark rm(THREAD); - const char* str = holder->external_name(); - oop classname = StringTable::intern((char*) str, CHECK); + oop classname = java_lang_Class::name(holder, THREAD); java_lang_StackTraceElement::set_declaringClass(element(), classname); // The method can be NULL if the requested class version is gone @@ -3486,6 +3499,7 @@ int java_lang_Class::_oop_size_offset; int java_lang_Class::_static_oop_field_count_offset; int java_lang_Class::_class_loader_offset; +int java_lang_Class::_name_offset; int java_lang_Class::_protection_domain_offset; int java_lang_Class::_component_mirror_offset; int java_lang_Class::_init_lock_offset; diff -r 85bb1e6db5cb src/share/vm/classfile/javaClasses.hpp --- a/src/share/vm/classfile/javaClasses.hpp Fri Mar 11 17:02:04 2016 +0100 +++ b/src/share/vm/classfile/javaClasses.hpp Sat Mar 12 01:01:22 2016 +0300 @@ -210,6 +210,7 @@ static int _init_lock_offset; static int _signers_offset; static int _class_loader_offset; + static int _name_offset; static int _component_mirror_offset; static bool offsets_computed; @@ -267,6 +268,7 @@ static void set_signers(oop java_class, objArrayOop signers); static oop class_loader(oop java_class); + static oop name(InstanceKlass* java_class, TRAPS); static int oop_size(oop java_class); static void set_oop_size(oop java_class, int size);