117 char* G1PageBasedVirtualSpace::page_start(size_t index) const {
118 return _low_boundary + index * _page_size;
119 }
120
121 bool G1PageBasedVirtualSpace::is_after_last_page(size_t index) const {
122 guarantee(index <= _committed.size(),
123 "Given boundary page " SIZE_FORMAT " is beyond managed page count " SIZE_FORMAT, index, _committed.size());
124 return index == _committed.size();
125 }
126
127 void G1PageBasedVirtualSpace::commit_preferred_pages(size_t start, size_t num_pages) {
128 vmassert(num_pages > 0, "No full pages to commit");
129 vmassert(start + num_pages <= _committed.size(),
130 "Tried to commit area from page " SIZE_FORMAT " to page " SIZE_FORMAT " "
131 "that is outside of managed space of " SIZE_FORMAT " pages",
132 start, start + num_pages, _committed.size());
133
134 char* start_addr = page_start(start);
135 size_t size = num_pages * _page_size;
136
137 os::commit_memory_or_exit(start_addr, size, _page_size, _executable,
138 err_msg("Failed to commit area from " PTR_FORMAT " to " PTR_FORMAT " of length " SIZE_FORMAT ".",
139 p2i(start_addr), p2i(start_addr + size), size));
140 }
141
142 void G1PageBasedVirtualSpace::commit_tail() {
143 vmassert(_tail_size > 0, "The size of the tail area must be > 0 when reaching here");
144
145 char* const aligned_end_address = align_down(_high_boundary, _page_size);
146 os::commit_memory_or_exit(aligned_end_address, _tail_size, os::vm_page_size(), _executable,
147 err_msg("Failed to commit tail area from " PTR_FORMAT " to " PTR_FORMAT " of length " SIZE_FORMAT ".",
148 p2i(aligned_end_address), p2i(_high_boundary), _tail_size));
149 }
150
151 void G1PageBasedVirtualSpace::commit_internal(size_t start_page, size_t end_page) {
152 guarantee(start_page < end_page,
153 "Given start page " SIZE_FORMAT " is larger or equal to end page " SIZE_FORMAT, start_page, end_page);
154 guarantee(end_page <= _committed.size(),
155 "Given end page " SIZE_FORMAT " is beyond end of managed page amount of " SIZE_FORMAT, end_page, _committed.size());
156
|
117 char* G1PageBasedVirtualSpace::page_start(size_t index) const {
118 return _low_boundary + index * _page_size;
119 }
120
121 bool G1PageBasedVirtualSpace::is_after_last_page(size_t index) const {
122 guarantee(index <= _committed.size(),
123 "Given boundary page " SIZE_FORMAT " is beyond managed page count " SIZE_FORMAT, index, _committed.size());
124 return index == _committed.size();
125 }
126
127 void G1PageBasedVirtualSpace::commit_preferred_pages(size_t start, size_t num_pages) {
128 vmassert(num_pages > 0, "No full pages to commit");
129 vmassert(start + num_pages <= _committed.size(),
130 "Tried to commit area from page " SIZE_FORMAT " to page " SIZE_FORMAT " "
131 "that is outside of managed space of " SIZE_FORMAT " pages",
132 start, start + num_pages, _committed.size());
133
134 char* start_addr = page_start(start);
135 size_t size = num_pages * _page_size;
136
137 if (((address)start_addr == (address)os::nvdimm_heapbase())) {
138 // first remove my dummy mapping.
139 if (os::unmap_memory(start_addr, size)) {
140 char* nvdimm_addr = os::attempt_reserve_memory_at(size, start_addr, os::nvdimm_fd());
141 if (nvdimm_addr != start_addr) {
142 vm_exit_during_initialization(
143 err_msg("Could not map memory at %p for NVDIMM %s Fd %d", nvdimm_addr, AllocateOldGenAt, os::nvdimm_fd()));
144 } else {
145 log_info(gc, heap)("NVDIMM Memory successfully mapped at %p, Size %lu", start_addr, size);
146 os::close(os::nvdimm_fd());
147 }
148 }
149 return;
150 }
151 os::commit_memory_or_exit(start_addr, size, _page_size, _executable,
152 err_msg("Failed to commit area from " PTR_FORMAT " to " PTR_FORMAT " of length " SIZE_FORMAT ".",
153 p2i(start_addr), p2i(start_addr + size), size));
154 }
155
156 void G1PageBasedVirtualSpace::commit_tail() {
157 vmassert(_tail_size > 0, "The size of the tail area must be > 0 when reaching here");
158
159 char* const aligned_end_address = align_down(_high_boundary, _page_size);
160 os::commit_memory_or_exit(aligned_end_address, _tail_size, os::vm_page_size(), _executable,
161 err_msg("Failed to commit tail area from " PTR_FORMAT " to " PTR_FORMAT " of length " SIZE_FORMAT ".",
162 p2i(aligned_end_address), p2i(_high_boundary), _tail_size));
163 }
164
165 void G1PageBasedVirtualSpace::commit_internal(size_t start_page, size_t end_page) {
166 guarantee(start_page < end_page,
167 "Given start page " SIZE_FORMAT " is larger or equal to end page " SIZE_FORMAT, start_page, end_page);
168 guarantee(end_page <= _committed.size(),
169 "Given end page " SIZE_FORMAT " is beyond end of managed page amount of " SIZE_FORMAT, end_page, _committed.size());
170
|