< prev index next >

src/hotspot/share/oops/oop.inline.hpp

8211447: Replace oop_pc_update_pointers with oop_iterate and closure

408 
409 // The following method needs to be MT safe.                                                                               
410 uint oopDesc::age() const {                                                                                                
411   assert(!is_forwarded(), "Attempt to read age from forwarded mark");                                                      
412   if (has_displaced_mark_raw()) {                                                                                          
413     return displaced_mark_raw()->age();                                                                                    
414   } else {                                                                                                                 
415     return mark_raw()->age();                                                                                              
416   }                                                                                                                        
417 }                                                                                                                          
418 
419 void oopDesc::incr_age() {                                                                                                 
420   assert(!is_forwarded(), "Attempt to increment age of forwarded mark");                                                   
421   if (has_displaced_mark_raw()) {                                                                                          
422     set_displaced_mark_raw(displaced_mark_raw()->incr_age());                                                              
423   } else {                                                                                                                 
424     set_mark_raw(mark_raw()->incr_age());                                                                                  
425   }                                                                                                                        
426 }                                                                                                                          
427 
428 #if INCLUDE_PARALLELGC                                                                                                     
429                                                                                                                            
430 void oopDesc::pc_update_contents(ParCompactionManager* cm) {                                                               
431   Klass* k = klass();                                                                                                      
432   if (!k->is_typeArray_klass()) {                                                                                          
433     // It might contain oops beyond the header, so take the virtual call.                                                  
434     k->oop_pc_update_pointers(this, cm);                                                                                   
435   }                                                                                                                        
436   // Else skip it.  The TypeArrayKlass in the header never needs scavenging.                                               
437 }                                                                                                                          
438 #endif // INCLUDE_PARALLELGC                                                                                               
439                                                                                                                            
440 template <typename OopClosureType>                                                                                         
441 void oopDesc::oop_iterate(OopClosureType* cl) {                                                                            
442   OopIteratorClosureDispatch::oop_oop_iterate(cl, this, klass());                                                          
443 }                                                                                                                          
444 
445 template <typename OopClosureType>                                                                                         
446 void oopDesc::oop_iterate(OopClosureType* cl, MemRegion mr) {                                                              
447   OopIteratorClosureDispatch::oop_oop_iterate(cl, this, klass(), mr);                                                      
448 }                                                                                                                          
449 
450 template <typename OopClosureType>                                                                                         
451 int oopDesc::oop_iterate_size(OopClosureType* cl) {                                                                        
452   Klass* k = klass();                                                                                                      
453   int size = size_given_klass(k);                                                                                          
454   OopIteratorClosureDispatch::oop_oop_iterate(cl, this, k);                                                                
455   return size;                                                                                                             
456 }                                                                                                                          
457 
458 template <typename OopClosureType>                                                                                         

408 
409 // The following method needs to be MT safe.
410 uint oopDesc::age() const {
411   assert(!is_forwarded(), "Attempt to read age from forwarded mark");
412   if (has_displaced_mark_raw()) {
413     return displaced_mark_raw()->age();
414   } else {
415     return mark_raw()->age();
416   }
417 }
418 
419 void oopDesc::incr_age() {
420   assert(!is_forwarded(), "Attempt to increment age of forwarded mark");
421   if (has_displaced_mark_raw()) {
422     set_displaced_mark_raw(displaced_mark_raw()->incr_age());
423   } else {
424     set_mark_raw(mark_raw()->incr_age());
425   }
426 }
427 












428 template <typename OopClosureType>
429 void oopDesc::oop_iterate(OopClosureType* cl) {
430   OopIteratorClosureDispatch::oop_oop_iterate(cl, this, klass());
431 }
432 
433 template <typename OopClosureType>
434 void oopDesc::oop_iterate(OopClosureType* cl, MemRegion mr) {
435   OopIteratorClosureDispatch::oop_oop_iterate(cl, this, klass(), mr);
436 }
437 
438 template <typename OopClosureType>
439 int oopDesc::oop_iterate_size(OopClosureType* cl) {
440   Klass* k = klass();
441   int size = size_given_klass(k);
442   OopIteratorClosureDispatch::oop_oop_iterate(cl, this, k);
443   return size;
444 }
445 
446 template <typename OopClosureType>
< prev index next >