1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/oops/arrayKlass.hpp Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,134 @@ 1.4 +/* 1.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.24 + * have any questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +// arrayKlass is the abstract baseclass for all array classes 1.29 + 1.30 +class arrayKlass: public Klass { 1.31 + friend class VMStructs; 1.32 + private: 1.33 + int _dimension; // This is n'th-dimensional array. 1.34 + klassOop _higher_dimension; // Refers the (n+1)'th-dimensional array (if present). 1.35 + klassOop _lower_dimension; // Refers the (n-1)'th-dimensional array (if present). 1.36 + int _vtable_len; // size of vtable for this klass 1.37 + juint _alloc_size; // allocation profiling support 1.38 + oop _component_mirror; // component type, as a java/lang/Class 1.39 + 1.40 + public: 1.41 + // Testing operation 1.42 + bool oop_is_array() const { return true; } 1.43 + 1.44 + // Instance variables 1.45 + int dimension() const { return _dimension; } 1.46 + void set_dimension(int dimension) { _dimension = dimension; } 1.47 + 1.48 + klassOop higher_dimension() const { return _higher_dimension; } 1.49 + void set_higher_dimension(klassOop k) { oop_store_without_check((oop*) &_higher_dimension, (oop) k); } 1.50 + oop* adr_higher_dimension() { return (oop*)&this->_higher_dimension;} 1.51 + 1.52 + klassOop lower_dimension() const { return _lower_dimension; } 1.53 + void set_lower_dimension(klassOop k) { oop_store_without_check((oop*) &_lower_dimension, (oop) k); } 1.54 + oop* adr_lower_dimension() { return (oop*)&this->_lower_dimension;} 1.55 + 1.56 + // Allocation profiling support 1.57 + juint alloc_size() const { return _alloc_size; } 1.58 + void set_alloc_size(juint n) { _alloc_size = n; } 1.59 + 1.60 + // offset of first element, including any padding for the sake of alignment 1.61 + int array_header_in_bytes() const { return layout_helper_header_size(layout_helper()); } 1.62 + int log2_element_size() const { return layout_helper_log2_element_size(layout_helper()); } 1.63 + // type of elements (T_OBJECT for both oop arrays and array-arrays) 1.64 + BasicType element_type() const { return layout_helper_element_type(layout_helper()); } 1.65 + 1.66 + oop component_mirror() const { return _component_mirror; } 1.67 + void set_component_mirror(oop m) { oop_store((oop*) &_component_mirror, m); } 1.68 + oop* adr_component_mirror() { return (oop*)&this->_component_mirror;} 1.69 + 1.70 + // Compiler/Interpreter offset 1.71 + static ByteSize component_mirror_offset() { return byte_offset_of(arrayKlass, _component_mirror); } 1.72 + 1.73 + virtual klassOop java_super() const;//{ return SystemDictionary::object_klass(); } 1.74 + 1.75 + // Allocation 1.76 + // Sizes points to the first dimension of the array, subsequent dimensions 1.77 + // are always in higher memory. The callers of these set that up. 1.78 + virtual oop multi_allocate(int rank, jint* sizes, TRAPS); 1.79 + objArrayOop allocate_arrayArray(int n, int length, TRAPS); 1.80 + 1.81 + // Lookup operations 1.82 + methodOop uncached_lookup_method(symbolOop name, symbolOop signature) const; 1.83 + 1.84 + // Casting from klassOop 1.85 + static arrayKlass* cast(klassOop k) { 1.86 + Klass* kp = k->klass_part(); 1.87 + assert(kp->null_vtbl() || kp->oop_is_array(), "cast to arrayKlass"); 1.88 + return (arrayKlass*) kp; 1.89 + } 1.90 + 1.91 + objArrayOop compute_secondary_supers(int num_extra_slots, TRAPS); 1.92 + bool compute_is_subtype_of(klassOop k); 1.93 + 1.94 + // Sizing 1.95 + static int header_size() { return oopDesc::header_size() + sizeof(arrayKlass)/HeapWordSize; } 1.96 + int object_size(int header_size) const; 1.97 + 1.98 + bool object_is_parsable() const { return _vtable_len > 0; } 1.99 + 1.100 + // Java vtable 1.101 + klassVtable* vtable() const; // return new klassVtable 1.102 + int vtable_length() const { return _vtable_len; } 1.103 + static int base_vtable_length() { return Universe::base_vtable_size(); } 1.104 + void set_vtable_length(int len) { assert(len == base_vtable_length(), "bad length"); _vtable_len = len; } 1.105 + protected: 1.106 + inline intptr_t* start_of_vtable() const; 1.107 + 1.108 + public: 1.109 + // Iterators 1.110 + void array_klasses_do(void f(klassOop k)); 1.111 + void with_array_klasses_do(void f(klassOop k)); 1.112 + 1.113 + // Shared creation method 1.114 + static arrayKlassHandle base_create_array_klass( 1.115 + const Klass_vtbl& vtbl, 1.116 + int header_size, KlassHandle klass, 1.117 + TRAPS); 1.118 + // Return a handle. 1.119 + static void complete_create_array_klass(arrayKlassHandle k, KlassHandle super_klass, TRAPS); 1.120 + 1.121 + public: 1.122 + // jvm support 1.123 + jint compute_modifier_flags(TRAPS) const; 1.124 + 1.125 + public: 1.126 + // JVMTI support 1.127 + jint jvmti_class_status() const; 1.128 + 1.129 +#ifndef PRODUCT 1.130 + public: 1.131 + // Printing 1.132 + void oop_print_on(oop obj, outputStream* st); 1.133 +#endif 1.134 + public: 1.135 + // Verification 1.136 + void oop_verify_on(oop obj, outputStream* st); 1.137 +};