< prev index next >

src/share/vm/gc/parallel/psPromotionManager.cpp

Print this page
rev 10933 : 8154736: enhancement of cmpxchg and copy_to_survivor for ppc64
Reviewed-by:
Contributed-by: HORII@jp.ibm.com, mdoerr


 422 
 423 void ObjArrayKlass::oop_ps_push_contents(oop obj, PSPromotionManager* pm) {
 424   assert(obj->is_objArray(), "obj must be obj array");
 425   PushContentsClosure cl(pm);
 426   oop_oop_iterate_elements<true>(objArrayOop(obj), &cl);
 427 }
 428 
 429 void TypeArrayKlass::oop_ps_push_contents(oop obj, PSPromotionManager* pm) {
 430   assert(obj->is_typeArray(),"must be a type array");
 431   ShouldNotReachHere();
 432 }
 433 
 434 oop PSPromotionManager::oop_promotion_failed(oop obj, markOop obj_mark) {
 435   assert(_old_gen_is_full || PromotionFailureALot, "Sanity");
 436 
 437   // Attempt to CAS in the header.
 438   // This tests if the header is still the same as when
 439   // this started.  If it is the same (i.e., no forwarding
 440   // pointer has been installed), then this thread owns
 441   // it.
 442   if (obj->cas_forward_to(obj, obj_mark)) {
 443     // We won any races, we "own" this object.
 444     assert(obj == obj->forwardee(), "Sanity");
 445 
 446     _promotion_failed_info.register_copy_failure(obj->size());
 447 
 448     push_contents(obj);
 449 
 450     _preserved_marks->push_if_necessary(obj, obj_mark);
 451   }  else {
 452     // We lost, someone else "owns" this object
 453     guarantee(obj->is_forwarded(), "Object must be forwarded if the cas failed.");
 454 
 455     // No unallocation to worry about.
 456     obj = obj->forwardee();
 457   }
 458 
 459   log_develop_trace(gc, scavenge)("{promotion-failure %s " PTR_FORMAT " (%d)}", obj->klass()->internal_name(), p2i(obj), obj->size());
 460 
 461   return obj;
 462 }


 422 
 423 void ObjArrayKlass::oop_ps_push_contents(oop obj, PSPromotionManager* pm) {
 424   assert(obj->is_objArray(), "obj must be obj array");
 425   PushContentsClosure cl(pm);
 426   oop_oop_iterate_elements<true>(objArrayOop(obj), &cl);
 427 }
 428 
 429 void TypeArrayKlass::oop_ps_push_contents(oop obj, PSPromotionManager* pm) {
 430   assert(obj->is_typeArray(),"must be a type array");
 431   ShouldNotReachHere();
 432 }
 433 
 434 oop PSPromotionManager::oop_promotion_failed(oop obj, markOop obj_mark) {
 435   assert(_old_gen_is_full || PromotionFailureALot, "Sanity");
 436 
 437   // Attempt to CAS in the header.
 438   // This tests if the header is still the same as when
 439   // this started.  If it is the same (i.e., no forwarding
 440   // pointer has been installed), then this thread owns
 441   // it.
 442   if (obj->cas_forward_to(obj, obj_mark, memory_order_relaxed)) {
 443     // We won any races, we "own" this object.
 444     assert(obj == obj->forwardee(), "Sanity");
 445 
 446     _promotion_failed_info.register_copy_failure(obj->size());
 447 
 448     push_contents(obj);
 449 
 450     _preserved_marks->push_if_necessary(obj, obj_mark);
 451   }  else {
 452     // We lost, someone else "owns" this object
 453     guarantee(obj->is_forwarded(), "Object must be forwarded if the cas failed.");
 454 
 455     // No unallocation to worry about.
 456     obj = obj->forwardee();
 457   }
 458 
 459   log_develop_trace(gc, scavenge)("{promotion-failure %s " PTR_FORMAT " (%d)}", obj->klass()->internal_name(), p2i(obj), obj->size());
 460 
 461   return obj;
 462 }
< prev index next >