< 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);

*** 134,11 ***
      RecursiveLocker rl(MultiArray_lock, THREAD);
  
      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);
        // use 'release' to pair with lock-free load
        release_set_higher_dimension(ak);
        assert(ak->lower_dimension() == this, "lower dimension mismatch");
      }
    }
--- 155,11 ---
      RecursiveLocker rl(MultiArray_lock, THREAD);
  
      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, false, CHECK_NULL);
        // use 'release' to pair with lock-free load
        release_set_higher_dimension(ak);
        assert(ak->lower_dimension() == this, "lower dimension mismatch");
      }
    }

*** 192,12 ***
                                                                  /* do_zero */ true, CHECK_NULL);
    // initialization to null not necessary, area already cleared
    return o;
  }
  
  jint ArrayKlass::compute_modifier_flags() const {
!   return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC;
  }
  
  // JVMTI support
  
  jint ArrayKlass::jvmti_class_status() const {
--- 213,19 ---
                                                                  /* 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 {
!   int identity_flag = (Arguments::enable_preview()) ? JVM_ACC_IDENTITY : 0;
+ 
+   return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC
+                     | identity_flag;
  }
  
  // JVMTI support
  
  jint ArrayKlass::jvmti_class_status() const {
< prev index next >