annotate src/share/vm/oops/objArrayKlass.hpp @ 29:d5fc211aea19

6633953: type2aelembytes{T_ADDRESS} should be 8 bytes in 64 bit VM Summary: T_ADDRESS size is defined as 'int' size (4 bytes) but C2 use it for raw pointers and as memory type for StoreP and LoadP nodes. Reviewed-by: jrose
author kvn
date Mon, 25 Feb 2008 15:05:44 -0800
parents a61af66fc99e
children ba764ed4b6f2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 // objArrayKlass is the klass for objArrays
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 class objArrayKlass : public arrayKlass {
a61af66fc99e Initial load
duke
parents:
diff changeset
28 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
29 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
30 klassOop _element_klass; // The klass of the elements of this array type
a61af66fc99e Initial load
duke
parents:
diff changeset
31 klassOop _bottom_klass; // The one-dimensional type (instanceKlass or typeArrayKlass)
a61af66fc99e Initial load
duke
parents:
diff changeset
32 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // Instance variables
a61af66fc99e Initial load
duke
parents:
diff changeset
34 klassOop element_klass() const { return _element_klass; }
a61af66fc99e Initial load
duke
parents:
diff changeset
35 void set_element_klass(klassOop k) { oop_store_without_check((oop*) &_element_klass, (oop) k); }
a61af66fc99e Initial load
duke
parents:
diff changeset
36 oop* element_klass_addr() { return (oop*)&_element_klass; }
a61af66fc99e Initial load
duke
parents:
diff changeset
37
a61af66fc99e Initial load
duke
parents:
diff changeset
38 klassOop bottom_klass() const { return _bottom_klass; }
a61af66fc99e Initial load
duke
parents:
diff changeset
39 void set_bottom_klass(klassOop k) { oop_store_without_check((oop*) &_bottom_klass, (oop) k); }
a61af66fc99e Initial load
duke
parents:
diff changeset
40 oop* bottom_klass_addr() { return (oop*)&_bottom_klass; }
a61af66fc99e Initial load
duke
parents:
diff changeset
41
a61af66fc99e Initial load
duke
parents:
diff changeset
42 // Compiler/Interpreter offset
a61af66fc99e Initial load
duke
parents:
diff changeset
43 static int element_klass_offset_in_bytes() { return offset_of(objArrayKlass, _element_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45 // Dispatched operation
a61af66fc99e Initial load
duke
parents:
diff changeset
46 bool can_be_primary_super_slow() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
47 objArrayOop compute_secondary_supers(int num_extra_slots, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
48 bool compute_is_subtype_of(klassOop k);
a61af66fc99e Initial load
duke
parents:
diff changeset
49 bool oop_is_objArray_slow() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
50 int oop_size(oop obj) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
51 int klass_oop_size() const { return object_size(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
52
a61af66fc99e Initial load
duke
parents:
diff changeset
53 // Allocation
a61af66fc99e Initial load
duke
parents:
diff changeset
54 DEFINE_ALLOCATE_PERMANENT(objArrayKlass);
a61af66fc99e Initial load
duke
parents:
diff changeset
55 objArrayOop allocate(int length, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
56 oop multi_allocate(int rank, jint* sizes, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
57
a61af66fc99e Initial load
duke
parents:
diff changeset
58 // Copying
a61af66fc99e Initial load
duke
parents:
diff changeset
59 void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
60
a61af66fc99e Initial load
duke
parents:
diff changeset
61 // Compute protection domain
a61af66fc99e Initial load
duke
parents:
diff changeset
62 oop protection_domain() { return Klass::cast(bottom_klass())->protection_domain(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
63 // Compute class loader
a61af66fc99e Initial load
duke
parents:
diff changeset
64 oop class_loader() const { return Klass::cast(bottom_klass())->class_loader(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
65
a61af66fc99e Initial load
duke
parents:
diff changeset
66 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
67 // Returns the objArrayKlass for n'th dimension.
a61af66fc99e Initial load
duke
parents:
diff changeset
68 virtual klassOop array_klass_impl(bool or_null, int n, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // Returns the array class with this class as element type.
a61af66fc99e Initial load
duke
parents:
diff changeset
71 virtual klassOop array_klass_impl(bool or_null, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // Casting from klassOop
a61af66fc99e Initial load
duke
parents:
diff changeset
75 static objArrayKlass* cast(klassOop k) {
a61af66fc99e Initial load
duke
parents:
diff changeset
76 assert(k->klass_part()->oop_is_objArray_slow(), "cast to objArrayKlass");
a61af66fc99e Initial load
duke
parents:
diff changeset
77 return (objArrayKlass*) k->klass_part();
a61af66fc99e Initial load
duke
parents:
diff changeset
78 }
a61af66fc99e Initial load
duke
parents:
diff changeset
79
a61af66fc99e Initial load
duke
parents:
diff changeset
80 // Sizing
a61af66fc99e Initial load
duke
parents:
diff changeset
81 static int header_size() { return oopDesc::header_size() + sizeof(objArrayKlass)/HeapWordSize; }
a61af66fc99e Initial load
duke
parents:
diff changeset
82 int object_size() const { return arrayKlass::object_size(header_size()); }
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 // Initialization (virtual from Klass)
a61af66fc99e Initial load
duke
parents:
diff changeset
85 void initialize(TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87 // Garbage collection
a61af66fc99e Initial load
duke
parents:
diff changeset
88 void oop_follow_contents(oop obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
89 int oop_adjust_pointers(oop obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91 // Parallel Scavenge and Parallel Old
a61af66fc99e Initial load
duke
parents:
diff changeset
92 PARALLEL_GC_DECLS
a61af66fc99e Initial load
duke
parents:
diff changeset
93
a61af66fc99e Initial load
duke
parents:
diff changeset
94 // Iterators
a61af66fc99e Initial load
duke
parents:
diff changeset
95 int oop_oop_iterate(oop obj, OopClosure* blk) {
a61af66fc99e Initial load
duke
parents:
diff changeset
96 return oop_oop_iterate_v(obj, blk);
a61af66fc99e Initial load
duke
parents:
diff changeset
97 }
a61af66fc99e Initial load
duke
parents:
diff changeset
98 int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
99 return oop_oop_iterate_v_m(obj, blk, mr);
a61af66fc99e Initial load
duke
parents:
diff changeset
100 }
a61af66fc99e Initial load
duke
parents:
diff changeset
101 #define ObjArrayKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
a61af66fc99e Initial load
duke
parents:
diff changeset
102 int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \
a61af66fc99e Initial load
duke
parents:
diff changeset
103 int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, \
a61af66fc99e Initial load
duke
parents:
diff changeset
104 MemRegion mr);
a61af66fc99e Initial load
duke
parents:
diff changeset
105
a61af66fc99e Initial load
duke
parents:
diff changeset
106 ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DECL)
a61af66fc99e Initial load
duke
parents:
diff changeset
107 ALL_OOP_OOP_ITERATE_CLOSURES_3(ObjArrayKlass_OOP_OOP_ITERATE_DECL)
a61af66fc99e Initial load
duke
parents:
diff changeset
108
a61af66fc99e Initial load
duke
parents:
diff changeset
109 // JVM support
a61af66fc99e Initial load
duke
parents:
diff changeset
110 jint compute_modifier_flags(TRAPS) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
111
a61af66fc99e Initial load
duke
parents:
diff changeset
112 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
113 static klassOop array_klass_impl (objArrayKlassHandle this_oop, bool or_null, int n, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
116 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
117 // Printing
a61af66fc99e Initial load
duke
parents:
diff changeset
118 void oop_print_on (oop obj, outputStream* st);
a61af66fc99e Initial load
duke
parents:
diff changeset
119 void oop_print_value_on(oop obj, outputStream* st);
a61af66fc99e Initial load
duke
parents:
diff changeset
120 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
121
a61af66fc99e Initial load
duke
parents:
diff changeset
122 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
123 // Verification
a61af66fc99e Initial load
duke
parents:
diff changeset
124 const char* internal_name() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
125 void oop_verify_on(oop obj, outputStream* st);
a61af66fc99e Initial load
duke
parents:
diff changeset
126 void oop_verify_old_oop(oop obj, oop* p, bool allow_dirty);
a61af66fc99e Initial load
duke
parents:
diff changeset
127
a61af66fc99e Initial load
duke
parents:
diff changeset
128 };