1
|
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 |
# include "incls/_precompiled.incl"
|
|
26 |
# include "incls/_arrayKlassKlass.cpp.incl"
|
|
27 |
|
|
28 |
|
|
29 |
klassOop arrayKlassKlass::create_klass(TRAPS) {
|
|
30 |
arrayKlassKlass o;
|
|
31 |
KlassHandle h_this_klass(THREAD, Universe::klassKlassObj());
|
|
32 |
KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL);
|
|
33 |
// Make sure size calculation is right
|
|
34 |
assert(k()->size() == align_object_size(header_size()), "wrong size for object");
|
|
35 |
java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror, make links
|
|
36 |
return k();
|
|
37 |
}
|
|
38 |
|
|
39 |
bool arrayKlassKlass::oop_is_parsable(oop obj) const {
|
|
40 |
assert(obj->is_klass(), "must be klass");
|
|
41 |
arrayKlass* ak = arrayKlass::cast(klassOop(obj));
|
|
42 |
return (!ak->null_vtbl()) && ak->object_is_parsable();
|
|
43 |
}
|
|
44 |
|
|
45 |
void arrayKlassKlass::oop_follow_contents(oop obj) {
|
|
46 |
assert(obj->is_klass(), "must be klass");
|
|
47 |
arrayKlass* ak = arrayKlass::cast(klassOop(obj));
|
|
48 |
MarkSweep::mark_and_push(ak->adr_component_mirror());
|
|
49 |
MarkSweep::mark_and_push(ak->adr_lower_dimension());
|
|
50 |
MarkSweep::mark_and_push(ak->adr_higher_dimension());
|
|
51 |
{
|
|
52 |
HandleMark hm;
|
|
53 |
ak->vtable()->oop_follow_contents();
|
|
54 |
}
|
|
55 |
klassKlass::oop_follow_contents(obj);
|
|
56 |
}
|
|
57 |
|
|
58 |
#ifndef SERIALGC
|
|
59 |
void arrayKlassKlass::oop_follow_contents(ParCompactionManager* cm,
|
|
60 |
oop obj) {
|
|
61 |
assert(obj->is_klass(), "must be klass");
|
|
62 |
arrayKlass* ak = arrayKlass::cast(klassOop(obj));
|
|
63 |
PSParallelCompact::mark_and_push(cm, ak->adr_component_mirror());
|
|
64 |
PSParallelCompact::mark_and_push(cm, ak->adr_lower_dimension());
|
|
65 |
PSParallelCompact::mark_and_push(cm, ak->adr_higher_dimension());
|
|
66 |
{
|
|
67 |
HandleMark hm;
|
|
68 |
ak->vtable()->oop_follow_contents(cm);
|
|
69 |
}
|
|
70 |
klassKlass::oop_follow_contents(cm, obj);
|
|
71 |
}
|
|
72 |
#endif // SERIALGC
|
|
73 |
|
|
74 |
|
|
75 |
int arrayKlassKlass::oop_adjust_pointers(oop obj) {
|
|
76 |
assert(obj->is_klass(), "must be klass");
|
|
77 |
arrayKlass* ak = arrayKlass::cast(klassOop(obj));
|
|
78 |
MarkSweep::adjust_pointer(ak->adr_component_mirror());
|
|
79 |
MarkSweep::adjust_pointer(ak->adr_lower_dimension());
|
|
80 |
MarkSweep::adjust_pointer(ak->adr_higher_dimension());
|
|
81 |
{
|
|
82 |
HandleMark hm;
|
|
83 |
ak->vtable()->oop_adjust_pointers();
|
|
84 |
}
|
|
85 |
return klassKlass::oop_adjust_pointers(obj);
|
|
86 |
}
|
|
87 |
|
|
88 |
|
|
89 |
int arrayKlassKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
|
|
90 |
assert(obj->is_klass(), "must be klass");
|
|
91 |
arrayKlass* ak = arrayKlass::cast(klassOop(obj));
|
|
92 |
blk->do_oop(ak->adr_component_mirror());
|
|
93 |
blk->do_oop(ak->adr_lower_dimension());
|
|
94 |
blk->do_oop(ak->adr_higher_dimension());
|
|
95 |
ak->vtable()->oop_oop_iterate(blk);
|
|
96 |
return klassKlass::oop_oop_iterate(obj, blk);
|
|
97 |
}
|
|
98 |
|
|
99 |
|
|
100 |
int arrayKlassKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) {
|
|
101 |
assert(obj->is_klass(), "must be klass");
|
|
102 |
arrayKlass* ak = arrayKlass::cast(klassOop(obj));
|
|
103 |
blk->do_oop(ak->adr_component_mirror());
|
|
104 |
blk->do_oop(ak->adr_lower_dimension());
|
|
105 |
blk->do_oop(ak->adr_higher_dimension());
|
|
106 |
ak->vtable()->oop_oop_iterate_m(blk, mr);
|
|
107 |
return klassKlass::oop_oop_iterate_m(obj, blk, mr);
|
|
108 |
}
|
|
109 |
|
|
110 |
#ifndef SERIALGC
|
|
111 |
void arrayKlassKlass::oop_copy_contents(PSPromotionManager* pm, oop obj) {
|
|
112 |
assert(obj->blueprint()->oop_is_arrayKlass(),"must be an array klass");
|
|
113 |
}
|
|
114 |
|
|
115 |
void arrayKlassKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
|
|
116 |
assert(obj->blueprint()->oop_is_arrayKlass(),"must be an array klass");
|
|
117 |
}
|
|
118 |
|
|
119 |
int arrayKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
|
|
120 |
assert(obj->is_klass(), "must be klass");
|
|
121 |
arrayKlass* ak = arrayKlass::cast(klassOop(obj));
|
|
122 |
PSParallelCompact::adjust_pointer(ak->adr_component_mirror());
|
|
123 |
PSParallelCompact::adjust_pointer(ak->adr_lower_dimension());
|
|
124 |
PSParallelCompact::adjust_pointer(ak->adr_higher_dimension());
|
|
125 |
{
|
|
126 |
HandleMark hm;
|
|
127 |
ak->vtable()->oop_update_pointers(cm);
|
|
128 |
}
|
|
129 |
return klassKlass::oop_update_pointers(cm, obj);
|
|
130 |
}
|
|
131 |
|
|
132 |
int
|
|
133 |
arrayKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
|
|
134 |
HeapWord* beg_addr, HeapWord* end_addr) {
|
|
135 |
assert(obj->is_klass(), "must be klass");
|
|
136 |
arrayKlass* ak = arrayKlass::cast(klassOop(obj));
|
|
137 |
|
|
138 |
oop* p;
|
|
139 |
p = ak->adr_component_mirror();
|
|
140 |
PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
|
|
141 |
p = ak->adr_lower_dimension();
|
|
142 |
PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
|
|
143 |
p = ak->adr_higher_dimension();
|
|
144 |
PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
|
|
145 |
|
|
146 |
{
|
|
147 |
HandleMark hm;
|
|
148 |
ak->vtable()->oop_update_pointers(cm, beg_addr, end_addr);
|
|
149 |
}
|
|
150 |
return klassKlass::oop_update_pointers(cm, obj, beg_addr, end_addr);
|
|
151 |
}
|
|
152 |
#endif // SERIALGC
|
|
153 |
|
|
154 |
#ifndef PRODUCT
|
|
155 |
|
|
156 |
// Printing
|
|
157 |
|
|
158 |
void arrayKlassKlass::oop_print_on(oop obj, outputStream* st) {
|
|
159 |
assert(obj->is_klass(), "must be klass");
|
|
160 |
klassKlass::oop_print_on(obj, st);
|
|
161 |
}
|
|
162 |
|
|
163 |
|
|
164 |
void arrayKlassKlass::oop_print_value_on(oop obj, outputStream* st) {
|
|
165 |
assert(obj->is_klass(), "must be klass");
|
|
166 |
arrayKlass* ak = arrayKlass::cast(klassOop(obj));
|
|
167 |
for(int index = 0; index < ak->dimension(); index++) {
|
|
168 |
st->print("[]");
|
|
169 |
}
|
|
170 |
}
|
|
171 |
#endif
|
|
172 |
|
|
173 |
|
|
174 |
const char* arrayKlassKlass::internal_name() const {
|
|
175 |
return "{array class}";
|
|
176 |
}
|
|
177 |
|
|
178 |
void arrayKlassKlass::oop_verify_on(oop obj, outputStream* st) {
|
|
179 |
klassKlass::oop_verify_on(obj, st);
|
|
180 |
|
|
181 |
arrayKlass* ak = arrayKlass::cast(klassOop(obj));
|
|
182 |
if (!obj->partially_loaded()) {
|
|
183 |
if (ak->component_mirror() != NULL)
|
|
184 |
guarantee(ak->component_mirror()->klass(), "should have a class");
|
|
185 |
if (ak->lower_dimension() != NULL)
|
|
186 |
guarantee(ak->lower_dimension()->klass(), "should have a class");
|
|
187 |
if (ak->higher_dimension() != NULL)
|
|
188 |
guarantee(ak->higher_dimension()->klass(), "should have a class");
|
|
189 |
}
|
|
190 |
}
|