< prev index next >

src/hotspot/share/oops/arrayKlass.cpp

Print this page




  77   // There are no methods in an array klass but the super class (Object) has some
  78   assert(super(), "super klass must be present");
  79   // Always ignore overpass methods in superclasses, although technically the
  80   // super klass of an array, (j.l.Object) should not have
  81   // any overpass methods present.
  82   return super()->uncached_lookup_method(name, signature, Klass::skip_overpass);
  83 }
  84 
  85 ArrayKlass::ArrayKlass(Symbol* name) :
  86   _dimension(1),
  87   _higher_dimension(NULL),
  88   _lower_dimension(NULL) {
  89     // Arrays don't add any new methods, so their vtable is the same size as
  90     // the vtable of klass Object.
  91     set_vtable_length(Universe::base_vtable_size());
  92     set_name(name);
  93     set_super(Universe::is_bootstrapping() ? (Klass*)NULL : SystemDictionary::Object_klass());
  94     set_layout_helper(Klass::_lh_neutral_value);
  95     set_is_cloneable(); // All arrays are considered to be cloneable (See JLS 20.1.5)
  96     TRACE_INIT_ID(this);

  97 }
  98 
  99 Symbol* ArrayKlass::create_element_klass_array_name(Klass* element_klass, TRAPS) {
 100   Symbol* name = NULL;
 101   if (!element_klass->is_instance_klass() ||
 102       (name = InstanceKlass::cast(element_klass)->array_name()) == NULL) {
 103 
 104     ResourceMark rm(THREAD);
 105     char *name_str = element_klass->name()->as_C_string();
 106     int len = element_klass->name()->utf8_length();
 107     char *new_str = NEW_RESOURCE_ARRAY(char, len + 4);
 108     int idx = 0;
 109     new_str[idx++] = '[';
 110     if (element_klass->is_instance_klass()) { // it could be an array or simple type
 111       // Temporary hack, for arrays of value types, this code should be removed
 112       // once value types have their own array types
 113       new_str[idx++] = 'L';
 114     }
 115     memcpy(&new_str[idx], name_str, len * sizeof(char));
 116     idx += len;




  77   // There are no methods in an array klass but the super class (Object) has some
  78   assert(super(), "super klass must be present");
  79   // Always ignore overpass methods in superclasses, although technically the
  80   // super klass of an array, (j.l.Object) should not have
  81   // any overpass methods present.
  82   return super()->uncached_lookup_method(name, signature, Klass::skip_overpass);
  83 }
  84 
  85 ArrayKlass::ArrayKlass(Symbol* name) :
  86   _dimension(1),
  87   _higher_dimension(NULL),
  88   _lower_dimension(NULL) {
  89     // Arrays don't add any new methods, so their vtable is the same size as
  90     // the vtable of klass Object.
  91     set_vtable_length(Universe::base_vtable_size());
  92     set_name(name);
  93     set_super(Universe::is_bootstrapping() ? (Klass*)NULL : SystemDictionary::Object_klass());
  94     set_layout_helper(Klass::_lh_neutral_value);
  95     set_is_cloneable(); // All arrays are considered to be cloneable (See JLS 20.1.5)
  96     TRACE_INIT_ID(this);
  97     assert(!ptr_is_value_type(this), "ArrayKlass encoded as value type");
  98 }
  99 
 100 Symbol* ArrayKlass::create_element_klass_array_name(Klass* element_klass, TRAPS) {
 101   Symbol* name = NULL;
 102   if (!element_klass->is_instance_klass() ||
 103       (name = InstanceKlass::cast(element_klass)->array_name()) == NULL) {
 104 
 105     ResourceMark rm(THREAD);
 106     char *name_str = element_klass->name()->as_C_string();
 107     int len = element_klass->name()->utf8_length();
 108     char *new_str = NEW_RESOURCE_ARRAY(char, len + 4);
 109     int idx = 0;
 110     new_str[idx++] = '[';
 111     if (element_klass->is_instance_klass()) { // it could be an array or simple type
 112       // Temporary hack, for arrays of value types, this code should be removed
 113       // once value types have their own array types
 114       new_str[idx++] = 'L';
 115     }
 116     memcpy(&new_str[idx], name_str, len * sizeof(char));
 117     idx += len;


< prev index next >