MemRegion G1PageBasedVirtualSpace::commit(uintptr_t start, size_t size_in_pages) { // We need to make sure to commit all pages covered by the given area. guarantee(is_area_uncommitted(start, size_in_pages), "Specified area is not uncommitted"); if (!_special) { os::commit_memory_or_exit(page_start(start), byte_size_for_pages(size_in_pages), _executable, err_msg("Failed to commit pages from "SIZE_FORMAT" of length "SIZE_FORMAT, start, size_in_pages)); } _committed.set_range(start, start + size_in_pages); MemRegion result((HeapWord*)page_start(start), byte_size_for_pages(size_in_pages) / HeapWordSize); return result; }
bool G1PageBasedVirtualSpace::commit(size_t start_page, size_t size_in_pages) { // We need to make sure to commit all pages covered by the given area. guarantee(is_area_uncommitted(start_page, size_in_pages), "Specified area is not uncommitted"); bool zero_filled = true; size_t end_page = start_page + size_in_pages; if (_special) { // Check for dirty pages and update zero_filled if any found. if (_dirty.get_next_one_offset(start_page, end_page) < end_page) { zero_filled = false; _dirty.clear_range(start_page, end_page); } } else { commit_internal(start_page, end_page); } _committed.set_range(start_page, end_page); if (AlwaysPreTouch) { pretouch_internal(start_page, end_page); } return zero_filled; }