Mercurial > hg > truffle
annotate src/share/vm/oops/constantPoolKlass.cpp @ 2227:e5383553fd4e
7014851: Remove unused parallel compaction code
Summary: Removed.
Reviewed-by: jcoomes, brutisso
author | stefank |
---|---|
date | Tue, 08 Feb 2011 12:33:19 +0100 |
parents | c5a923563727 |
children | 183658a2d0b3 |
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 "gc_interface/collectedHeap.inline.hpp" | |
29 #include "memory/oopFactory.hpp" | |
30 #include "memory/permGen.hpp" | |
31 #include "memory/universe.inline.hpp" | |
32 #include "oops/constantPoolKlass.hpp" | |
33 #include "oops/constantPoolOop.hpp" | |
34 #include "oops/oop.inline.hpp" | |
35 #include "oops/oop.inline2.hpp" | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
36 #include "oops/symbol.hpp" |
1972 | 37 #include "runtime/handles.inline.hpp" |
38 #ifdef TARGET_OS_FAMILY_linux | |
39 # include "thread_linux.inline.hpp" | |
40 #endif | |
41 #ifdef TARGET_OS_FAMILY_solaris | |
42 # include "thread_solaris.inline.hpp" | |
43 #endif | |
44 #ifdef TARGET_OS_FAMILY_windows | |
45 # include "thread_windows.inline.hpp" | |
46 #endif | |
47 #ifndef SERIALGC | |
48 #include "gc_implementation/parNew/parOopClosures.inline.hpp" | |
49 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" | |
50 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" | |
51 #include "memory/cardTableRS.hpp" | |
52 #include "oops/oop.pcgc.inline.hpp" | |
53 #endif | |
0 | 54 |
518
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
431
diff
changeset
|
55 constantPoolOop constantPoolKlass::allocate(int length, bool is_conc_safe, TRAPS) { |
0 | 56 int size = constantPoolOopDesc::object_size(length); |
57 KlassHandle klass (THREAD, as_klassOop()); | |
58 constantPoolOop c = | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
59 (constantPoolOop)CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL); |
0 | 60 |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
61 c->set_length(length); |
0 | 62 c->set_tags(NULL); |
63 c->set_cache(NULL); | |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
64 c->set_operands(NULL); |
0 | 65 c->set_pool_holder(NULL); |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
66 c->set_flags(0); |
0 | 67 // only set to non-zero if constant pool is merged by RedefineClasses |
68 c->set_orig_length(0); | |
518
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
431
diff
changeset
|
69 // if constant pool may change during RedefineClasses, it is created |
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
431
diff
changeset
|
70 // unsafe for GC concurrent processing. |
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
431
diff
changeset
|
71 c->set_is_conc_safe(is_conc_safe); |
0 | 72 // all fields are initialized; needed for GC |
73 | |
2226
c5a923563727
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
2177
diff
changeset
|
74 // Note: because we may be in this "conc_unsafe" state when allocating |
c5a923563727
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
2177
diff
changeset
|
75 // t_oop below, which may in turn cause a GC, it is imperative that our |
c5a923563727
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
2177
diff
changeset
|
76 // size be correct, consistent and henceforth stable, at this stage. |
c5a923563727
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
2177
diff
changeset
|
77 assert(c->is_parsable(), "Else size() below is unreliable"); |
c5a923563727
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
2177
diff
changeset
|
78 DEBUG_ONLY(int sz = c->size();) |
c5a923563727
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
2177
diff
changeset
|
79 |
0 | 80 // initialize tag array |
81 // Note: cannot introduce constant pool handle before since it is not | |
82 // completely initialized (no class) -> would cause assertion failure | |
83 constantPoolHandle pool (THREAD, c); | |
84 typeArrayOop t_oop = oopFactory::new_permanent_byteArray(length, CHECK_NULL); | |
85 typeArrayHandle tags (THREAD, t_oop); | |
86 for (int index = 0; index < length; index++) { | |
87 tags()->byte_at_put(index, JVM_CONSTANT_Invalid); | |
88 } | |
89 pool->set_tags(tags()); | |
90 | |
2226
c5a923563727
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
2177
diff
changeset
|
91 // Check that our size was stable at its old value. |
c5a923563727
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
2177
diff
changeset
|
92 assert(sz == c->size(), "size() changed"); |
0 | 93 return pool(); |
94 } | |
95 | |
96 klassOop constantPoolKlass::create_klass(TRAPS) { | |
97 constantPoolKlass o; | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
98 KlassHandle h_this_klass(THREAD, Universe::klassKlassObj()); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
99 KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
100 // Make sure size calculation is right |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
101 assert(k()->size() == align_object_size(header_size()), "wrong size for object"); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
102 java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror |
0 | 103 return k(); |
104 } | |
105 | |
106 int constantPoolKlass::oop_size(oop obj) const { | |
107 assert(obj->is_constantPool(), "must be constantPool"); | |
108 return constantPoolOop(obj)->object_size(); | |
109 } | |
110 | |
111 | |
112 void constantPoolKlass::oop_follow_contents(oop obj) { | |
113 assert (obj->is_constantPool(), "obj must be constant pool"); | |
114 constantPoolOop cp = (constantPoolOop) obj; | |
115 // Performance tweak: We skip iterating over the klass pointer since we | |
116 // know that Universe::constantPoolKlassObj never moves. | |
117 | |
118 // If the tags array is null we are in the middle of allocating this constant pool | |
119 if (cp->tags() != NULL) { | |
120 // gc of constant pool contents | |
121 oop* base = (oop*)cp->base(); | |
122 for (int i = 0; i < cp->length(); i++) { | |
123 if (cp->is_pointer_entry(i)) { | |
124 if (*base != NULL) MarkSweep::mark_and_push(base); | |
125 } | |
126 base++; | |
127 } | |
128 // gc of constant pool instance variables | |
129 MarkSweep::mark_and_push(cp->tags_addr()); | |
130 MarkSweep::mark_and_push(cp->cache_addr()); | |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
131 MarkSweep::mark_and_push(cp->operands_addr()); |
0 | 132 MarkSweep::mark_and_push(cp->pool_holder_addr()); |
133 } | |
134 } | |
135 | |
136 #ifndef SERIALGC | |
137 void constantPoolKlass::oop_follow_contents(ParCompactionManager* cm, | |
138 oop obj) { | |
139 assert (obj->is_constantPool(), "obj must be constant pool"); | |
140 constantPoolOop cp = (constantPoolOop) obj; | |
141 // Performance tweak: We skip iterating over the klass pointer since we | |
142 // know that Universe::constantPoolKlassObj never moves. | |
143 | |
144 // If the tags array is null we are in the middle of allocating this constant | |
145 // pool. | |
146 if (cp->tags() != NULL) { | |
147 // gc of constant pool contents | |
148 oop* base = (oop*)cp->base(); | |
149 for (int i = 0; i < cp->length(); i++) { | |
150 if (cp->is_pointer_entry(i)) { | |
151 if (*base != NULL) PSParallelCompact::mark_and_push(cm, base); | |
152 } | |
153 base++; | |
154 } | |
155 // gc of constant pool instance variables | |
156 PSParallelCompact::mark_and_push(cm, cp->tags_addr()); | |
157 PSParallelCompact::mark_and_push(cm, cp->cache_addr()); | |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
158 PSParallelCompact::mark_and_push(cm, cp->operands_addr()); |
0 | 159 PSParallelCompact::mark_and_push(cm, cp->pool_holder_addr()); |
160 } | |
161 } | |
162 #endif // SERIALGC | |
163 | |
164 | |
165 int constantPoolKlass::oop_adjust_pointers(oop obj) { | |
166 assert (obj->is_constantPool(), "obj must be constant pool"); | |
167 constantPoolOop cp = (constantPoolOop) obj; | |
168 // Get size before changing pointers. | |
169 // Don't call size() or oop_size() since that is a virtual call. | |
170 int size = cp->object_size(); | |
171 // Performance tweak: We skip iterating over the klass pointer since we | |
172 // know that Universe::constantPoolKlassObj never moves. | |
173 | |
174 // If the tags array is null we are in the middle of allocating this constant | |
175 // pool. | |
176 if (cp->tags() != NULL) { | |
177 oop* base = (oop*)cp->base(); | |
178 for (int i = 0; i< cp->length(); i++) { | |
179 if (cp->is_pointer_entry(i)) { | |
180 MarkSweep::adjust_pointer(base); | |
181 } | |
182 base++; | |
183 } | |
184 } | |
185 MarkSweep::adjust_pointer(cp->tags_addr()); | |
186 MarkSweep::adjust_pointer(cp->cache_addr()); | |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
187 MarkSweep::adjust_pointer(cp->operands_addr()); |
0 | 188 MarkSweep::adjust_pointer(cp->pool_holder_addr()); |
189 return size; | |
190 } | |
191 | |
192 | |
193 int constantPoolKlass::oop_oop_iterate(oop obj, OopClosure* blk) { | |
194 assert (obj->is_constantPool(), "obj must be constant pool"); | |
195 // Performance tweak: We skip iterating over the klass pointer since we | |
196 // know that Universe::constantPoolKlassObj never moves. | |
197 constantPoolOop cp = (constantPoolOop) obj; | |
198 // Get size before changing pointers. | |
199 // Don't call size() or oop_size() since that is a virtual call. | |
200 int size = cp->object_size(); | |
201 | |
202 // If the tags array is null we are in the middle of allocating this constant | |
203 // pool. | |
204 if (cp->tags() != NULL) { | |
205 oop* base = (oop*)cp->base(); | |
206 for (int i = 0; i < cp->length(); i++) { | |
207 if (cp->is_pointer_entry(i)) { | |
208 blk->do_oop(base); | |
209 } | |
210 base++; | |
211 } | |
212 } | |
213 blk->do_oop(cp->tags_addr()); | |
214 blk->do_oop(cp->cache_addr()); | |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
215 blk->do_oop(cp->operands_addr()); |
0 | 216 blk->do_oop(cp->pool_holder_addr()); |
217 return size; | |
218 } | |
219 | |
220 | |
221 int constantPoolKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) { | |
222 assert (obj->is_constantPool(), "obj must be constant pool"); | |
223 // Performance tweak: We skip iterating over the klass pointer since we | |
224 // know that Universe::constantPoolKlassObj never moves. | |
225 constantPoolOop cp = (constantPoolOop) obj; | |
226 // Get size before changing pointers. | |
227 // Don't call size() or oop_size() since that is a virtual call. | |
228 int size = cp->object_size(); | |
229 | |
230 // If the tags array is null we are in the middle of allocating this constant | |
231 // pool. | |
232 if (cp->tags() != NULL) { | |
233 oop* base = (oop*)cp->base(); | |
234 for (int i = 0; i < cp->length(); i++) { | |
235 if (mr.contains(base)) { | |
236 if (cp->is_pointer_entry(i)) { | |
237 blk->do_oop(base); | |
238 } | |
239 } | |
240 base++; | |
241 } | |
242 } | |
243 oop* addr; | |
244 addr = cp->tags_addr(); | |
245 blk->do_oop(addr); | |
246 addr = cp->cache_addr(); | |
247 blk->do_oop(addr); | |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
248 addr = cp->operands_addr(); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
249 blk->do_oop(addr); |
0 | 250 addr = cp->pool_holder_addr(); |
251 blk->do_oop(addr); | |
252 return size; | |
253 } | |
254 | |
518
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
431
diff
changeset
|
255 bool constantPoolKlass::oop_is_conc_safe(oop obj) const { |
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
431
diff
changeset
|
256 assert(obj->is_constantPool(), "must be constantPool"); |
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
431
diff
changeset
|
257 return constantPoolOop(obj)->is_conc_safe(); |
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
431
diff
changeset
|
258 } |
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
431
diff
changeset
|
259 |
0 | 260 #ifndef SERIALGC |
261 int constantPoolKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { | |
262 assert (obj->is_constantPool(), "obj must be constant pool"); | |
263 constantPoolOop cp = (constantPoolOop) obj; | |
264 | |
265 // If the tags array is null we are in the middle of allocating this constant | |
266 // pool. | |
267 if (cp->tags() != NULL) { | |
268 oop* base = (oop*)cp->base(); | |
269 for (int i = 0; i < cp->length(); ++i, ++base) { | |
270 if (cp->is_pointer_entry(i)) { | |
271 PSParallelCompact::adjust_pointer(base); | |
272 } | |
273 } | |
274 } | |
275 PSParallelCompact::adjust_pointer(cp->tags_addr()); | |
276 PSParallelCompact::adjust_pointer(cp->cache_addr()); | |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
277 PSParallelCompact::adjust_pointer(cp->operands_addr()); |
0 | 278 PSParallelCompact::adjust_pointer(cp->pool_holder_addr()); |
279 return cp->object_size(); | |
280 } | |
281 | |
282 void constantPoolKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { | |
283 assert(obj->is_constantPool(), "should be constant pool"); | |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
284 constantPoolOop cp = (constantPoolOop) obj; |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
285 if (AnonymousClasses && cp->has_pseudo_string() && cp->tags() != NULL) { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
286 oop* base = (oop*)cp->base(); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
287 for (int i = 0; i < cp->length(); ++i, ++base) { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
288 if (cp->tag_at(i).is_string()) { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
289 if (PSScavenge::should_scavenge(base)) { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
290 pm->claim_or_forward_depth(base); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
291 } |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
292 } |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
293 } |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
294 } |
0 | 295 } |
296 #endif // SERIALGC | |
297 | |
298 // Printing | |
299 | |
300 void constantPoolKlass::oop_print_on(oop obj, outputStream* st) { | |
301 EXCEPTION_MARK; | |
302 oop anObj; | |
303 assert(obj->is_constantPool(), "must be constantPool"); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
304 Klass::oop_print_on(obj, st); |
0 | 305 constantPoolOop cp = constantPoolOop(obj); |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
306 if (cp->flags() != 0) { |
1573
beb77f0d41b3
6957004: MethodComparator uses the wrong CP index accessor
jrose
parents:
1155
diff
changeset
|
307 st->print(" - flags: 0x%x", cp->flags()); |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
308 if (cp->has_pseudo_string()) st->print(" has_pseudo_string"); |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
309 if (cp->has_invokedynamic()) st->print(" has_invokedynamic"); |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
310 st->cr(); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
311 } |
1573
beb77f0d41b3
6957004: MethodComparator uses the wrong CP index accessor
jrose
parents:
1155
diff
changeset
|
312 st->print_cr(" - cache: " INTPTR_FORMAT, cp->cache()); |
0 | 313 |
314 for (int index = 1; index < cp->length(); index++) { // Index 0 is unused | |
315 st->print(" - %3d : ", index); | |
316 cp->tag_at(index).print_on(st); | |
317 st->print(" : "); | |
318 switch (cp->tag_at(index).value()) { | |
319 case JVM_CONSTANT_Class : | |
320 { anObj = cp->klass_at(index, CATCH); | |
321 anObj->print_value_on(st); | |
322 st->print(" {0x%lx}", (address)anObj); | |
323 } | |
324 break; | |
325 case JVM_CONSTANT_Fieldref : | |
326 case JVM_CONSTANT_Methodref : | |
327 case JVM_CONSTANT_InterfaceMethodref : | |
1573
beb77f0d41b3
6957004: MethodComparator uses the wrong CP index accessor
jrose
parents:
1155
diff
changeset
|
328 st->print("klass_index=%d", cp->uncached_klass_ref_index_at(index)); |
beb77f0d41b3
6957004: MethodComparator uses the wrong CP index accessor
jrose
parents:
1155
diff
changeset
|
329 st->print(" name_and_type_index=%d", cp->uncached_name_and_type_ref_index_at(index)); |
0 | 330 break; |
331 case JVM_CONSTANT_UnresolvedString : | |
332 case JVM_CONSTANT_String : | |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
333 if (cp->is_pseudo_string_at(index)) { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
334 anObj = cp->pseudo_string_at(index); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
335 } else { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
336 anObj = cp->string_at(index, CATCH); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
337 } |
0 | 338 anObj->print_value_on(st); |
339 st->print(" {0x%lx}", (address)anObj); | |
340 break; | |
341 case JVM_CONSTANT_Integer : | |
342 st->print("%d", cp->int_at(index)); | |
343 break; | |
344 case JVM_CONSTANT_Float : | |
345 st->print("%f", cp->float_at(index)); | |
346 break; | |
347 case JVM_CONSTANT_Long : | |
348 st->print_jlong(cp->long_at(index)); | |
349 index++; // Skip entry following eigth-byte constant | |
350 break; | |
351 case JVM_CONSTANT_Double : | |
352 st->print("%lf", cp->double_at(index)); | |
353 index++; // Skip entry following eigth-byte constant | |
354 break; | |
355 case JVM_CONSTANT_NameAndType : | |
356 st->print("name_index=%d", cp->name_ref_index_at(index)); | |
357 st->print(" signature_index=%d", cp->signature_ref_index_at(index)); | |
358 break; | |
359 case JVM_CONSTANT_Utf8 : | |
360 cp->symbol_at(index)->print_value_on(st); | |
361 break; | |
362 case JVM_CONSTANT_UnresolvedClass : // fall-through | |
363 case JVM_CONSTANT_UnresolvedClassInError: { | |
364 // unresolved_klass_at requires lock or safe world. | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
365 CPSlot entry = cp->slot_at(index); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
366 if (entry.is_oop()) { |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
367 entry.get_oop()->print_value_on(st); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
368 } else { |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
369 entry.get_symbol()->print_value_on(st); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
370 } |
0 | 371 } |
372 break; | |
1602 | 373 case JVM_CONSTANT_MethodHandle : |
374 st->print("ref_kind=%d", cp->method_handle_ref_kind_at(index)); | |
375 st->print(" ref_index=%d", cp->method_handle_index_at(index)); | |
376 break; | |
377 case JVM_CONSTANT_MethodType : | |
378 st->print("signature_index=%d", cp->method_type_index_at(index)); | |
379 break; | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
380 case JVM_CONSTANT_InvokeDynamicTrans : |
1660
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
381 case JVM_CONSTANT_InvokeDynamic : |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
382 { |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
383 st->print("bootstrap_method_index=%d", cp->invoke_dynamic_bootstrap_method_ref_index_at(index)); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
384 st->print(" name_and_type_index=%d", cp->invoke_dynamic_name_and_type_ref_index_at(index)); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
385 int argc = cp->invoke_dynamic_argument_count_at(index); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
386 if (argc > 0) { |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
387 for (int arg_i = 0; arg_i < argc; arg_i++) { |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
388 int arg = cp->invoke_dynamic_argument_index_at(index, arg_i); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
389 st->print((arg_i == 0 ? " arguments={%d" : ", %d"), arg); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
390 } |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
391 st->print("}"); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
392 } |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
393 } |
1660
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
394 break; |
0 | 395 default: |
396 ShouldNotReachHere(); | |
397 break; | |
398 } | |
399 st->cr(); | |
400 } | |
401 st->cr(); | |
402 } | |
403 | |
1155
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
726
diff
changeset
|
404 void constantPoolKlass::oop_print_value_on(oop obj, outputStream* st) { |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
726
diff
changeset
|
405 assert(obj->is_constantPool(), "must be constantPool"); |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
726
diff
changeset
|
406 constantPoolOop cp = constantPoolOop(obj); |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
726
diff
changeset
|
407 st->print("constant pool [%d]", cp->length()); |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
726
diff
changeset
|
408 if (cp->has_pseudo_string()) st->print("/pseudo_string"); |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
726
diff
changeset
|
409 if (cp->has_invokedynamic()) st->print("/invokedynamic"); |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
410 if (cp->operands() != NULL) st->print("/operands[%d]", cp->operands()->length()); |
1155
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
726
diff
changeset
|
411 cp->print_address_on(st); |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
726
diff
changeset
|
412 st->print(" for "); |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
726
diff
changeset
|
413 cp->pool_holder()->print_value_on(st); |
1573
beb77f0d41b3
6957004: MethodComparator uses the wrong CP index accessor
jrose
parents:
1155
diff
changeset
|
414 if (cp->cache() != NULL) { |
beb77f0d41b3
6957004: MethodComparator uses the wrong CP index accessor
jrose
parents:
1155
diff
changeset
|
415 st->print(" cache=" PTR_FORMAT, cp->cache()); |
beb77f0d41b3
6957004: MethodComparator uses the wrong CP index accessor
jrose
parents:
1155
diff
changeset
|
416 } |
1155
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
726
diff
changeset
|
417 } |
0 | 418 |
419 const char* constantPoolKlass::internal_name() const { | |
420 return "{constant pool}"; | |
421 } | |
422 | |
423 // Verification | |
424 | |
425 void constantPoolKlass::oop_verify_on(oop obj, outputStream* st) { | |
426 Klass::oop_verify_on(obj, st); | |
427 guarantee(obj->is_constantPool(), "object must be constant pool"); | |
428 constantPoolOop cp = constantPoolOop(obj); | |
429 guarantee(cp->is_perm(), "should be in permspace"); | |
430 if (!cp->partially_loaded()) { | |
431 for (int i = 0; i< cp->length(); i++) { | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
432 CPSlot entry = cp->slot_at(i); |
0 | 433 if (cp->tag_at(i).is_klass()) { |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
434 if (entry.is_oop()) { |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
435 guarantee(entry.get_oop()->is_perm(), "should be in permspace"); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
436 guarantee(entry.get_oop()->is_klass(), "should be klass"); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
437 } |
0 | 438 } |
439 if (cp->tag_at(i).is_unresolved_klass()) { | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
440 if (entry.is_oop()) { |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
441 guarantee(entry.get_oop()->is_perm(), "should be in permspace"); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
442 guarantee(entry.get_oop()->is_klass(), "should be klass"); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
443 } |
0 | 444 } |
445 if (cp->tag_at(i).is_symbol()) { | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
446 guarantee(entry.get_symbol()->refcount() != 0, "should have nonzero reference count"); |
0 | 447 } |
448 if (cp->tag_at(i).is_unresolved_string()) { | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
449 if (entry.is_oop()) { |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
450 guarantee(entry.get_oop()->is_perm(), "should be in permspace"); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
451 guarantee(entry.get_oop()->is_instance(), "should be instance"); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
452 } |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
453 else { |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
454 guarantee(entry.get_symbol()->refcount() != 0, "should have nonzero reference count"); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
455 } |
0 | 456 } |
457 if (cp->tag_at(i).is_string()) { | |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
458 if (!cp->has_pseudo_string()) { |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
459 if (entry.is_oop()) { |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
460 guarantee(entry.get_oop()->is_perm(), "should be in permspace"); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
461 guarantee(entry.get_oop()->is_instance(), "should be instance"); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2011
diff
changeset
|
462 } |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
463 } else { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
464 // can be non-perm, can be non-instance (array) |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
196
diff
changeset
|
465 } |
0 | 466 } |
1602 | 467 // FIXME: verify JSR 292 tags JVM_CONSTANT_MethodHandle, etc. |
0 | 468 } |
469 guarantee(cp->tags()->is_perm(), "should be in permspace"); | |
470 guarantee(cp->tags()->is_typeArray(), "should be type array"); | |
471 if (cp->cache() != NULL) { | |
472 // Note: cache() can be NULL before a class is completely setup or | |
473 // in temporary constant pools used during constant pool merging | |
474 guarantee(cp->cache()->is_perm(), "should be in permspace"); | |
475 guarantee(cp->cache()->is_constantPoolCache(), "should be constant pool cache"); | |
476 } | |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
477 if (cp->operands() != NULL) { |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
478 guarantee(cp->operands()->is_perm(), "should be in permspace"); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
479 guarantee(cp->operands()->is_typeArray(), "should be type array"); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1713
diff
changeset
|
480 } |
0 | 481 if (cp->pool_holder() != NULL) { |
482 // Note: pool_holder() can be NULL in temporary constant pools | |
483 // used during constant pool merging | |
484 guarantee(cp->pool_holder()->is_perm(), "should be in permspace"); | |
485 guarantee(cp->pool_holder()->is_klass(), "should be klass"); | |
486 } | |
487 } | |
488 } | |
489 | |
490 bool constantPoolKlass::oop_partially_loaded(oop obj) const { | |
491 assert(obj->is_constantPool(), "object must be constant pool"); | |
492 constantPoolOop cp = constantPoolOop(obj); | |
493 return cp->tags() == NULL || cp->pool_holder() == (klassOop) cp; // Check whether pool holder points to self | |
494 } | |
495 | |
496 | |
497 void constantPoolKlass::oop_set_partially_loaded(oop obj) { | |
498 assert(obj->is_constantPool(), "object must be constant pool"); | |
499 constantPoolOop cp = constantPoolOop(obj); | |
500 assert(cp->pool_holder() == NULL, "just checking"); | |
501 cp->set_pool_holder((klassOop) cp); // Temporarily set pool holder to point to self | |
502 } | |
503 | |
504 #ifndef PRODUCT | |
505 // CompileTheWorld support. Preload all classes loaded references in the passed in constantpool | |
506 void constantPoolKlass::preload_and_initialize_all_classes(oop obj, TRAPS) { | |
507 guarantee(obj->is_constantPool(), "object must be constant pool"); | |
508 constantPoolHandle cp(THREAD, (constantPoolOop)obj); | |
509 guarantee(!cp->partially_loaded(), "must be fully loaded"); | |
510 | |
511 for (int i = 0; i< cp->length(); i++) { | |
512 if (cp->tag_at(i).is_unresolved_klass()) { | |
513 // This will force loading of the class | |
514 klassOop klass = cp->klass_at(i, CHECK); | |
515 if (klass->is_instance()) { | |
516 // Force initialization of class | |
517 instanceKlass::cast(klass)->initialize(CHECK); | |
518 } | |
519 } | |
520 } | |
521 } | |
522 | |
523 #endif |