< prev index next >

src/share/vm/oops/arrayKlass.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  68 Klass* ArrayKlass::find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const {
  69   // There are no fields in an array klass but look to the super class (Object)
  70   assert(super(), "super klass must be present");
  71   return super()->find_field(name, sig, fd);
  72 }
  73 
  74 Method* ArrayKlass::uncached_lookup_method(const Symbol* name,
  75                                            const Symbol* signature,
  76                                            OverpassLookupMode overpass_mode) const {
  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   _vtable_len(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 
 100 // Initialization of vtables and mirror object is done separatly from base_create_array_klass,
 101 // since a GC can happen. At this point all instance variables of the ArrayKlass must be setup.
 102 void ArrayKlass::complete_create_array_klass(ArrayKlass* k, KlassHandle super_klass, TRAPS) {
 103   ResourceMark rm(THREAD);
 104   k->initialize_supers(super_klass(), CHECK);
 105   k->vtable()->initialize_vtable(false, CHECK);
 106   java_lang_Class::create_mirror(k, Handle(THREAD, k->class_loader()), Handle(NULL), CHECK);
 107 }
 108 
 109 GrowableArray<Klass*>* ArrayKlass::compute_secondary_supers(int num_extra_slots) {
 110   // interfaces = { cloneable_klass, serializable_klass };
 111   assert(num_extra_slots == 0, "sanity of primitive array type");


   1 /*
   2  * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  68 Klass* ArrayKlass::find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const {
  69   // There are no fields in an array klass but look to the super class (Object)
  70   assert(super(), "super klass must be present");
  71   return super()->find_field(name, sig, fd);
  72 }
  73 
  74 Method* ArrayKlass::uncached_lookup_method(const Symbol* name,
  75                                            const Symbol* signature,
  76                                            OverpassLookupMode overpass_mode) const {
  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 
 100 // Initialization of vtables and mirror object is done separatly from base_create_array_klass,
 101 // since a GC can happen. At this point all instance variables of the ArrayKlass must be setup.
 102 void ArrayKlass::complete_create_array_klass(ArrayKlass* k, KlassHandle super_klass, TRAPS) {
 103   ResourceMark rm(THREAD);
 104   k->initialize_supers(super_klass(), CHECK);
 105   k->vtable()->initialize_vtable(false, CHECK);
 106   java_lang_Class::create_mirror(k, Handle(THREAD, k->class_loader()), Handle(NULL), CHECK);
 107 }
 108 
 109 GrowableArray<Klass*>* ArrayKlass::compute_secondary_supers(int num_extra_slots) {
 110   // interfaces = { cloneable_klass, serializable_klass };
 111   assert(num_extra_slots == 0, "sanity of primitive array type");


< prev index next >