comparison src/share/vm/oops/instanceRefKlass.cpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents c52a6a39546c
children aed758eda82a
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
56 if (!oopDesc::is_null(heap_oop)) { 56 if (!oopDesc::is_null(heap_oop)) {
57 oop referent = oopDesc::decode_heap_oop_not_null(heap_oop); 57 oop referent = oopDesc::decode_heap_oop_not_null(heap_oop);
58 if (!referent->is_gc_marked() && 58 if (!referent->is_gc_marked() &&
59 MarkSweep::ref_processor()->discover_reference(obj, ref->reference_type())) { 59 MarkSweep::ref_processor()->discover_reference(obj, ref->reference_type())) {
60 // reference was discovered, referent will be traversed later 60 // reference was discovered, referent will be traversed later
61 ref->instanceKlass::oop_follow_contents(obj); 61 ref->InstanceKlass::oop_follow_contents(obj);
62 debug_only( 62 debug_only(
63 if(TraceReferenceGC && PrintGCDetails) { 63 if(TraceReferenceGC && PrintGCDetails) {
64 gclog_or_tty->print_cr(" Non NULL enqueued " INTPTR_FORMAT, obj); 64 gclog_or_tty->print_cr(" Non NULL enqueued " INTPTR_FORMAT, obj);
65 } 65 }
66 ) 66 )
107 if(TraceReferenceGC && PrintGCDetails) { 107 if(TraceReferenceGC && PrintGCDetails) {
108 gclog_or_tty->print_cr(" Process next as normal " INTPTR_FORMAT, next_addr); 108 gclog_or_tty->print_cr(" Process next as normal " INTPTR_FORMAT, next_addr);
109 } 109 }
110 ) 110 )
111 MarkSweep::mark_and_push(next_addr); 111 MarkSweep::mark_and_push(next_addr);
112 ref->instanceKlass::oop_follow_contents(obj); 112 ref->InstanceKlass::oop_follow_contents(obj);
113 } 113 }
114 114
115 void instanceRefKlass::oop_follow_contents(oop obj) { 115 void instanceRefKlass::oop_follow_contents(oop obj) {
116 if (UseCompressedOops) { 116 if (UseCompressedOops) {
117 specialized_oop_follow_contents<narrowOop>(this, obj); 117 specialized_oop_follow_contents<narrowOop>(this, obj);
136 oop referent = oopDesc::decode_heap_oop_not_null(heap_oop); 136 oop referent = oopDesc::decode_heap_oop_not_null(heap_oop);
137 if (PSParallelCompact::mark_bitmap()->is_unmarked(referent) && 137 if (PSParallelCompact::mark_bitmap()->is_unmarked(referent) &&
138 PSParallelCompact::ref_processor()-> 138 PSParallelCompact::ref_processor()->
139 discover_reference(obj, ref->reference_type())) { 139 discover_reference(obj, ref->reference_type())) {
140 // reference already enqueued, referent will be traversed later 140 // reference already enqueued, referent will be traversed later
141 ref->instanceKlass::oop_follow_contents(cm, obj); 141 ref->InstanceKlass::oop_follow_contents(cm, obj);
142 debug_only( 142 debug_only(
143 if(TraceReferenceGC && PrintGCDetails) { 143 if(TraceReferenceGC && PrintGCDetails) {
144 gclog_or_tty->print_cr(" Non NULL enqueued " INTPTR_FORMAT, obj); 144 gclog_or_tty->print_cr(" Non NULL enqueued " INTPTR_FORMAT, obj);
145 } 145 }
146 ) 146 )
181 err_msg("Found an inactive reference " PTR_FORMAT " with a non-NULL discovered field", 181 err_msg("Found an inactive reference " PTR_FORMAT " with a non-NULL discovered field",
182 (oopDesc*)obj)); 182 (oopDesc*)obj));
183 #endif 183 #endif
184 } 184 }
185 PSParallelCompact::mark_and_push(cm, next_addr); 185 PSParallelCompact::mark_and_push(cm, next_addr);
186 ref->instanceKlass::oop_follow_contents(cm, obj); 186 ref->InstanceKlass::oop_follow_contents(cm, obj);
187 } 187 }
188 188
189 void instanceRefKlass::oop_follow_contents(ParCompactionManager* cm, 189 void instanceRefKlass::oop_follow_contents(ParCompactionManager* cm,
190 oop obj) { 190 oop obj) {
191 if (UseCompressedOops) { 191 if (UseCompressedOops) {
229 referent_addr, next_addr, discovered_addr);) 229 referent_addr, next_addr, discovered_addr);)
230 } 230 }
231 231
232 int instanceRefKlass::oop_adjust_pointers(oop obj) { 232 int instanceRefKlass::oop_adjust_pointers(oop obj) {
233 int size = size_helper(); 233 int size = size_helper();
234 instanceKlass::oop_adjust_pointers(obj); 234 InstanceKlass::oop_adjust_pointers(obj);
235 235
236 if (UseCompressedOops) { 236 if (UseCompressedOops) {
237 specialized_oop_adjust_pointers<narrowOop>(this, obj); 237 specialized_oop_adjust_pointers<narrowOop>(this, obj);
238 } else { 238 } else {
239 specialized_oop_adjust_pointers<oop>(this, obj); 239 specialized_oop_adjust_pointers<oop>(this, obj);
306 int instanceRefKlass:: \ 306 int instanceRefKlass:: \
307 oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { \ 307 oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { \
308 /* Get size before changing pointers */ \ 308 /* Get size before changing pointers */ \
309 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\ 309 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\
310 \ 310 \
311 int size = instanceKlass::oop_oop_iterate##nv_suffix(obj, closure); \ 311 int size = InstanceKlass::oop_oop_iterate##nv_suffix(obj, closure); \
312 \ 312 \
313 if (UseCompressedOops) { \ 313 if (UseCompressedOops) { \
314 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, contains); \ 314 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, contains); \
315 } else { \ 315 } else { \
316 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, contains); \ 316 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, contains); \
323 int instanceRefKlass:: \ 323 int instanceRefKlass:: \
324 oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) { \ 324 oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) { \
325 /* Get size before changing pointers */ \ 325 /* Get size before changing pointers */ \
326 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\ 326 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\
327 \ 327 \
328 int size = instanceKlass::oop_oop_iterate_backwards##nv_suffix(obj, closure); \ 328 int size = InstanceKlass::oop_oop_iterate_backwards##nv_suffix(obj, closure); \
329 \ 329 \
330 if (UseCompressedOops) { \ 330 if (UseCompressedOops) { \
331 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, contains); \ 331 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, contains); \
332 } else { \ 332 } else { \
333 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, contains); \ 333 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, contains); \
342 oop_oop_iterate##nv_suffix##_m(oop obj, \ 342 oop_oop_iterate##nv_suffix##_m(oop obj, \
343 OopClosureType* closure, \ 343 OopClosureType* closure, \
344 MemRegion mr) { \ 344 MemRegion mr) { \
345 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\ 345 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\
346 \ 346 \
347 int size = instanceKlass::oop_oop_iterate##nv_suffix##_m(obj, closure, mr); \ 347 int size = InstanceKlass::oop_oop_iterate##nv_suffix##_m(obj, closure, mr); \
348 if (UseCompressedOops) { \ 348 if (UseCompressedOops) { \
349 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, mr.contains); \ 349 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, mr.contains); \
350 } else { \ 350 } else { \
351 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, mr.contains); \ 351 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, mr.contains); \
352 } \ 352 } \
368 T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); 368 T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);
369 if (PSScavenge::should_scavenge(referent_addr)) { 369 if (PSScavenge::should_scavenge(referent_addr)) {
370 ReferenceProcessor* rp = PSScavenge::reference_processor(); 370 ReferenceProcessor* rp = PSScavenge::reference_processor();
371 if (rp->discover_reference(obj, ref->reference_type())) { 371 if (rp->discover_reference(obj, ref->reference_type())) {
372 // reference already enqueued, referent and next will be traversed later 372 // reference already enqueued, referent and next will be traversed later
373 ref->instanceKlass::oop_push_contents(pm, obj); 373 ref->InstanceKlass::oop_push_contents(pm, obj);
374 return; 374 return;
375 } else { 375 } else {
376 // treat referent as normal oop 376 // treat referent as normal oop
377 pm->claim_or_forward_depth(referent_addr); 377 pm->claim_or_forward_depth(referent_addr);
378 } 378 }
409 409
410 // Treat next as normal oop; next is a link in the reference queue. 410 // Treat next as normal oop; next is a link in the reference queue.
411 if (PSScavenge::should_scavenge(next_addr)) { 411 if (PSScavenge::should_scavenge(next_addr)) {
412 pm->claim_or_forward_depth(next_addr); 412 pm->claim_or_forward_depth(next_addr);
413 } 413 }
414 ref->instanceKlass::oop_push_contents(pm, obj); 414 ref->InstanceKlass::oop_push_contents(pm, obj);
415 } 415 }
416 416
417 void instanceRefKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { 417 void instanceRefKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
418 if (UseCompressedOops) { 418 if (UseCompressedOops) {
419 specialized_oop_push_contents<narrowOop>(this, pm, obj); 419 specialized_oop_push_contents<narrowOop>(this, pm, obj);
434 debug_only(trace_reference_gc("instanceRefKlass::oop_update_ptrs", obj, 434 debug_only(trace_reference_gc("instanceRefKlass::oop_update_ptrs", obj,
435 referent_addr, next_addr, discovered_addr);) 435 referent_addr, next_addr, discovered_addr);)
436 } 436 }
437 437
438 int instanceRefKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { 438 int instanceRefKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
439 instanceKlass::oop_update_pointers(cm, obj); 439 InstanceKlass::oop_update_pointers(cm, obj);
440 if (UseCompressedOops) { 440 if (UseCompressedOops) {
441 specialized_oop_update_pointers<narrowOop>(this, cm, obj); 441 specialized_oop_update_pointers<narrowOop>(this, cm, obj);
442 } else { 442 } else {
443 specialized_oop_update_pointers<oop>(this, cm, obj); 443 specialized_oop_update_pointers<oop>(this, cm, obj);
444 } 444 }
445 return size_helper(); 445 return size_helper();
446 } 446 }
447 #endif // SERIALGC 447 #endif // SERIALGC
448 448
449 void instanceRefKlass::update_nonstatic_oop_maps(klassOop k) { 449 void instanceRefKlass::update_nonstatic_oop_maps(Klass* k) {
450 // Clear the nonstatic oop-map entries corresponding to referent 450 // Clear the nonstatic oop-map entries corresponding to referent
451 // and nextPending field. They are treated specially by the 451 // and nextPending field. They are treated specially by the
452 // garbage collector. 452 // garbage collector.
453 // The discovered field is used only by the garbage collector 453 // The discovered field is used only by the garbage collector
454 // and is also treated specially. 454 // and is also treated specially.
455 instanceKlass* ik = instanceKlass::cast(k); 455 InstanceKlass* ik = InstanceKlass::cast(k);
456 456
457 // Check that we have the right class 457 // Check that we have the right class
458 debug_only(static bool first_time = true); 458 debug_only(static bool first_time = true);
459 assert(k == SystemDictionary::Reference_klass() && first_time, 459 assert(k == SystemDictionary::Reference_klass() && first_time,
460 "Invalid update of maps"); 460 "Invalid update of maps");
484 484
485 485
486 // Verification 486 // Verification
487 487
488 void instanceRefKlass::oop_verify_on(oop obj, outputStream* st) { 488 void instanceRefKlass::oop_verify_on(oop obj, outputStream* st) {
489 instanceKlass::oop_verify_on(obj, st); 489 InstanceKlass::oop_verify_on(obj, st);
490 // Verify referent field 490 // Verify referent field
491 oop referent = java_lang_ref_Reference::referent(obj); 491 oop referent = java_lang_ref_Reference::referent(obj);
492 492
493 // We should make this general to all heaps 493 // We should make this general to all heaps
494 GenCollectedHeap* gch = NULL; 494 GenCollectedHeap* gch = NULL;