hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp
changeset 1668 8ec481b8f514
parent 670 ddf3e9583f2f
child 2105 347008ce7984
equal deleted inserted replaced
1667:fc79935c3055 1668:8ec481b8f514
   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     }