< prev index next >

src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp

Print this page
rev 7555 : imported patch 8067469-g1-ignores-alwayspretouch


 114 
 115 char* G1PageBasedVirtualSpace::page_start(uintptr_t index) {
 116   return _low_boundary + index * _page_size;
 117 }
 118 
 119 size_t G1PageBasedVirtualSpace::byte_size_for_pages(size_t num) {
 120   return num * _page_size;
 121 }
 122 
 123 MemRegion G1PageBasedVirtualSpace::commit(uintptr_t start, size_t size_in_pages) {
 124   // We need to make sure to commit all pages covered by the given area.
 125   guarantee(is_area_uncommitted(start, size_in_pages), "Specified area is not uncommitted");
 126 
 127   if (!_special) {
 128     os::commit_memory_or_exit(page_start(start), byte_size_for_pages(size_in_pages), _executable,
 129                               err_msg("Failed to commit pages from "SIZE_FORMAT" of length "SIZE_FORMAT, start, size_in_pages));
 130   }
 131   _committed.set_range(start, start + size_in_pages);
 132 
 133   MemRegion result((HeapWord*)page_start(start), byte_size_for_pages(size_in_pages) / HeapWordSize);



 134   return result;
 135 }
 136 
 137 MemRegion G1PageBasedVirtualSpace::uncommit(uintptr_t start, size_t size_in_pages) {
 138   guarantee(is_area_committed(start, size_in_pages), "checking");
 139 
 140   if (!_special) {
 141     os::uncommit_memory(page_start(start), byte_size_for_pages(size_in_pages));
 142   }
 143 
 144   _committed.clear_range(start, start + size_in_pages);
 145 
 146   MemRegion result((HeapWord*)page_start(start), byte_size_for_pages(size_in_pages) / HeapWordSize);
 147   return result;
 148 }
 149 
 150 bool G1PageBasedVirtualSpace::contains(const void* p) const {
 151   return _low_boundary <= (const char*) p && (const char*) p < _high_boundary;
 152 }
 153 


 114 
 115 char* G1PageBasedVirtualSpace::page_start(uintptr_t index) {
 116   return _low_boundary + index * _page_size;
 117 }
 118 
 119 size_t G1PageBasedVirtualSpace::byte_size_for_pages(size_t num) {
 120   return num * _page_size;
 121 }
 122 
 123 MemRegion G1PageBasedVirtualSpace::commit(uintptr_t start, size_t size_in_pages) {
 124   // We need to make sure to commit all pages covered by the given area.
 125   guarantee(is_area_uncommitted(start, size_in_pages), "Specified area is not uncommitted");
 126 
 127   if (!_special) {
 128     os::commit_memory_or_exit(page_start(start), byte_size_for_pages(size_in_pages), _executable,
 129                               err_msg("Failed to commit pages from "SIZE_FORMAT" of length "SIZE_FORMAT, start, size_in_pages));
 130   }
 131   _committed.set_range(start, start + size_in_pages);
 132 
 133   MemRegion result((HeapWord*)page_start(start), byte_size_for_pages(size_in_pages) / HeapWordSize);
 134   if (AlwaysPreTouch) {
 135     os::pretouch_memory((char*)result.start(), (char*)result.end());
 136   }
 137   return result;
 138 }
 139 
 140 MemRegion G1PageBasedVirtualSpace::uncommit(uintptr_t start, size_t size_in_pages) {
 141   guarantee(is_area_committed(start, size_in_pages), "checking");
 142 
 143   if (!_special) {
 144     os::uncommit_memory(page_start(start), byte_size_for_pages(size_in_pages));
 145   }
 146 
 147   _committed.clear_range(start, start + size_in_pages);
 148 
 149   MemRegion result((HeapWord*)page_start(start), byte_size_for_pages(size_in_pages) / HeapWordSize);
 150   return result;
 151 }
 152 
 153 bool G1PageBasedVirtualSpace::contains(const void* p) const {
 154   return _low_boundary <= (const char*) p && (const char*) p < _high_boundary;
 155 }
 156 
< prev index next >