6642862: Code cache allocation fails with large pages after 6588638
Reviewed-by: apetrusenko
--- a/hotspot/src/os/linux/vm/os_linux.cpp Fri Mar 28 11:52:29 2008 -0700
+++ b/hotspot/src/os/linux/vm/os_linux.cpp Fri Mar 28 23:35:42 2008 -0700
@@ -2480,6 +2480,10 @@
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).
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp Fri Mar 28 11:52:29 2008 -0700
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Fri Mar 28 23:35:42 2008 -0700
@@ -3089,6 +3089,8 @@
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 @@
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;
--- a/hotspot/src/os/windows/vm/os_windows.cpp Fri Mar 28 11:52:29 2008 -0700
+++ b/hotspot/src/os/windows/vm/os_windows.cpp Fri Mar 28 23:35:42 2008 -0700
@@ -2516,9 +2516,13 @@
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;
}
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp Fri Mar 28 11:52:29 2008 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp Fri Mar 28 23:35:42 2008 -0700
@@ -41,7 +41,7 @@
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);
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Fri Mar 28 11:52:29 2008 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Fri Mar 28 23:35:42 2008 -0700
@@ -413,7 +413,7 @@
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);
--- a/hotspot/src/share/vm/memory/heap.cpp Fri Mar 28 11:52:29 2008 -0700
+++ b/hotspot/src/share/vm/memory/heap.cpp Fri Mar 28 23:35:42 2008 -0700
@@ -102,8 +102,9 @@
_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 @@
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)) {
--- a/hotspot/src/share/vm/runtime/os.hpp Fri Mar 28 11:52:29 2008 -0700
+++ b/hotspot/src/share/vm/runtime/os.hpp Fri Mar 28 23:35:42 2008 -0700
@@ -228,6 +228,7 @@
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; }