< prev index next >

src/hotspot/share/oops/arrayKlass.cpp

Print this page

        

*** 23,40 **** --- 23,42 ---- */ #include "precompiled.hpp" #include "classfile/javaClasses.hpp" #include "classfile/moduleEntry.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"
*** 95,104 **** --- 97,139 ---- 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(bool is_qtype, Klass* element_klass, TRAPS) { + Symbol* name = NULL; + if (!element_klass->is_instance_klass() || is_qtype || + (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 + if (is_qtype) { + 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); + if (element_klass->is_instance_klass() && (!is_qtype)) { + InstanceKlass* ik = InstanceKlass::cast(element_klass); + ik->set_array_name(name); // CMH: only cache and deref array_name for L-type...missing for Q-type + } + } + + 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);
*** 124,159 **** } objArrayOop ArrayKlass::allocate_arrayArray(int n, int length, TRAPS) { check_array_allocation_length(length, arrayOopDesc::max_array_length(T_ARRAY), CHECK_0); int size = objArrayOopDesc::object_size(length); ! Klass* k = array_klass(n+dimension(), CHECK_0); ArrayKlass* ak = ArrayKlass::cast(k); objArrayOop o = (objArrayOop)Universe::heap()->array_allocate(ak, size, length, /* do_zero */ true, CHECK_0); // initialization to NULL not necessary, area already cleared return o; } - void ArrayKlass::array_klasses_do(void f(Klass* k, TRAPS), TRAPS) { - Klass* k = this; - // Iterate over this array klass and all higher dimensions - while (k != NULL) { - f(k, CHECK); - k = ArrayKlass::cast(k)->higher_dimension(); - } - } - void ArrayKlass::array_klasses_do(void f(Klass* k)) { Klass* k = this; // Iterate over this array klass and all higher dimensions while (k != NULL) { f(k); k = ArrayKlass::cast(k)->higher_dimension(); } } // JVM support jint ArrayKlass::compute_modifier_flags(TRAPS) const { return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC; } --- 159,189 ---- } objArrayOop ArrayKlass::allocate_arrayArray(int n, int length, TRAPS) { check_array_allocation_length(length, arrayOopDesc::max_array_length(T_ARRAY), CHECK_0); int size = objArrayOopDesc::object_size(length); ! Klass* k = array_klass(FieldType::get_array_storage_properties(name()), n+dimension(), CHECK_0); ArrayKlass* ak = ArrayKlass::cast(k); objArrayOop o = (objArrayOop)Universe::heap()->array_allocate(ak, size, length, /* do_zero */ true, CHECK_0); // initialization to NULL not necessary, area already cleared return o; } void ArrayKlass::array_klasses_do(void f(Klass* k)) { Klass* k = this; // Iterate over this array klass and all higher dimensions while (k != NULL) { f(k); k = ArrayKlass::cast(k)->higher_dimension(); } } + oop ArrayKlass::component_mirror() const { + return java_lang_Class::component_mirror(java_mirror()); + } + // JVM support jint ArrayKlass::compute_modifier_flags(TRAPS) const { return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC; }
< prev index next >