< prev index next >

src/hotspot/os/aix/os_aix.cpp

Print this page
rev 47414 : Move polling page allocation to SafepointMechanism initialization


3470 jint os::init_2(void) {
3471 
3472   os::Posix::init_2();
3473 
3474   if (os::Aix::on_pase()) {
3475     trcVerbose("Running on PASE.");
3476   } else {
3477     trcVerbose("Running on AIX (not PASE).");
3478   }
3479 
3480   trcVerbose("processor count: %d", os::_processor_count);
3481   trcVerbose("physical memory: %lu", Aix::_physical_memory);
3482 
3483   // Initially build up the loaded dll map.
3484   LoadedLibraries::reload();
3485   if (Verbose) {
3486     trcVerbose("Loaded Libraries: ");
3487     LoadedLibraries::print(tty);
3488   }
3489 
3490   const int page_size = Aix::page_size();
3491   const int map_size = page_size;
3492 
3493   address map_address = (address) MAP_FAILED;
3494   const int prot  = PROT_READ;
3495   const int flags = MAP_PRIVATE|MAP_ANONYMOUS;
3496 
3497   // Use optimized addresses for the polling page,
3498   // e.g. map it to a special 32-bit address.
3499   if (OptimizePollingPageLocation) {
3500     // architecture-specific list of address wishes:
3501     address address_wishes[] = {
3502       // AIX: addresses lower than 0x30000000 don't seem to work on AIX.
3503       // PPC64: all address wishes are non-negative 32 bit values where
3504       // the lower 16 bits are all zero. we can load these addresses
3505       // with a single ppc_lis instruction.
3506       (address) 0x30000000, (address) 0x31000000,
3507       (address) 0x32000000, (address) 0x33000000,
3508       (address) 0x40000000, (address) 0x41000000,
3509       (address) 0x42000000, (address) 0x43000000,
3510       (address) 0x50000000, (address) 0x51000000,
3511       (address) 0x52000000, (address) 0x53000000,
3512       (address) 0x60000000, (address) 0x61000000,
3513       (address) 0x62000000, (address) 0x63000000
3514     };
3515     int address_wishes_length = sizeof(address_wishes)/sizeof(address);
3516 
3517     // iterate over the list of address wishes:
3518     for (int i=0; i<address_wishes_length; i++) {
3519       // Try to map with current address wish.
3520       // AIX: AIX needs MAP_FIXED if we provide an address and mmap will
3521       // fail if the address is already mapped.
3522       map_address = (address) ::mmap(address_wishes[i] - (ssize_t)page_size,
3523                                      map_size, prot,
3524                                      flags | MAP_FIXED,
3525                                      -1, 0);
3526       trcVerbose("SafePoint Polling  Page address: %p (wish) => %p",
3527                    address_wishes[i], map_address + (ssize_t)page_size);
3528 
3529       if (map_address + (ssize_t)page_size == address_wishes[i]) {
3530         // Map succeeded and map_address is at wished address, exit loop.
3531         break;
3532       }
3533 
3534       if (map_address != (address) MAP_FAILED) {
3535         // Map succeeded, but polling_page is not at wished address, unmap and continue.
3536         ::munmap(map_address, map_size);
3537         map_address = (address) MAP_FAILED;
3538       }
3539       // Map failed, continue loop.
3540     }
3541   } // end OptimizePollingPageLocation
3542 
3543   if (map_address == (address) MAP_FAILED) {
3544     map_address = (address) ::mmap(NULL, map_size, prot, flags, -1, 0);
3545   }
3546   guarantee(map_address != MAP_FAILED, "os::init_2: failed to allocate polling page");
3547   os::set_polling_page(map_address);
3548 
3549   if (!UseMembar) {
3550     address mem_serialize_page = (address) ::mmap(NULL, Aix::page_size(), PROT_READ | PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
3551     guarantee(mem_serialize_page != NULL, "mmap Failed for memory serialize page");
3552     os::set_memory_serialize_page(mem_serialize_page);
3553 
3554     trcVerbose("Memory Serialize  Page address: %p - %p, size %IX (%IB)",
3555         mem_serialize_page, mem_serialize_page + Aix::page_size(),
3556         Aix::page_size(), Aix::page_size());
3557   }
3558 
3559   // initialize suspend/resume support - must do this before signal_sets_init()
3560   if (SR_initialize() != 0) {
3561     perror("SR_initialize failed");
3562     return JNI_ERR;
3563   }
3564 
3565   Aix::signal_sets_init();
3566   Aix::install_signal_handlers();
3567 
3568   // Check and sets minimum stack sizes against command line options
3569   if (Posix::set_minimum_stack_sizes() == JNI_ERR) {
3570     return JNI_ERR;
3571   }
3572 
3573   if (UseNUMA) {
3574     UseNUMA = false;
3575     warning("NUMA optimizations are not available on this OS.");
3576   }
3577 
3578   if (MaxFDLimit) {




3470 jint os::init_2(void) {
3471 
3472   os::Posix::init_2();
3473 
3474   if (os::Aix::on_pase()) {
3475     trcVerbose("Running on PASE.");
3476   } else {
3477     trcVerbose("Running on AIX (not PASE).");
3478   }
3479 
3480   trcVerbose("processor count: %d", os::_processor_count);
3481   trcVerbose("physical memory: %lu", Aix::_physical_memory);
3482 
3483   // Initially build up the loaded dll map.
3484   LoadedLibraries::reload();
3485   if (Verbose) {
3486     trcVerbose("Loaded Libraries: ");
3487     LoadedLibraries::print(tty);
3488   }
3489 





































































3490   // initialize suspend/resume support - must do this before signal_sets_init()
3491   if (SR_initialize() != 0) {
3492     perror("SR_initialize failed");
3493     return JNI_ERR;
3494   }
3495 
3496   Aix::signal_sets_init();
3497   Aix::install_signal_handlers();
3498 
3499   // Check and sets minimum stack sizes against command line options
3500   if (Posix::set_minimum_stack_sizes() == JNI_ERR) {
3501     return JNI_ERR;
3502   }
3503 
3504   if (UseNUMA) {
3505     UseNUMA = false;
3506     warning("NUMA optimizations are not available on this OS.");
3507   }
3508 
3509   if (MaxFDLimit) {


< prev index next >