comparison src/share/vm/oops/arrayKlass.hpp @ 0:a61af66fc99e jdk7-b24

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children 4ce7240d622c
comparison
equal deleted inserted replaced
-1:000000000000 0:a61af66fc99e
1 /*
2 * Copyright 1997-2007 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
23 */
24
25 // arrayKlass is the abstract baseclass for all array classes
26
27 class arrayKlass: public Klass {
28 friend class VMStructs;
29 private:
30 int _dimension; // This is n'th-dimensional array.
31 klassOop _higher_dimension; // Refers the (n+1)'th-dimensional array (if present).
32 klassOop _lower_dimension; // Refers the (n-1)'th-dimensional array (if present).
33 int _vtable_len; // size of vtable for this klass
34 juint _alloc_size; // allocation profiling support
35 oop _component_mirror; // component type, as a java/lang/Class
36
37 public:
38 // Testing operation
39 bool oop_is_array() const { return true; }
40
41 // Instance variables
42 int dimension() const { return _dimension; }
43 void set_dimension(int dimension) { _dimension = dimension; }
44
45 klassOop higher_dimension() const { return _higher_dimension; }
46 void set_higher_dimension(klassOop k) { oop_store_without_check((oop*) &_higher_dimension, (oop) k); }
47 oop* adr_higher_dimension() { return (oop*)&this->_higher_dimension;}
48
49 klassOop lower_dimension() const { return _lower_dimension; }
50 void set_lower_dimension(klassOop k) { oop_store_without_check((oop*) &_lower_dimension, (oop) k); }
51 oop* adr_lower_dimension() { return (oop*)&this->_lower_dimension;}
52
53 // Allocation profiling support
54 juint alloc_size() const { return _alloc_size; }
55 void set_alloc_size(juint n) { _alloc_size = n; }
56
57 // offset of first element, including any padding for the sake of alignment
58 int array_header_in_bytes() const { return layout_helper_header_size(layout_helper()); }
59 int log2_element_size() const { return layout_helper_log2_element_size(layout_helper()); }
60 // type of elements (T_OBJECT for both oop arrays and array-arrays)
61 BasicType element_type() const { return layout_helper_element_type(layout_helper()); }
62
63 oop component_mirror() const { return _component_mirror; }
64 void set_component_mirror(oop m) { oop_store((oop*) &_component_mirror, m); }
65 oop* adr_component_mirror() { return (oop*)&this->_component_mirror;}
66
67 // Compiler/Interpreter offset
68 static ByteSize component_mirror_offset() { return byte_offset_of(arrayKlass, _component_mirror); }
69
70 virtual klassOop java_super() const;//{ return SystemDictionary::object_klass(); }
71
72 // Allocation
73 // Sizes points to the first dimension of the array, subsequent dimensions
74 // are always in higher memory. The callers of these set that up.
75 virtual oop multi_allocate(int rank, jint* sizes, TRAPS);
76 objArrayOop allocate_arrayArray(int n, int length, TRAPS);
77
78 // Lookup operations
79 methodOop uncached_lookup_method(symbolOop name, symbolOop signature) const;
80
81 // Casting from klassOop
82 static arrayKlass* cast(klassOop k) {
83 Klass* kp = k->klass_part();
84 assert(kp->null_vtbl() || kp->oop_is_array(), "cast to arrayKlass");
85 return (arrayKlass*) kp;
86 }
87
88 objArrayOop compute_secondary_supers(int num_extra_slots, TRAPS);
89 bool compute_is_subtype_of(klassOop k);
90
91 // Sizing
92 static int header_size() { return oopDesc::header_size() + sizeof(arrayKlass)/HeapWordSize; }
93 int object_size(int header_size) const;
94
95 bool object_is_parsable() const { return _vtable_len > 0; }
96
97 // Java vtable
98 klassVtable* vtable() const; // return new klassVtable
99 int vtable_length() const { return _vtable_len; }
100 static int base_vtable_length() { return Universe::base_vtable_size(); }
101 void set_vtable_length(int len) { assert(len == base_vtable_length(), "bad length"); _vtable_len = len; }
102 protected:
103 inline intptr_t* start_of_vtable() const;
104
105 public:
106 // Iterators
107 void array_klasses_do(void f(klassOop k));
108 void with_array_klasses_do(void f(klassOop k));
109
110 // Shared creation method
111 static arrayKlassHandle base_create_array_klass(
112 const Klass_vtbl& vtbl,
113 int header_size, KlassHandle klass,
114 TRAPS);
115 // Return a handle.
116 static void complete_create_array_klass(arrayKlassHandle k, KlassHandle super_klass, TRAPS);
117
118 public:
119 // jvm support
120 jint compute_modifier_flags(TRAPS) const;
121
122 public:
123 // JVMTI support
124 jint jvmti_class_status() const;
125
126 #ifndef PRODUCT
127 public:
128 // Printing
129 void oop_print_on(oop obj, outputStream* st);
130 #endif
131 public:
132 // Verification
133 void oop_verify_on(oop obj, outputStream* st);
134 };