472
473 void ObjArrayKlass::oop_ps_push_contents(oop obj, PSPromotionManager* pm) {
474 assert(obj->is_objArray(), "obj must be obj array");
475 PushContentsClosure cl(pm);
476 oop_oop_iterate_elements<true>(objArrayOop(obj), &cl);
477 }
478
479 void TypeArrayKlass::oop_ps_push_contents(oop obj, PSPromotionManager* pm) {
480 assert(obj->is_typeArray(),"must be a type array");
481 ShouldNotReachHere();
482 }
483
484 oop PSPromotionManager::oop_promotion_failed(oop obj, markOop obj_mark) {
485 assert(_old_gen_is_full || PromotionFailureALot, "Sanity");
486
487 // Attempt to CAS in the header.
488 // This tests if the header is still the same as when
489 // this started. If it is the same (i.e., no forwarding
490 // pointer has been installed), then this thread owns
491 // it.
492 if (obj->cas_forward_to(obj, obj_mark)) {
493 // We won any races, we "own" this object.
494 assert(obj == obj->forwardee(), "Sanity");
495
496 _promotion_failed_info.register_copy_failure(obj->size());
497
498 push_contents(obj);
499
500 _preserved_marks->push_if_necessary(obj, obj_mark);
501 } else {
502 // We lost, someone else "owns" this object
503 guarantee(obj->is_forwarded(), "Object must be forwarded if the cas failed.");
504
505 // No unallocation to worry about.
506 obj = obj->forwardee();
507 }
508
509 log_develop_trace(gc, scavenge)("{promotion-failure %s " PTR_FORMAT " (%d)}", obj->klass()->internal_name(), p2i(obj), obj->size());
510
511 return obj;
512 }
|
472
473 void ObjArrayKlass::oop_ps_push_contents(oop obj, PSPromotionManager* pm) {
474 assert(obj->is_objArray(), "obj must be obj array");
475 PushContentsClosure cl(pm);
476 oop_oop_iterate_elements<true>(objArrayOop(obj), &cl);
477 }
478
479 void TypeArrayKlass::oop_ps_push_contents(oop obj, PSPromotionManager* pm) {
480 assert(obj->is_typeArray(),"must be a type array");
481 ShouldNotReachHere();
482 }
483
484 oop PSPromotionManager::oop_promotion_failed(oop obj, markOop obj_mark) {
485 assert(_old_gen_is_full || PromotionFailureALot, "Sanity");
486
487 // Attempt to CAS in the header.
488 // This tests if the header is still the same as when
489 // this started. If it is the same (i.e., no forwarding
490 // pointer has been installed), then this thread owns
491 // it.
492 if (obj->cas_forward_to(obj, obj_mark, memory_order_relaxed)) {
493 // We won any races, we "own" this object.
494 assert(obj == obj->forwardee(), "Sanity");
495
496 _promotion_failed_info.register_copy_failure(obj->size());
497
498 push_contents(obj);
499
500 _preserved_marks->push_if_necessary(obj, obj_mark);
501 } else {
502 // We lost, someone else "owns" this object
503 guarantee(obj->is_forwarded(), "Object must be forwarded if the cas failed.");
504
505 // No unallocation to worry about.
506 obj = obj->forwardee();
507 }
508
509 log_develop_trace(gc, scavenge)("{promotion-failure %s " PTR_FORMAT " (%d)}", obj->klass()->internal_name(), p2i(obj), obj->size());
510
511 return obj;
512 }
|