提交 2d8cb491 编写于 作者: J jcoomes

6642862: Code cache allocation fails with large pages after 6588638

Reviewed-by: apetrusenko
上级 f70aecd5
......@@ -2480,6 +2480,10 @@ bool os::can_commit_large_page_memory() {
return false;
}
bool os::can_execute_large_page_memory() {
return false;
}
// Reserve memory at an arbitrary address, only if that area is
// available (and not reserved for something else).
......
......@@ -3089,6 +3089,8 @@ bool os::large_page_init() {
if (UseISM) {
// ISM disables MPSS to be compatible with old JDK behavior
UseMPSS = false;
_page_sizes[0] = _large_page_size;
_page_sizes[1] = vm_page_size();
}
UseMPSS = UseMPSS &&
......@@ -3178,6 +3180,10 @@ bool os::can_commit_large_page_memory() {
return UseISM ? false : true;
}
bool os::can_execute_large_page_memory() {
return UseISM ? false : true;
}
static int os_sleep(jlong millis, bool interruptible) {
const jlong limit = INT_MAX;
jlong prevtime;
......
......@@ -2516,9 +2516,13 @@ bool os::can_commit_large_page_memory() {
return false;
}
bool os::can_execute_large_page_memory() {
return true;
}
char* os::reserve_memory_special(size_t bytes) {
DWORD flag = MEM_RESERVE | MEM_COMMIT | MEM_LARGE_PAGES;
char * res = (char *)VirtualAlloc(NULL, bytes, flag, PAGE_READWRITE);
char * res = (char *)VirtualAlloc(NULL, bytes, flag, PAGE_EXECUTE_READWRITE);
return res;
}
......
......@@ -41,7 +41,7 @@ ParMarkBitMap::initialize(MemRegion covered_region)
const size_t rs_align = page_sz == (size_t) os::vm_page_size() ? 0 :
MAX2(page_sz, granularity);
ReservedSpace rs(bytes, rs_align, false);
ReservedSpace rs(bytes, rs_align, rs_align > 0);
os::trace_page_sizes("par bitmap", raw_bytes, raw_bytes, page_sz,
rs.base(), rs.size());
_virtual_space = new PSVirtualSpace(rs, page_sz);
......
......@@ -413,7 +413,7 @@ ParallelCompactData::create_vspace(size_t count, size_t element_size)
const size_t rs_align = page_sz == (size_t) os::vm_page_size() ? 0 :
MAX2(page_sz, granularity);
ReservedSpace rs(bytes, rs_align, false);
ReservedSpace rs(bytes, rs_align, rs_align > 0);
os::trace_page_sizes("par compact", raw_bytes, raw_bytes, page_sz, rs.base(),
rs.size());
PSVirtualSpace* vspace = new PSVirtualSpace(rs, page_sz);
......
......@@ -102,8 +102,9 @@ bool CodeHeap::reserve(size_t reserved_size, size_t committed_size,
_log2_segment_size = exact_log2(segment_size);
// Reserve and initialize space for _memory.
const size_t page_size = os::page_size_for_region(committed_size,
reserved_size, 8);
const size_t page_size = os::can_execute_large_page_memory() ?
os::page_size_for_region(committed_size, reserved_size, 8) :
os::vm_page_size();
const size_t granularity = os::vm_allocation_granularity();
const size_t r_align = MAX2(page_size, granularity);
const size_t r_size = align_size_up(reserved_size, r_align);
......@@ -111,7 +112,7 @@ bool CodeHeap::reserve(size_t reserved_size, size_t committed_size,
const size_t rs_align = page_size == (size_t) os::vm_page_size() ? 0 :
MAX2(page_size, granularity);
ReservedSpace rs(r_size, rs_align, false);
ReservedSpace rs(r_size, rs_align, rs_align > 0);
os::trace_page_sizes("code heap", committed_size, reserved_size, page_size,
rs.base(), rs.size());
if (!_memory.initialize(rs, c_size)) {
......
......@@ -228,6 +228,7 @@ class os: AllStatic {
static bool large_page_init();
static size_t large_page_size();
static bool can_commit_large_page_memory();
static bool can_execute_large_page_memory();
// OS interface to polling page
static address get_polling_page() { return _polling_page; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册