238 static size_t page_size_for_region(size_t region_min_size,
239 size_t region_max_size,
240 uint min_pages);
241
242 // Methods for tracing page sizes returned by the above method; enabled by
243 // TracePageSizes. The region_{min,max}_size parameters should be the values
244 // passed to page_size_for_region() and page_size should be the result of that
245 // call. The (optional) base and size parameters should come from the
246 // ReservedSpace base() and size() methods.
247 static void trace_page_sizes(const char* str, const size_t* page_sizes,
248 int count) PRODUCT_RETURN;
249 static void trace_page_sizes(const char* str, const size_t region_min_size,
250 const size_t region_max_size,
251 const size_t page_size,
252 const char* base = NULL,
253 const size_t size = 0) PRODUCT_RETURN;
254
255 static int vm_allocation_granularity();
256 static char* reserve_memory(size_t bytes, char* addr = 0,
257 size_t alignment_hint = 0);
258 static char* attempt_reserve_memory_at(size_t bytes, char* addr);
259 static void split_reserved_memory(char *base, size_t size,
260 size_t split, bool realloc);
261 static bool commit_memory(char* addr, size_t bytes, bool executable = false);
262 static bool commit_memory(char* addr, size_t size, size_t alignment_hint,
263 bool executable = false);
264 static bool uncommit_memory(char* addr, size_t bytes);
265 static bool release_memory(char* addr, size_t bytes);
266
267 enum ProtType { MEM_PROT_NONE, MEM_PROT_READ, MEM_PROT_RW, MEM_PROT_RWX };
268 static bool protect_memory(char* addr, size_t bytes, ProtType prot,
269 bool is_committed = true);
270
271 static bool guard_memory(char* addr, size_t bytes);
272 static bool unguard_memory(char* addr, size_t bytes);
273 static bool create_stack_guard_pages(char* addr, size_t bytes);
274 static bool pd_create_stack_guard_pages(char* addr, size_t bytes);
275 static bool remove_stack_guard_pages(char* addr, size_t bytes);
276
277 static char* map_memory(int fd, const char* file_name, size_t file_offset,
|
238 static size_t page_size_for_region(size_t region_min_size,
239 size_t region_max_size,
240 uint min_pages);
241
242 // Methods for tracing page sizes returned by the above method; enabled by
243 // TracePageSizes. The region_{min,max}_size parameters should be the values
244 // passed to page_size_for_region() and page_size should be the result of that
245 // call. The (optional) base and size parameters should come from the
246 // ReservedSpace base() and size() methods.
247 static void trace_page_sizes(const char* str, const size_t* page_sizes,
248 int count) PRODUCT_RETURN;
249 static void trace_page_sizes(const char* str, const size_t region_min_size,
250 const size_t region_max_size,
251 const size_t page_size,
252 const char* base = NULL,
253 const size_t size = 0) PRODUCT_RETURN;
254
255 static int vm_allocation_granularity();
256 static char* reserve_memory(size_t bytes, char* addr = 0,
257 size_t alignment_hint = 0);
258 static char* reserve_memory_aligned(size_t bytes, size_t alignment);
259 static char* attempt_reserve_memory_at(size_t bytes, char* addr);
260 static void split_reserved_memory(char *base, size_t size,
261 size_t split, bool realloc);
262 static bool commit_memory(char* addr, size_t bytes, bool executable = false);
263 static bool commit_memory(char* addr, size_t size, size_t alignment_hint,
264 bool executable = false);
265 static bool uncommit_memory(char* addr, size_t bytes);
266 static bool release_memory(char* addr, size_t bytes);
267
268 enum ProtType { MEM_PROT_NONE, MEM_PROT_READ, MEM_PROT_RW, MEM_PROT_RWX };
269 static bool protect_memory(char* addr, size_t bytes, ProtType prot,
270 bool is_committed = true);
271
272 static bool guard_memory(char* addr, size_t bytes);
273 static bool unguard_memory(char* addr, size_t bytes);
274 static bool create_stack_guard_pages(char* addr, size_t bytes);
275 static bool pd_create_stack_guard_pages(char* addr, size_t bytes);
276 static bool remove_stack_guard_pages(char* addr, size_t bytes);
277
278 static char* map_memory(int fd, const char* file_name, size_t file_offset,
|