comparison src/share/vm/gc_implementation/shared/mutableNUMASpace.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 85f1b9537f70
children 4e400c36026f
comparison
equal deleted inserted replaced
480:d249b360e026 481:7d7a7c599c17
74 for (int i = 0; i < lgrp_spaces()->length(); i++) { 74 for (int i = 0; i < lgrp_spaces()->length(); i++) {
75 LGRPSpace *ls = lgrp_spaces()->at(i); 75 LGRPSpace *ls = lgrp_spaces()->at(i);
76 MutableSpace *s = ls->space(); 76 MutableSpace *s = ls->space();
77 if (s->top() < top()) { // For all spaces preceeding the one containing top() 77 if (s->top() < top()) { // For all spaces preceeding the one containing top()
78 if (s->free_in_words() > 0) { 78 if (s->free_in_words() > 0) {
79 SharedHeap::fill_region_with_object(MemRegion(s->top(), s->end()));
80 size_t area_touched_words = pointer_delta(s->end(), s->top()); 79 size_t area_touched_words = pointer_delta(s->end(), s->top());
80 CollectedHeap::fill_with_object(s->top(), area_touched_words);
81 #ifndef ASSERT 81 #ifndef ASSERT
82 if (!ZapUnusedHeapArea) { 82 if (!ZapUnusedHeapArea) {
83 area_touched_words = MIN2((size_t)align_object_size(typeArrayOopDesc::header_size(T_INT)), 83 area_touched_words = MIN2((size_t)align_object_size(typeArrayOopDesc::header_size(T_INT)),
84 area_touched_words); 84 area_touched_words);
85 } 85 }
684 if (s->contains(value)) { 684 if (s->contains(value)) {
685 // Check if setting the chunk's top to a given value would create a hole less than 685 // Check if setting the chunk's top to a given value would create a hole less than
686 // a minimal object; assuming that's not the last chunk in which case we don't care. 686 // a minimal object; assuming that's not the last chunk in which case we don't care.
687 if (i < lgrp_spaces()->length() - 1) { 687 if (i < lgrp_spaces()->length() - 1) {
688 size_t remainder = pointer_delta(s->end(), value); 688 size_t remainder = pointer_delta(s->end(), value);
689 const size_t minimal_object_size = oopDesc::header_size(); 689 const size_t min_fill_size = CollectedHeap::min_fill_size();
690 if (remainder < minimal_object_size && remainder > 0) { 690 if (remainder < min_fill_size && remainder > 0) {
691 // Add a filler object of a minimal size, it will cross the chunk boundary. 691 // Add a minimum size filler object; it will cross the chunk boundary.
692 SharedHeap::fill_region_with_object(MemRegion(value, minimal_object_size)); 692 CollectedHeap::fill_with_object(value, min_fill_size);
693 value += minimal_object_size; 693 value += min_fill_size;
694 assert(!s->contains(value), "Should be in the next chunk"); 694 assert(!s->contains(value), "Should be in the next chunk");
695 // Restart the loop from the same chunk, since the value has moved 695 // Restart the loop from the same chunk, since the value has moved
696 // to the next one. 696 // to the next one.
697 continue; 697 continue;
698 } 698 }