Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.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 | 27a80744a83b |
children | 569b3b226089 |
comparison
equal
deleted
inserted
replaced
480:d249b360e026 | 481:7d7a7c599c17 |
---|---|
2952 assert(_cm->isPrevMarked(obj), "Should be marked!"); | 2952 assert(_cm->isPrevMarked(obj), "Should be marked!"); |
2953 } else { | 2953 } else { |
2954 // The object has been either evacuated or is dead. Fill it with a | 2954 // The object has been either evacuated or is dead. Fill it with a |
2955 // dummy object. | 2955 // dummy object. |
2956 MemRegion mr((HeapWord*)obj, obj->size()); | 2956 MemRegion mr((HeapWord*)obj, obj->size()); |
2957 SharedHeap::fill_region_with_object(mr); | 2957 CollectedHeap::fill_with_object(mr); |
2958 _cm->clearRangeBothMaps(mr); | 2958 _cm->clearRangeBothMaps(mr); |
2959 } | 2959 } |
2960 } | 2960 } |
2961 }; | 2961 }; |
2962 | 2962 |
3223 // If there's too little space, no one can allocate, so we're done. | 3223 // If there's too little space, no one can allocate, so we're done. |
3224 if (free_words < (size_t)oopDesc::header_size()) return; | 3224 if (free_words < (size_t)oopDesc::header_size()) return; |
3225 // Otherwise, try to claim it. | 3225 // Otherwise, try to claim it. |
3226 block = r->par_allocate(free_words); | 3226 block = r->par_allocate(free_words); |
3227 } while (block == NULL); | 3227 } while (block == NULL); |
3228 SharedHeap::fill_region_with_object(MemRegion(block, free_words)); | 3228 fill_with_object(block, free_words); |
3229 } | 3229 } |
3230 | 3230 |
3231 #define use_local_bitmaps 1 | 3231 #define use_local_bitmaps 1 |
3232 #define verify_local_bitmaps 0 | 3232 #define verify_local_bitmaps 0 |
3233 | 3233 |
3617 void undo_allocation(GCAllocPurpose purpose, HeapWord* obj, size_t word_sz) { | 3617 void undo_allocation(GCAllocPurpose purpose, HeapWord* obj, size_t word_sz) { |
3618 if (alloc_buffer(purpose)->contains(obj)) { | 3618 if (alloc_buffer(purpose)->contains(obj)) { |
3619 guarantee(alloc_buffer(purpose)->contains(obj + word_sz - 1), | 3619 guarantee(alloc_buffer(purpose)->contains(obj + word_sz - 1), |
3620 "should contain whole object"); | 3620 "should contain whole object"); |
3621 alloc_buffer(purpose)->undo_allocation(obj, word_sz); | 3621 alloc_buffer(purpose)->undo_allocation(obj, word_sz); |
3622 } | 3622 } else { |
3623 else { | 3623 CollectedHeap::fill_with_object(obj, word_sz); |
3624 SharedHeap::fill_region_with_object(MemRegion(obj, word_sz)); | |
3625 add_to_undo_waste(word_sz); | 3624 add_to_undo_waste(word_sz); |
3626 } | 3625 } |
3627 } | 3626 } |
3628 | 3627 |
3629 void set_evac_failure_closure(OopsInHeapRegionClosure* evac_failure_cl) { | 3628 void set_evac_failure_closure(OopsInHeapRegionClosure* evac_failure_cl) { |