Mercurial > hg > truffle
annotate src/share/vm/oops/arrayKlassKlass.cpp @ 3758:e2ce15aa3daf
Merge
author | never |
---|---|
date | Tue, 14 Jun 2011 15:20:55 -0700 |
parents | c7f3d0b4570f |
children |
rev | line source |
---|---|
0 | 1 /* |
2227 | 2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1155
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1155
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1155
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "classfile/javaClasses.hpp" | |
27 #include "gc_implementation/shared/markSweep.inline.hpp" | |
28 #include "oops/arrayKlassKlass.hpp" | |
29 #include "oops/oop.inline.hpp" | |
30 #include "runtime/handles.inline.hpp" | |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
31 #ifndef SERIALGC |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
32 #include "gc_implementation/parNew/parOopClosures.inline.hpp" |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
33 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
34 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
35 #include "memory/cardTableRS.hpp" |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
36 #include "oops/oop.pcgc.inline.hpp" |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
37 #endif |
0 | 38 |
39 | |
40 klassOop arrayKlassKlass::create_klass(TRAPS) { | |
41 arrayKlassKlass o; | |
42 KlassHandle h_this_klass(THREAD, Universe::klassKlassObj()); | |
43 KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL); | |
44 // Make sure size calculation is right | |
45 assert(k()->size() == align_object_size(header_size()), "wrong size for object"); | |
46 java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror, make links | |
47 return k(); | |
48 } | |
49 | |
50 bool arrayKlassKlass::oop_is_parsable(oop obj) const { | |
51 assert(obj->is_klass(), "must be klass"); | |
52 arrayKlass* ak = arrayKlass::cast(klassOop(obj)); | |
53 return (!ak->null_vtbl()) && ak->object_is_parsable(); | |
54 } | |
55 | |
56 void arrayKlassKlass::oop_follow_contents(oop obj) { | |
57 assert(obj->is_klass(), "must be klass"); | |
58 arrayKlass* ak = arrayKlass::cast(klassOop(obj)); | |
59 MarkSweep::mark_and_push(ak->adr_component_mirror()); | |
60 MarkSweep::mark_and_push(ak->adr_lower_dimension()); | |
61 MarkSweep::mark_and_push(ak->adr_higher_dimension()); | |
62 { | |
63 HandleMark hm; | |
64 ak->vtable()->oop_follow_contents(); | |
65 } | |
66 klassKlass::oop_follow_contents(obj); | |
67 } | |
68 | |
69 #ifndef SERIALGC | |
70 void arrayKlassKlass::oop_follow_contents(ParCompactionManager* cm, | |
71 oop obj) { | |
72 assert(obj->is_klass(), "must be klass"); | |
73 arrayKlass* ak = arrayKlass::cast(klassOop(obj)); | |
74 PSParallelCompact::mark_and_push(cm, ak->adr_component_mirror()); | |
75 PSParallelCompact::mark_and_push(cm, ak->adr_lower_dimension()); | |
76 PSParallelCompact::mark_and_push(cm, ak->adr_higher_dimension()); | |
77 { | |
78 HandleMark hm; | |
79 ak->vtable()->oop_follow_contents(cm); | |
80 } | |
81 klassKlass::oop_follow_contents(cm, obj); | |
82 } | |
83 #endif // SERIALGC | |
84 | |
85 | |
86 int arrayKlassKlass::oop_adjust_pointers(oop obj) { | |
87 assert(obj->is_klass(), "must be klass"); | |
88 arrayKlass* ak = arrayKlass::cast(klassOop(obj)); | |
89 MarkSweep::adjust_pointer(ak->adr_component_mirror()); | |
90 MarkSweep::adjust_pointer(ak->adr_lower_dimension()); | |
91 MarkSweep::adjust_pointer(ak->adr_higher_dimension()); | |
92 { | |
93 HandleMark hm; | |
94 ak->vtable()->oop_adjust_pointers(); | |
95 } | |
96 return klassKlass::oop_adjust_pointers(obj); | |
97 } | |
98 | |
99 | |
100 int arrayKlassKlass::oop_oop_iterate(oop obj, OopClosure* blk) { | |
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(blk); | |
107 return klassKlass::oop_oop_iterate(obj, blk); | |
108 } | |
109 | |
110 | |
111 int arrayKlassKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) { | |
112 assert(obj->is_klass(), "must be klass"); | |
113 arrayKlass* ak = arrayKlass::cast(klassOop(obj)); | |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
114 oop* addr = ak->adr_component_mirror(); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
115 if (mr.contains(addr)) blk->do_oop(addr); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
116 addr = ak->adr_lower_dimension(); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
117 if (mr.contains(addr)) blk->do_oop(addr); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
118 addr = ak->adr_higher_dimension(); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
119 if (mr.contains(addr)) blk->do_oop(addr); |
0 | 120 ak->vtable()->oop_oop_iterate_m(blk, mr); |
121 return klassKlass::oop_oop_iterate_m(obj, blk, mr); | |
122 } | |
123 | |
124 #ifndef SERIALGC | |
125 void arrayKlassKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { | |
126 assert(obj->blueprint()->oop_is_arrayKlass(),"must be an array klass"); | |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
127 arrayKlass* ak = arrayKlass::cast(klassOop(obj)); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
128 oop* p = ak->adr_component_mirror(); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
129 if (PSScavenge::should_scavenge(p)) { |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
130 pm->claim_or_forward_depth(p); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
131 } |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
132 klassKlass::oop_push_contents(pm, obj); |
0 | 133 } |
134 | |
135 int arrayKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { | |
136 assert(obj->is_klass(), "must be klass"); | |
137 arrayKlass* ak = arrayKlass::cast(klassOop(obj)); | |
138 PSParallelCompact::adjust_pointer(ak->adr_component_mirror()); | |
139 PSParallelCompact::adjust_pointer(ak->adr_lower_dimension()); | |
140 PSParallelCompact::adjust_pointer(ak->adr_higher_dimension()); | |
141 { | |
142 HandleMark hm; | |
143 ak->vtable()->oop_update_pointers(cm); | |
144 } | |
145 return klassKlass::oop_update_pointers(cm, obj); | |
146 } | |
147 #endif // SERIALGC | |
148 | |
149 // Printing | |
150 | |
151 void arrayKlassKlass::oop_print_on(oop obj, outputStream* st) { | |
152 assert(obj->is_klass(), "must be klass"); | |
153 klassKlass::oop_print_on(obj, st); | |
154 } | |
155 | |
156 void arrayKlassKlass::oop_print_value_on(oop obj, outputStream* st) { | |
157 assert(obj->is_klass(), "must be klass"); | |
158 arrayKlass* ak = arrayKlass::cast(klassOop(obj)); | |
159 for(int index = 0; index < ak->dimension(); index++) { | |
160 st->print("[]"); | |
161 } | |
162 } | |
163 | |
164 | |
165 const char* arrayKlassKlass::internal_name() const { | |
166 return "{array class}"; | |
167 } | |
168 | |
169 void arrayKlassKlass::oop_verify_on(oop obj, outputStream* st) { | |
170 klassKlass::oop_verify_on(obj, st); | |
171 | |
172 arrayKlass* ak = arrayKlass::cast(klassOop(obj)); | |
173 if (!obj->partially_loaded()) { | |
174 if (ak->component_mirror() != NULL) | |
175 guarantee(ak->component_mirror()->klass(), "should have a class"); | |
176 if (ak->lower_dimension() != NULL) | |
177 guarantee(ak->lower_dimension()->klass(), "should have a class"); | |
178 if (ak->higher_dimension() != NULL) | |
179 guarantee(ak->higher_dimension()->klass(), "should have a class"); | |
180 } | |
181 } |