< prev index next >
src/os/solaris/vm/os_solaris.cpp
Print this page
*** 233,243 ****
getrlimit(RLIMIT_STACK, &limits);
size = adjust_stack_size(os::Solaris::_main_stack_base, (size_t)limits.rlim_cur);
}
// base may not be page aligned
address base = current_stack_base();
! address bottom = align_ptr_up(base - size, os::vm_page_size());;
return (size_t)(base - bottom);
}
struct tm* os::localtime_pd(const time_t* clock, struct tm* res) {
return localtime_r(clock, res);
--- 233,243 ----
getrlimit(RLIMIT_STACK, &limits);
size = adjust_stack_size(os::Solaris::_main_stack_base, (size_t)limits.rlim_cur);
}
// base may not be page aligned
address base = current_stack_base();
! address bottom = align_up(base - size, os::vm_page_size());;
return (size_t)(base - bottom);
}
struct tm* os::localtime_pd(const time_t* clock, struct tm* res) {
return localtime_r(clock, res);
*** 1108,1118 ****
// There are rare cases when we may have already used more than
// the basic stack size allotment before this method is invoked.
// Attempt to allow for a normally sized java_stack.
size_t current_stack_offset = (size_t)(base - (address)&stack_size);
! stack_size += ReservedSpace::page_align_size_down(current_stack_offset);
} else {
// 6269555: If we were not created by a Java launcher, i.e. if we are
// running embedded in a native application, treat the primordial thread
// as much like a native attached thread as possible. This means using
// the current stack size from thr_stksegment(), unless it is too large
--- 1108,1118 ----
// There are rare cases when we may have already used more than
// the basic stack size allotment before this method is invoked.
// Attempt to allow for a normally sized java_stack.
size_t current_stack_offset = (size_t)(base - (address)&stack_size);
! stack_size += ReservedSpace::page_align_down(current_stack_offset);
} else {
// 6269555: If we were not created by a Java launcher, i.e. if we are
// running embedded in a native application, treat the primordial thread
// as much like a native attached thread as possible. This means using
// the current stack size from thr_stksegment(), unless it is too large
*** 1120,1130 ****
size_t current_size = current_stack_size();
// This should never happen, but just in case....
if (current_size == 0) current_size = 2 * K * K;
stack_size = current_size > (8 * K * K) ? (8 * K * K) : current_size;
}
! address bottom = align_ptr_up(base - stack_size, os::vm_page_size());;
stack_size = (size_t)(base - bottom);
assert(stack_size > 0, "Stack size calculation problem");
if (stack_size > jt->stack_size()) {
--- 1120,1130 ----
size_t current_size = current_stack_size();
// This should never happen, but just in case....
if (current_size == 0) current_size = 2 * K * K;
stack_size = current_size > (8 * K * K) ? (8 * K * K) : current_size;
}
! address bottom = align_up(base - stack_size, os::vm_page_size());;
stack_size = (size_t)(base - bottom);
assert(stack_size > 0, "Stack size calculation problem");
if (stack_size > jt->stack_size()) {
*** 2329,2344 ****
vm_exit_out_of_memory(bytes, OOM_MMAP_ERROR, "%s", mesg);
}
}
size_t os::Solaris::page_size_for_alignment(size_t alignment) {
! assert(is_size_aligned(alignment, (size_t) vm_page_size()),
SIZE_FORMAT " is not aligned to " SIZE_FORMAT,
alignment, (size_t) vm_page_size());
for (int i = 0; _page_sizes[i] != 0; i++) {
! if (is_size_aligned(alignment, _page_sizes[i])) {
return _page_sizes[i];
}
}
return (size_t) vm_page_size();
--- 2329,2344 ----
vm_exit_out_of_memory(bytes, OOM_MMAP_ERROR, "%s", mesg);
}
}
size_t os::Solaris::page_size_for_alignment(size_t alignment) {
! assert(is_aligned(alignment, (size_t) vm_page_size()),
SIZE_FORMAT " is not aligned to " SIZE_FORMAT,
alignment, (size_t) vm_page_size());
for (int i = 0; _page_sizes[i] != 0; i++) {
! if (is_aligned(alignment, _page_sizes[i])) {
return _page_sizes[i];
}
}
return (size_t) vm_page_size();
*** 2346,2356 ****
int os::Solaris::commit_memory_impl(char* addr, size_t bytes,
size_t alignment_hint, bool exec) {
int err = Solaris::commit_memory_impl(addr, bytes, exec);
if (err == 0 && UseLargePages && alignment_hint > 0) {
! assert(is_size_aligned(bytes, alignment_hint),
SIZE_FORMAT " is not aligned to " SIZE_FORMAT, bytes, alignment_hint);
// The syscall memcntl requires an exact page size (see man memcntl for details).
size_t page_size = page_size_for_alignment(alignment_hint);
if (page_size > (size_t) vm_page_size()) {
--- 2346,2356 ----
int os::Solaris::commit_memory_impl(char* addr, size_t bytes,
size_t alignment_hint, bool exec) {
int err = Solaris::commit_memory_impl(addr, bytes, exec);
if (err == 0 && UseLargePages && alignment_hint > 0) {
! assert(is_aligned(bytes, alignment_hint),
SIZE_FORMAT " is not aligned to " SIZE_FORMAT, bytes, alignment_hint);
// The syscall memcntl requires an exact page size (see man memcntl for details).
size_t page_size = page_size_for_alignment(alignment_hint);
if (page_size > (size_t) vm_page_size()) {
*** 2763,2773 ****
size_t size = bytes;
return munmap(addr, size) == 0;
}
static bool solaris_mprotect(char* addr, size_t bytes, int prot) {
! assert(addr == (char*)align_size_down((uintptr_t)addr, os::vm_page_size()),
"addr must be page aligned");
int retVal = mprotect(addr, bytes, prot);
return retVal == 0;
}
--- 2763,2773 ----
size_t size = bytes;
return munmap(addr, size) == 0;
}
static bool solaris_mprotect(char* addr, size_t bytes, int prot) {
! assert(addr == (char*)align_down((uintptr_t)addr, os::vm_page_size()),
"addr must be page aligned");
int retVal = mprotect(addr, bytes, prot);
return retVal == 0;
}
*** 2900,2912 ****
return false;
}
bool os::Solaris::setup_large_pages(caddr_t start, size_t bytes, size_t align) {
assert(is_valid_page_size(align), SIZE_FORMAT " is not a valid page size", align);
! assert(is_ptr_aligned((void*) start, align),
PTR_FORMAT " is not aligned to " SIZE_FORMAT, p2i((void*) start), align);
! assert(is_size_aligned(bytes, align),
SIZE_FORMAT " is not aligned to " SIZE_FORMAT, bytes, align);
// Signal to OS that we want large pages for addresses
// from addr, addr + bytes
struct memcntl_mha mpss_struct;
--- 2900,2912 ----
return false;
}
bool os::Solaris::setup_large_pages(caddr_t start, size_t bytes, size_t align) {
assert(is_valid_page_size(align), SIZE_FORMAT " is not a valid page size", align);
! assert(is_aligned((void*) start, align),
PTR_FORMAT " is not aligned to " SIZE_FORMAT, p2i((void*) start), align);
! assert(is_aligned(bytes, align),
SIZE_FORMAT " is not aligned to " SIZE_FORMAT, bytes, align);
// Signal to OS that we want large pages for addresses
// from addr, addr + bytes
struct memcntl_mha mpss_struct;
< prev index next >