annotate src/share/vm/oops/objArrayKlass.hpp @ 113:ba764ed4b6f2

6420645: Create a vm that uses compressed oops for up to 32gb heapsizes Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
author coleenp
date Sun, 13 Apr 2008 17:43:42 -0400
parents a61af66fc99e
children d1605aabd0a1 37f87013dfd8
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
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
66 private:
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
67 // Either oop or narrowOop depending on UseCompressedOops.
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
68 // must be called from within objArrayKlass.cpp
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
69 template <class T> void do_copy(arrayOop s, T* src, arrayOop d,
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
70 T* dst, int length, TRAPS);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
71 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
72 // Returns the objArrayKlass for n'th dimension.
a61af66fc99e Initial load
duke
parents:
diff changeset
73 virtual klassOop array_klass_impl(bool or_null, int n, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
74
a61af66fc99e Initial load
duke
parents:
diff changeset
75 // Returns the array class with this class as element type.
a61af66fc99e Initial load
duke
parents:
diff changeset
76 virtual klassOop array_klass_impl(bool or_null, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
77
a61af66fc99e Initial load
duke
parents:
diff changeset
78 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
79 // Casting from klassOop
a61af66fc99e Initial load
duke
parents:
diff changeset
80 static objArrayKlass* cast(klassOop k) {
a61af66fc99e Initial load
duke
parents:
diff changeset
81 assert(k->klass_part()->oop_is_objArray_slow(), "cast to objArrayKlass");
a61af66fc99e Initial load
duke
parents:
diff changeset
82 return (objArrayKlass*) k->klass_part();
a61af66fc99e Initial load
duke
parents:
diff changeset
83 }
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 // Sizing
a61af66fc99e Initial load
duke
parents:
diff changeset
86 static int header_size() { return oopDesc::header_size() + sizeof(objArrayKlass)/HeapWordSize; }
a61af66fc99e Initial load
duke
parents:
diff changeset
87 int object_size() const { return arrayKlass::object_size(header_size()); }
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 // Initialization (virtual from Klass)
a61af66fc99e Initial load
duke
parents:
diff changeset
90 void initialize(TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 // Garbage collection
a61af66fc99e Initial load
duke
parents:
diff changeset
93 void oop_follow_contents(oop obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
94 int oop_adjust_pointers(oop obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // Parallel Scavenge and Parallel Old
a61af66fc99e Initial load
duke
parents:
diff changeset
97 PARALLEL_GC_DECLS
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 // Iterators
a61af66fc99e Initial load
duke
parents:
diff changeset
100 int oop_oop_iterate(oop obj, OopClosure* blk) {
a61af66fc99e Initial load
duke
parents:
diff changeset
101 return oop_oop_iterate_v(obj, blk);
a61af66fc99e Initial load
duke
parents:
diff changeset
102 }
a61af66fc99e Initial load
duke
parents:
diff changeset
103 int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
104 return oop_oop_iterate_v_m(obj, blk, mr);
a61af66fc99e Initial load
duke
parents:
diff changeset
105 }
a61af66fc99e Initial load
duke
parents:
diff changeset
106 #define ObjArrayKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
a61af66fc99e Initial load
duke
parents:
diff changeset
107 int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \
a61af66fc99e Initial load
duke
parents:
diff changeset
108 int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, \
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
109 MemRegion mr); \
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
110 int oop_oop_iterate_range##nv_suffix(oop obj, OopClosureType* blk, \
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
111 int start, int end);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DECL)
a61af66fc99e Initial load
duke
parents:
diff changeset
114 ALL_OOP_OOP_ITERATE_CLOSURES_3(ObjArrayKlass_OOP_OOP_ITERATE_DECL)
a61af66fc99e Initial load
duke
parents:
diff changeset
115
a61af66fc99e Initial load
duke
parents:
diff changeset
116 // JVM support
a61af66fc99e Initial load
duke
parents:
diff changeset
117 jint compute_modifier_flags(TRAPS) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
118
a61af66fc99e Initial load
duke
parents:
diff changeset
119 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
120 static klassOop array_klass_impl (objArrayKlassHandle this_oop, bool or_null, int n, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
121
a61af66fc99e Initial load
duke
parents:
diff changeset
122 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
123 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
124 // Printing
a61af66fc99e Initial load
duke
parents:
diff changeset
125 void oop_print_on (oop obj, outputStream* st);
a61af66fc99e Initial load
duke
parents:
diff changeset
126 void oop_print_value_on(oop obj, outputStream* st);
a61af66fc99e Initial load
duke
parents:
diff changeset
127 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
128
a61af66fc99e Initial load
duke
parents:
diff changeset
129 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
130 // Verification
a61af66fc99e Initial load
duke
parents:
diff changeset
131 const char* internal_name() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
132 void oop_verify_on(oop obj, outputStream* st);
a61af66fc99e Initial load
duke
parents:
diff changeset
133 void oop_verify_old_oop(oop obj, oop* p, bool allow_dirty);
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
134 void oop_verify_old_oop(oop obj, narrowOop* p, bool allow_dirty);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
135
a61af66fc99e Initial load
duke
parents:
diff changeset
136 };