< prev index next >

src/hotspot/share/oops/arrayKlass.cpp

Print this page

        

*** 22,39 **** --- 22,41 ---- * */ #include "precompiled.hpp" #include "classfile/javaClasses.hpp" + #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "gc/shared/collectedHeap.inline.hpp" #include "jvmtifiles/jvmti.h" #include "memory/metaspaceClosure.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" #include "oops/arrayKlass.hpp" + #include "oops/objArrayKlass.hpp" #include "oops/arrayOop.hpp" #include "oops/instanceKlass.hpp" #include "oops/objArrayOop.hpp" #include "oops/oop.inline.hpp" #include "runtime/handles.inline.hpp"
*** 94,103 **** --- 96,146 ---- set_layout_helper(Klass::_lh_neutral_value); set_is_cloneable(); // All arrays are considered to be cloneable (See JLS 20.1.5) JFR_ONLY(INIT_ID(this);) } + Symbol* ArrayKlass::create_element_klass_array_name(Klass* element_klass, TRAPS) { + Symbol* name = NULL; + if (!element_klass->is_instance_klass() || + (name = InstanceKlass::cast(element_klass)->array_name()) == NULL) { + + ResourceMark rm(THREAD); + char *name_str = element_klass->name()->as_C_string(); + int len = element_klass->name()->utf8_length(); + char *new_str = NEW_RESOURCE_ARRAY(char, len + 4); + int idx = 0; + new_str[idx++] = '['; + if (element_klass->is_instance_klass()) { // it could be an array or simple type + // Temporary hack, for arrays of value types, this code should be removed + // once value types have their own array types + // With Q-descriptors, the code below needs to be reworked. + // It is still correct today because the only kind of value array supported + // is array of null-free values which map to the Q-signature. + // As soon as both arrays of null-free values and arrays of nullable values + // are supported, this code has to be rewritten to consider the kind of the + // array instead of the kind of the elements. + if (element_klass->is_value()) { + new_str[idx++] = 'Q'; + } else { + new_str[idx++] = 'L'; + } + } + memcpy(&new_str[idx], name_str, len * sizeof(char)); + idx += len; + if (element_klass->is_instance_klass()) { + new_str[idx++] = ';'; + } + new_str[idx++] = '\0'; + name = SymbolTable::new_permanent_symbol(new_str, CHECK_NULL); + if (element_klass->is_instance_klass() || element_klass->is_value()) { + InstanceKlass* ik = InstanceKlass::cast(element_klass); + ik->set_array_name(name); + } + } + + return name; + } // Initialization of vtables and mirror object is done separatly from base_create_array_klass, // since a GC can happen. At this point all instance variables of the ArrayKlass must be setup. void ArrayKlass::complete_create_array_klass(ArrayKlass* k, Klass* super_klass, ModuleEntry* module_entry, TRAPS) { k->initialize_supers(super_klass, NULL, CHECK);
< prev index next >