2188 //////////////////////////////////////////////////////////////////////////////// |
2188 //////////////////////////////////////////////////////////////////////////////// |
2189 // Virtual Memory |
2189 // Virtual Memory |
2190 |
2190 |
2191 static int page_size = -1; |
2191 static int page_size = -1; |
2192 |
2192 |
2193 // The mmap MAP_ALIGN flag is supported on Solaris 9 and later. init_2() will |
|
2194 // clear this var if support is not available. |
|
2195 static bool has_map_align = true; |
|
2196 |
|
2197 int os::vm_page_size() { |
2193 int os::vm_page_size() { |
2198 assert(page_size != -1, "must call os::init"); |
2194 assert(page_size != -1, "must call os::init"); |
2199 return page_size; |
2195 return page_size; |
2200 } |
2196 } |
2201 |
2197 |
2558 assert(!(fixed && (alignment_hint > 0)), |
2554 assert(!(fixed && (alignment_hint > 0)), |
2559 "alignment hint meaningless with fixed mmap"); |
2555 "alignment hint meaningless with fixed mmap"); |
2560 |
2556 |
2561 if (fixed) { |
2557 if (fixed) { |
2562 flags |= MAP_FIXED; |
2558 flags |= MAP_FIXED; |
2563 } else if (has_map_align && (alignment_hint > (size_t) vm_page_size())) { |
2559 } else if (alignment_hint > (size_t) vm_page_size()) { |
2564 flags |= MAP_ALIGN; |
2560 flags |= MAP_ALIGN; |
2565 addr = (char*) alignment_hint; |
2561 addr = (char*) alignment_hint; |
2566 } |
2562 } |
2567 |
2563 |
2568 // Map uncommitted pages PROT_NONE so we fail early if we touch an |
2564 // Map uncommitted pages PROT_NONE so we fail early if we touch an |
4219 |
4215 |
4220 // this is called _after_ the global arguments have been parsed |
4216 // this is called _after_ the global arguments have been parsed |
4221 jint os::init_2(void) { |
4217 jint os::init_2(void) { |
4222 // try to enable extended file IO ASAP, see 6431278 |
4218 // try to enable extended file IO ASAP, see 6431278 |
4223 os::Solaris::try_enable_extended_io(); |
4219 os::Solaris::try_enable_extended_io(); |
4224 |
|
4225 // Allocate a single page and mark it as readable for safepoint polling. Also |
|
4226 // use this first mmap call to check support for MAP_ALIGN. |
|
4227 address polling_page = (address)Solaris::mmap_chunk((char*)page_size, |
|
4228 page_size, |
|
4229 MAP_PRIVATE | MAP_ALIGN, |
|
4230 PROT_READ); |
|
4231 if (polling_page == NULL) { |
|
4232 has_map_align = false; |
|
4233 polling_page = (address)Solaris::mmap_chunk(NULL, page_size, MAP_PRIVATE, |
|
4234 PROT_READ); |
|
4235 } |
|
4236 |
|
4237 os::set_polling_page(polling_page); |
|
4238 log_info(os)("SafePoint Polling address: " INTPTR_FORMAT, p2i(polling_page)); |
|
4239 |
|
4240 if (!UseMembar) { |
|
4241 address mem_serialize_page = (address)Solaris::mmap_chunk(NULL, page_size, MAP_PRIVATE, PROT_READ | PROT_WRITE); |
|
4242 guarantee(mem_serialize_page != NULL, "mmap Failed for memory serialize page"); |
|
4243 os::set_memory_serialize_page(mem_serialize_page); |
|
4244 log_info(os)("Memory Serialize Page address: " INTPTR_FORMAT, p2i(mem_serialize_page)); |
|
4245 } |
|
4246 |
4220 |
4247 // Check and sets minimum stack sizes against command line options |
4221 // Check and sets minimum stack sizes against command line options |
4248 if (Posix::set_minimum_stack_sizes() == JNI_ERR) { |
4222 if (Posix::set_minimum_stack_sizes() == JNI_ERR) { |
4249 return JNI_ERR; |
4223 return JNI_ERR; |
4250 } |
4224 } |