68 // This method should do nothing.
69 }
70 void MutableNUMASpace::check_mangled_unused_area_complete() {
71 // This method should do nothing.
72 }
73 #endif // NOT_PRODUCT
74
75 // There may be unallocated holes in the middle chunks
76 // that should be filled with dead objects to ensure parsability.
77 void MutableNUMASpace::ensure_parsability() {
78 for (int i = 0; i < lgrp_spaces()->length(); i++) {
79 LGRPSpace *ls = lgrp_spaces()->at(i);
80 MutableSpace *s = ls->space();
81 if (s->top() < top()) { // For all spaces preceding the one containing top()
82 if (s->free_in_words() > 0) {
83 intptr_t cur_top = (intptr_t)s->top();
84 size_t words_left_to_fill = pointer_delta(s->end(), s->top());;
85 while (words_left_to_fill > 0) {
86 size_t words_to_fill = MIN2(words_left_to_fill, CollectedHeap::filler_array_max_size());
87 assert(words_to_fill >= CollectedHeap::min_fill_size(),
88 err_msg("Remaining size (" SIZE_FORMAT ") is too small to fill (based on " SIZE_FORMAT " and " SIZE_FORMAT ")",
89 words_to_fill, words_left_to_fill, CollectedHeap::filler_array_max_size()));
90 CollectedHeap::fill_with_object((HeapWord*)cur_top, words_to_fill);
91 if (!os::numa_has_static_binding()) {
92 size_t touched_words = words_to_fill;
93 #ifndef ASSERT
94 if (!ZapUnusedHeapArea) {
95 touched_words = MIN2((size_t)align_object_size(typeArrayOopDesc::header_size(T_INT)),
96 touched_words);
97 }
98 #endif
99 MemRegion invalid;
100 HeapWord *crossing_start = (HeapWord*)round_to(cur_top, os::vm_page_size());
101 HeapWord *crossing_end = (HeapWord*)round_to(cur_top + touched_words, os::vm_page_size());
102 if (crossing_start != crossing_end) {
103 // If object header crossed a small page boundary we mark the area
104 // as invalid rounding it to a page_size().
105 HeapWord *start = MAX2((HeapWord*)round_down(cur_top, page_size()), s->bottom());
106 HeapWord *end = MIN2((HeapWord*)round_to(cur_top + touched_words, page_size()), s->end());
107 invalid = MemRegion(start, end);
108 }
109
954 char* range_end = (char*)round_down((intptr_t) space()->end(), page_size);
955
956 if (range_start > last_page_scanned() || last_page_scanned() >= range_end) {
957 set_last_page_scanned(range_start);
958 }
959
960 char *scan_start = last_page_scanned();
961 char* scan_end = MIN2(scan_start + page_size * page_count, range_end);
962
963 os::page_info page_expected, page_found;
964 page_expected.size = page_size;
965 page_expected.lgrp_id = lgrp_id();
966
967 char *s = scan_start;
968 while (s < scan_end) {
969 char *e = os::scan_pages(s, (char*)scan_end, &page_expected, &page_found);
970 if (e == NULL) {
971 break;
972 }
973 if (e != scan_end) {
974 assert(e < scan_end, err_msg("e: " PTR_FORMAT " scan_end: " PTR_FORMAT, p2i(e), p2i(scan_end)));
975
976 if ((page_expected.size != page_size || page_expected.lgrp_id != lgrp_id())
977 && page_expected.size != 0) {
978 os::free_memory(s, pointer_delta(e, s, sizeof(char)), page_size);
979 }
980 page_expected = page_found;
981 }
982 s = e;
983 }
984
985 set_last_page_scanned(scan_end);
986 }
|
68 // This method should do nothing.
69 }
70 void MutableNUMASpace::check_mangled_unused_area_complete() {
71 // This method should do nothing.
72 }
73 #endif // NOT_PRODUCT
74
75 // There may be unallocated holes in the middle chunks
76 // that should be filled with dead objects to ensure parsability.
77 void MutableNUMASpace::ensure_parsability() {
78 for (int i = 0; i < lgrp_spaces()->length(); i++) {
79 LGRPSpace *ls = lgrp_spaces()->at(i);
80 MutableSpace *s = ls->space();
81 if (s->top() < top()) { // For all spaces preceding the one containing top()
82 if (s->free_in_words() > 0) {
83 intptr_t cur_top = (intptr_t)s->top();
84 size_t words_left_to_fill = pointer_delta(s->end(), s->top());;
85 while (words_left_to_fill > 0) {
86 size_t words_to_fill = MIN2(words_left_to_fill, CollectedHeap::filler_array_max_size());
87 assert(words_to_fill >= CollectedHeap::min_fill_size(),
88 "Remaining size (" SIZE_FORMAT ") is too small to fill (based on " SIZE_FORMAT " and " SIZE_FORMAT ")",
89 words_to_fill, words_left_to_fill, CollectedHeap::filler_array_max_size());
90 CollectedHeap::fill_with_object((HeapWord*)cur_top, words_to_fill);
91 if (!os::numa_has_static_binding()) {
92 size_t touched_words = words_to_fill;
93 #ifndef ASSERT
94 if (!ZapUnusedHeapArea) {
95 touched_words = MIN2((size_t)align_object_size(typeArrayOopDesc::header_size(T_INT)),
96 touched_words);
97 }
98 #endif
99 MemRegion invalid;
100 HeapWord *crossing_start = (HeapWord*)round_to(cur_top, os::vm_page_size());
101 HeapWord *crossing_end = (HeapWord*)round_to(cur_top + touched_words, os::vm_page_size());
102 if (crossing_start != crossing_end) {
103 // If object header crossed a small page boundary we mark the area
104 // as invalid rounding it to a page_size().
105 HeapWord *start = MAX2((HeapWord*)round_down(cur_top, page_size()), s->bottom());
106 HeapWord *end = MIN2((HeapWord*)round_to(cur_top + touched_words, page_size()), s->end());
107 invalid = MemRegion(start, end);
108 }
109
954 char* range_end = (char*)round_down((intptr_t) space()->end(), page_size);
955
956 if (range_start > last_page_scanned() || last_page_scanned() >= range_end) {
957 set_last_page_scanned(range_start);
958 }
959
960 char *scan_start = last_page_scanned();
961 char* scan_end = MIN2(scan_start + page_size * page_count, range_end);
962
963 os::page_info page_expected, page_found;
964 page_expected.size = page_size;
965 page_expected.lgrp_id = lgrp_id();
966
967 char *s = scan_start;
968 while (s < scan_end) {
969 char *e = os::scan_pages(s, (char*)scan_end, &page_expected, &page_found);
970 if (e == NULL) {
971 break;
972 }
973 if (e != scan_end) {
974 assert(e < scan_end, "e: " PTR_FORMAT " scan_end: " PTR_FORMAT, p2i(e), p2i(scan_end));
975
976 if ((page_expected.size != page_size || page_expected.lgrp_id != lgrp_id())
977 && page_expected.size != 0) {
978 os::free_memory(s, pointer_delta(e, s, sizeof(char)), page_size);
979 }
980 page_expected = page_found;
981 }
982 s = e;
983 }
984
985 set_last_page_scanned(scan_end);
986 }
|