comparison src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.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 7c2386d67889
comparison
equal deleted inserted replaced
480:d249b360e026 481:7d7a7c599c17
1306 obj_beg = dense_prefix_end - 3; 1306 obj_beg = dense_prefix_end - 3;
1307 obj_len = 3; 1307 obj_len = 3;
1308 } 1308 }
1309 #endif // #ifdef _LP64 1309 #endif // #ifdef _LP64
1310 1310
1311 MemRegion region(obj_beg, obj_len); 1311 gc_heap()->fill_with_object(obj_beg, obj_len);
1312 SharedHeap::fill_region_with_object(region);
1313 _mark_bitmap.mark_obj(obj_beg, obj_len); 1312 _mark_bitmap.mark_obj(obj_beg, obj_len);
1314 _summary_data.add_obj(obj_beg, obj_len); 1313 _summary_data.add_obj(obj_beg, obj_len);
1315 assert(start_array(id) != NULL, "sanity"); 1314 assert(start_array(id) != NULL, "sanity");
1316 start_array(id)->allocate_block(obj_beg); 1315 start_array(id)->allocate_block(obj_beg);
1317 } 1316 }
1805 young_gen->capacity_in_bytes() / K, new_young_size / K); 1804 young_gen->capacity_in_bytes() / K, new_young_size / K);
1806 } 1805 }
1807 1806
1808 // Fill the unused part of the old gen. 1807 // Fill the unused part of the old gen.
1809 MutableSpace* const old_space = old_gen->object_space(); 1808 MutableSpace* const old_space = old_gen->object_space();
1810 MemRegion old_gen_unused(old_space->top(), old_space->end()); 1809 HeapWord* const unused_start = old_space->top();
1811 if (!old_gen_unused.is_empty()) { 1810 size_t const unused_words = pointer_delta(old_space->end(), unused_start);
1812 SharedHeap::fill_region_with_object(old_gen_unused); 1811
1812 if (unused_words > 0) {
1813 if (unused_words < CollectedHeap::min_fill_size()) {
1814 return false; // If the old gen cannot be filled, must give up.
1815 }
1816 CollectedHeap::fill_with_objects(unused_start, unused_words);
1813 } 1817 }
1814 1818
1815 // Take the live data from eden and set both top and end in the old gen to 1819 // Take the live data from eden and set both top and end in the old gen to
1816 // eden top. (Need to set end because reset_after_change() mangles the region 1820 // eden top. (Need to set end because reset_after_change() mangles the region
1817 // from end to virtual_space->high() in debug builds). 1821 // from end to virtual_space->high() in debug builds).
1823 old_space->set_end(new_top); 1827 old_space->set_end(new_top);
1824 old_gen->reset_after_change(); 1828 old_gen->reset_after_change();
1825 1829
1826 // Update the object start array for the filler object and the data from eden. 1830 // Update the object start array for the filler object and the data from eden.
1827 ObjectStartArray* const start_array = old_gen->start_array(); 1831 ObjectStartArray* const start_array = old_gen->start_array();
1828 HeapWord* const start = old_gen_unused.start(); 1832 for (HeapWord* p = unused_start; p < new_top; p += oop(p)->size()) {
1829 for (HeapWord* addr = start; addr < new_top; addr += oop(addr)->size()) { 1833 start_array->allocate_block(p);
1830 start_array->allocate_block(addr);
1831 } 1834 }
1832 1835
1833 // Could update the promoted average here, but it is not typically updated at 1836 // Could update the promoted average here, but it is not typically updated at
1834 // full GCs and the value to use is unclear. Something like 1837 // full GCs and the value to use is unclear. Something like
1835 // 1838 //