< prev index next >

src/hotspot/share/gc/parallel/mutableNUMASpace.cpp

Print this page
rev 47862 : [mq]: webrev.0


  73 }
  74 void MutableNUMASpace::set_top_for_allocations() {
  75   // This method should do nothing.
  76 }
  77 void MutableNUMASpace::check_mangled_unused_area(HeapWord* limit) {
  78   // This method should do nothing.
  79 }
  80 void MutableNUMASpace::check_mangled_unused_area_complete() {
  81   // This method should do nothing.
  82 }
  83 #endif  // NOT_PRODUCT
  84 
  85 // There may be unallocated holes in the middle chunks
  86 // that should be filled with dead objects to ensure parsability.
  87 void MutableNUMASpace::ensure_parsability() {
  88   for (int i = 0; i < lgrp_spaces()->length(); i++) {
  89     LGRPSpace *ls = lgrp_spaces()->at(i);
  90     MutableSpace *s = ls->space();
  91     if (s->top() < top()) { // For all spaces preceding the one containing top()
  92       if (s->free_in_words() > 0) {
  93         intptr_t cur_top = (intptr_t)s->top();
  94         size_t words_left_to_fill = pointer_delta(s->end(), s->top());;
  95         while (words_left_to_fill > 0) {
  96           size_t words_to_fill = MIN2(words_left_to_fill, CollectedHeap::filler_array_max_size());
  97           assert(words_to_fill >= CollectedHeap::min_fill_size(),
  98                  "Remaining size (" SIZE_FORMAT ") is too small to fill (based on " SIZE_FORMAT " and " SIZE_FORMAT ")",
  99                  words_to_fill, words_left_to_fill, CollectedHeap::filler_array_max_size());
 100           CollectedHeap::fill_with_object((HeapWord*)cur_top, words_to_fill);
 101           if (!os::numa_has_static_binding()) {
 102             size_t touched_words = words_to_fill;
 103 #ifndef ASSERT
 104             if (!ZapUnusedHeapArea) {
 105               touched_words = MIN2((size_t)align_object_size(typeArrayOopDesc::header_size(T_INT)),
 106                 touched_words);
 107             }
 108 #endif
 109             MemRegion invalid;
 110             HeapWord *crossing_start = align_up((HeapWord*)cur_top, os::vm_page_size());
 111             HeapWord *crossing_end = align_down((HeapWord*)(cur_top + touched_words), os::vm_page_size());
 112             if (crossing_start != crossing_end) {
 113               // If object header crossed a small page boundary we mark the area
 114               // as invalid rounding it to a page_size().
 115               HeapWord *start = MAX2(align_down((HeapWord*)cur_top, page_size()), s->bottom());
 116               HeapWord *end = MIN2(align_up((HeapWord*)(cur_top + touched_words), page_size()), s->end());
 117               invalid = MemRegion(start, end);
 118             }
 119 
 120             ls->add_invalid_region(invalid);
 121           }
 122           cur_top = cur_top + (words_to_fill * HeapWordSize);
 123           words_left_to_fill -= words_to_fill;
 124         }
 125       }
 126     } else {
 127       if (!os::numa_has_static_binding()) {
 128 #ifdef ASSERT
 129         MemRegion invalid(s->top(), s->end());
 130         ls->add_invalid_region(invalid);
 131 #else
 132         if (ZapUnusedHeapArea) {
 133           MemRegion invalid(s->top(), s->end());
 134           ls->add_invalid_region(invalid);
 135         } else {
 136           return;
 137         }
 138 #endif
 139       } else {
 140           return;
 141       }
 142     }




  73 }
  74 void MutableNUMASpace::set_top_for_allocations() {
  75   // This method should do nothing.
  76 }
  77 void MutableNUMASpace::check_mangled_unused_area(HeapWord* limit) {
  78   // This method should do nothing.
  79 }
  80 void MutableNUMASpace::check_mangled_unused_area_complete() {
  81   // This method should do nothing.
  82 }
  83 #endif  // NOT_PRODUCT
  84 
  85 // There may be unallocated holes in the middle chunks
  86 // that should be filled with dead objects to ensure parsability.
  87 void MutableNUMASpace::ensure_parsability() {
  88   for (int i = 0; i < lgrp_spaces()->length(); i++) {
  89     LGRPSpace *ls = lgrp_spaces()->at(i);
  90     MutableSpace *s = ls->space();
  91     if (s->top() < top()) { // For all spaces preceding the one containing top()
  92       if (s->free_in_words() > 0) {
  93         HeapWord* cur_top = s->top();
  94         size_t words_left_to_fill = pointer_delta(s->end(), s->top());;
  95         while (words_left_to_fill > 0) {
  96           size_t words_to_fill = MIN2(words_left_to_fill, CollectedHeap::filler_array_max_size());
  97           assert(words_to_fill >= CollectedHeap::min_fill_size(),
  98                  "Remaining size (" SIZE_FORMAT ") is too small to fill (based on " SIZE_FORMAT " and " SIZE_FORMAT ")",
  99                  words_to_fill, words_left_to_fill, CollectedHeap::filler_array_max_size());
 100           CollectedHeap::fill_with_object(cur_top, words_to_fill);
 101           if (!os::numa_has_static_binding()) {
 102             size_t touched_words = words_to_fill;
 103 #ifndef ASSERT
 104             if (!ZapUnusedHeapArea) {
 105               touched_words = MIN2((size_t)align_object_size(typeArrayOopDesc::header_size(T_INT)),
 106                 touched_words);
 107             }
 108 #endif
 109             MemRegion invalid;
 110             HeapWord *crossing_start = align_up(cur_top, os::vm_page_size());
 111             HeapWord *crossing_end = align_down(cur_top + touched_words, os::vm_page_size());
 112             if (crossing_start != crossing_end) {
 113               // If object header crossed a small page boundary we mark the area
 114               // as invalid rounding it to a page_size().
 115               HeapWord *start = MAX2(align_down(cur_top, page_size()), s->bottom());
 116               HeapWord *end = MIN2(align_up(cur_top + touched_words, page_size()), s->end());
 117               invalid = MemRegion(start, end);
 118             }
 119 
 120             ls->add_invalid_region(invalid);
 121           }
 122           cur_top += words_to_fill;
 123           words_left_to_fill -= words_to_fill;
 124         }
 125       }
 126     } else {
 127       if (!os::numa_has_static_binding()) {
 128 #ifdef ASSERT
 129         MemRegion invalid(s->top(), s->end());
 130         ls->add_invalid_region(invalid);
 131 #else
 132         if (ZapUnusedHeapArea) {
 133           MemRegion invalid(s->top(), s->end());
 134           ls->add_invalid_region(invalid);
 135         } else {
 136           return;
 137         }
 138 #endif
 139       } else {
 140           return;
 141       }
 142     }


< prev index next >