< prev index next >

src/hotspot/share/oops/arrayKlass.cpp

Print this page
@@ -23,18 +23,20 @@
   */
  
  #include "precompiled.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"
  #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/klass.inline.hpp"
  #include "oops/objArrayOop.hpp"
  #include "oops/oop.inline.hpp"

@@ -96,10 +98,33 @@
    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, bool qdesc, TRAPS) {
+   ResourceMark rm(THREAD);
+   Symbol* name = NULL;
+   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
+     if (qdesc) {
+       new_str[idx++] = JVM_SIGNATURE_PRIMITIVE_OBJECT;
+     } else {
+       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, NULL, CHECK);

@@ -133,10 +158,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 >