33 |
33 |
34 c->set_length(length); |
34 c->set_length(length); |
35 c->set_tags(NULL); |
35 c->set_tags(NULL); |
36 c->set_cache(NULL); |
36 c->set_cache(NULL); |
37 c->set_pool_holder(NULL); |
37 c->set_pool_holder(NULL); |
|
38 c->set_flags(0); |
38 // only set to non-zero if constant pool is merged by RedefineClasses |
39 // only set to non-zero if constant pool is merged by RedefineClasses |
39 c->set_orig_length(0); |
40 c->set_orig_length(0); |
40 // all fields are initialized; needed for GC |
41 // all fields are initialized; needed for GC |
41 |
42 |
42 // initialize tag array |
43 // initialize tag array |
259 return cp->object_size(); |
260 return cp->object_size(); |
260 } |
261 } |
261 |
262 |
262 void constantPoolKlass::oop_copy_contents(PSPromotionManager* pm, oop obj) { |
263 void constantPoolKlass::oop_copy_contents(PSPromotionManager* pm, oop obj) { |
263 assert(obj->is_constantPool(), "should be constant pool"); |
264 assert(obj->is_constantPool(), "should be constant pool"); |
|
265 constantPoolOop cp = (constantPoolOop) obj; |
|
266 if (AnonymousClasses && cp->has_pseudo_string() && cp->tags() != NULL) { |
|
267 oop* base = (oop*)cp->base(); |
|
268 for (int i = 0; i < cp->length(); ++i, ++base) { |
|
269 if (cp->tag_at(i).is_string()) { |
|
270 if (PSScavenge::should_scavenge(base)) { |
|
271 pm->claim_or_forward_breadth(base); |
|
272 } |
|
273 } |
|
274 } |
|
275 } |
264 } |
276 } |
265 |
277 |
266 void constantPoolKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { |
278 void constantPoolKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { |
267 assert(obj->is_constantPool(), "should be constant pool"); |
279 assert(obj->is_constantPool(), "should be constant pool"); |
|
280 constantPoolOop cp = (constantPoolOop) obj; |
|
281 if (AnonymousClasses && cp->has_pseudo_string() && cp->tags() != NULL) { |
|
282 oop* base = (oop*)cp->base(); |
|
283 for (int i = 0; i < cp->length(); ++i, ++base) { |
|
284 if (cp->tag_at(i).is_string()) { |
|
285 if (PSScavenge::should_scavenge(base)) { |
|
286 pm->claim_or_forward_depth(base); |
|
287 } |
|
288 } |
|
289 } |
|
290 } |
268 } |
291 } |
269 #endif // SERIALGC |
292 #endif // SERIALGC |
270 |
293 |
271 #ifndef PRODUCT |
294 #ifndef PRODUCT |
272 |
295 |
276 EXCEPTION_MARK; |
299 EXCEPTION_MARK; |
277 oop anObj; |
300 oop anObj; |
278 assert(obj->is_constantPool(), "must be constantPool"); |
301 assert(obj->is_constantPool(), "must be constantPool"); |
279 Klass::oop_print_on(obj, st); |
302 Klass::oop_print_on(obj, st); |
280 constantPoolOop cp = constantPoolOop(obj); |
303 constantPoolOop cp = constantPoolOop(obj); |
|
304 if (cp->flags() != 0) { |
|
305 st->print(" - flags : 0x%x", cp->flags()); |
|
306 if (cp->has_pseudo_string()) st->print(" has_pseudo_string"); |
|
307 st->cr(); |
|
308 } |
281 |
309 |
282 // Temp. remove cache so we can do lookups with original indicies. |
310 // Temp. remove cache so we can do lookups with original indicies. |
283 constantPoolCacheHandle cache (THREAD, cp->cache()); |
311 constantPoolCacheHandle cache (THREAD, cp->cache()); |
284 cp->set_cache(NULL); |
312 cp->set_cache(NULL); |
285 |
313 |
300 st->print("klass_index=%d", cp->klass_ref_index_at(index)); |
328 st->print("klass_index=%d", cp->klass_ref_index_at(index)); |
301 st->print(" name_and_type_index=%d", cp->name_and_type_ref_index_at(index)); |
329 st->print(" name_and_type_index=%d", cp->name_and_type_ref_index_at(index)); |
302 break; |
330 break; |
303 case JVM_CONSTANT_UnresolvedString : |
331 case JVM_CONSTANT_UnresolvedString : |
304 case JVM_CONSTANT_String : |
332 case JVM_CONSTANT_String : |
305 anObj = cp->string_at(index, CATCH); |
333 if (cp->is_pseudo_string_at(index)) { |
|
334 anObj = cp->pseudo_string_at(index); |
|
335 } else { |
|
336 anObj = cp->string_at(index, CATCH); |
|
337 } |
306 anObj->print_value_on(st); |
338 anObj->print_value_on(st); |
307 st->print(" {0x%lx}", (address)anObj); |
339 st->print(" {0x%lx}", (address)anObj); |
308 break; |
340 break; |
309 case JVM_CONSTANT_Integer : |
341 case JVM_CONSTANT_Integer : |
310 st->print("%d", cp->int_at(index)); |
342 st->print("%d", cp->int_at(index)); |
380 guarantee((*base)->is_perm(), "should be in permspace"); |
412 guarantee((*base)->is_perm(), "should be in permspace"); |
381 guarantee((*base)->is_symbol() || (*base)->is_instance(), |
413 guarantee((*base)->is_symbol() || (*base)->is_instance(), |
382 "should be symbol or instance"); |
414 "should be symbol or instance"); |
383 } |
415 } |
384 if (cp->tag_at(i).is_string()) { |
416 if (cp->tag_at(i).is_string()) { |
385 guarantee((*base)->is_perm(), "should be in permspace"); |
417 if (!cp->has_pseudo_string()) { |
386 guarantee((*base)->is_instance(), "should be instance"); |
418 guarantee((*base)->is_perm(), "should be in permspace"); |
|
419 guarantee((*base)->is_instance(), "should be instance"); |
|
420 } else { |
|
421 // can be non-perm, can be non-instance (array) |
|
422 } |
387 } |
423 } |
388 base++; |
424 base++; |
389 } |
425 } |
390 guarantee(cp->tags()->is_perm(), "should be in permspace"); |
426 guarantee(cp->tags()->is_perm(), "should be in permspace"); |
391 guarantee(cp->tags()->is_typeArray(), "should be type array"); |
427 guarantee(cp->tags()->is_typeArray(), "should be type array"); |