< prev index next >

src/hotspot/share/oops/arrayKlass.cpp

Print this page
@@ -25,10 +25,11 @@
  #include "precompiled.hpp"
  #include "cds/cdsConfig.hpp"
  #include "cds/metaspaceShared.hpp"
  #include "classfile/javaClasses.hpp"
  #include "classfile/moduleEntry.hpp"
+ #include "classfile/symbolTable.hpp"
  #include "classfile/vmClasses.hpp"
  #include "classfile/vmSymbols.hpp"
  #include "gc/shared/collectedHeap.inline.hpp"
  #include "jvmtifiles/jvmti.h"
  #include "memory/metaspaceClosure.hpp"

@@ -36,10 +37,11 @@
  #include "memory/universe.hpp"
  #include "oops/arrayKlass.inline.hpp"
  #include "oops/arrayOop.hpp"
  #include "oops/instanceKlass.hpp"
  #include "oops/klass.inline.hpp"
+ #include "oops/objArrayKlass.hpp"
  #include "oops/objArrayOop.hpp"
  #include "oops/oop.inline.hpp"
  #include "runtime/handles.inline.hpp"
  
  ArrayKlass::ArrayKlass() {

@@ -103,10 +105,29 @@
    set_is_cloneable(); // All arrays are considered to be cloneable (See JLS 20.1.5)
    JFR_ONLY(INIT_ID(this);)
    log_array_class_load(this);
  }
  
+ Symbol* ArrayKlass::create_element_klass_array_name(Klass* element_klass, TRAPS) {
+   ResourceMark rm(THREAD);
+   Symbol* name = nullptr;
+   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++] = JVM_SIGNATURE_ARRAY;
+   if (element_klass->is_instance_klass()) { // it could be an array or simple type
+     new_str[idx++] = JVM_SIGNATURE_CLASS;
+   }
+   memcpy(&new_str[idx], name_str, len * sizeof(char));
+   idx += len;
+   if (element_klass->is_instance_klass()) {
+     new_str[idx++] = JVM_SIGNATURE_ENDCLASS;
+   }
+   new_str[idx++] = '\0';
+   return SymbolTable::new_symbol(new_str);
+ }
  
  // Initialization of vtables and mirror object is done separately 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, nullptr, CHECK);

@@ -138,11 +159,12 @@
        // Check if another thread beat us
        if (higher_dimension() == nullptr) {
  
          // Create multi-dim klass object and link them together
          ObjArrayKlass* ak =
-           ObjArrayKlass::allocate_objArray_klass(class_loader_data(), dim + 1, this, CHECK_NULL);
+           ObjArrayKlass::allocate_objArray_klass(class_loader_data(), dim + 1, this,
+                                                  false, CHECK_NULL);
          ak->set_lower_dimension(this);
          // use 'release' to pair with lock-free load
          release_set_higher_dimension(ak);
          assert(ak->is_objArray_klass(), "incorrect initialization of ObjArrayKlass");
        }

@@ -196,10 +218,14 @@
                                                                  /* do_zero */ true, CHECK_NULL);
    // initialization to null not necessary, area already cleared
    return o;
  }
  
+ oop ArrayKlass::component_mirror() const {
+   return java_lang_Class::component_mirror(java_mirror());
+ }
+ 
  jint ArrayKlass::compute_modifier_flags() const {
    return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC;
  }
  
  // JVMTI support
< prev index next >