comparison src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp @ 481:7d7a7c599c17

6578152: fill_region_with_object has usability and safety issues Reviewed-by: apetrusenko, ysr
author jcoomes
date Thu, 11 Dec 2008 12:05:08 -0800
parents d1605aabd0a1
children 0fbdb4381b99
comparison
equal deleted inserted replaced
480:d249b360e026 481:7d7a7c599c17
497 } 497 }
498 } else { 498 } else {
499 // We lost, someone else "owns" this object 499 // We lost, someone else "owns" this object
500 guarantee(o->is_forwarded(), "Object must be forwarded if the cas failed."); 500 guarantee(o->is_forwarded(), "Object must be forwarded if the cas failed.");
501 501
502 // Unallocate the space used. NOTE! We may have directly allocated 502 // Try to deallocate the space. If it was directly allocated we cannot
503 // the object. If so, we cannot deallocate it, so we have to test! 503 // deallocate it, so we have to test. If the deallocation fails,
504 // overwrite with a filler object.
504 if (new_obj_is_tenured) { 505 if (new_obj_is_tenured) {
505 if (!_old_lab.unallocate_object(new_obj)) { 506 if (!_old_lab.unallocate_object(new_obj)) {
506 // The promotion lab failed to unallocate the object. 507 CollectedHeap::fill_with_object((HeapWord*) new_obj, new_obj_size);
507 // We need to overwrite the object with a filler that
508 // contains no interior pointers.
509 MemRegion mr((HeapWord*)new_obj, new_obj_size);
510 // Clean this up and move to oopFactory (see bug 4718422)
511 SharedHeap::fill_region_with_object(mr);
512 } 508 }
513 } else { 509 } else if (!_young_lab.unallocate_object(new_obj)) {
514 if (!_young_lab.unallocate_object(new_obj)) { 510 CollectedHeap::fill_with_object((HeapWord*) new_obj, new_obj_size);
515 // The promotion lab failed to unallocate the object.
516 // We need to overwrite the object with a filler that
517 // contains no interior pointers.
518 MemRegion mr((HeapWord*)new_obj, new_obj_size);
519 // Clean this up and move to oopFactory (see bug 4718422)
520 SharedHeap::fill_region_with_object(mr);
521 }
522 } 511 }
523 512
524 // don't update this before the unallocation! 513 // don't update this before the unallocation!
525 new_obj = o->forwardee(); 514 new_obj = o->forwardee();
526 } 515 }