src/hotspot/os/aix/os_aix.cpp
changeset 47881 0ce0ac68ace7
parent 47765 b7c7428eaab9
child 47903 7f22774a5f42
equal deleted inserted replaced
47824:cf127be65014 47881:0ce0ac68ace7
  3475   if (Verbose) {
  3475   if (Verbose) {
  3476     trcVerbose("Loaded Libraries: ");
  3476     trcVerbose("Loaded Libraries: ");
  3477     LoadedLibraries::print(tty);
  3477     LoadedLibraries::print(tty);
  3478   }
  3478   }
  3479 
  3479 
  3480   const int page_size = Aix::page_size();
       
  3481   const int map_size = page_size;
       
  3482 
       
  3483   address map_address = (address) MAP_FAILED;
       
  3484   const int prot  = PROT_READ;
       
  3485   const int flags = MAP_PRIVATE|MAP_ANONYMOUS;
       
  3486 
       
  3487   // Use optimized addresses for the polling page,
       
  3488   // e.g. map it to a special 32-bit address.
       
  3489   if (OptimizePollingPageLocation) {
       
  3490     // architecture-specific list of address wishes:
       
  3491     address address_wishes[] = {
       
  3492       // AIX: addresses lower than 0x30000000 don't seem to work on AIX.
       
  3493       // PPC64: all address wishes are non-negative 32 bit values where
       
  3494       // the lower 16 bits are all zero. we can load these addresses
       
  3495       // with a single ppc_lis instruction.
       
  3496       (address) 0x30000000, (address) 0x31000000,
       
  3497       (address) 0x32000000, (address) 0x33000000,
       
  3498       (address) 0x40000000, (address) 0x41000000,
       
  3499       (address) 0x42000000, (address) 0x43000000,
       
  3500       (address) 0x50000000, (address) 0x51000000,
       
  3501       (address) 0x52000000, (address) 0x53000000,
       
  3502       (address) 0x60000000, (address) 0x61000000,
       
  3503       (address) 0x62000000, (address) 0x63000000
       
  3504     };
       
  3505     int address_wishes_length = sizeof(address_wishes)/sizeof(address);
       
  3506 
       
  3507     // iterate over the list of address wishes:
       
  3508     for (int i=0; i<address_wishes_length; i++) {
       
  3509       // Try to map with current address wish.
       
  3510       // AIX: AIX needs MAP_FIXED if we provide an address and mmap will
       
  3511       // fail if the address is already mapped.
       
  3512       map_address = (address) ::mmap(address_wishes[i] - (ssize_t)page_size,
       
  3513                                      map_size, prot,
       
  3514                                      flags | MAP_FIXED,
       
  3515                                      -1, 0);
       
  3516       trcVerbose("SafePoint Polling  Page address: %p (wish) => %p",
       
  3517                    address_wishes[i], map_address + (ssize_t)page_size);
       
  3518 
       
  3519       if (map_address + (ssize_t)page_size == address_wishes[i]) {
       
  3520         // Map succeeded and map_address is at wished address, exit loop.
       
  3521         break;
       
  3522       }
       
  3523 
       
  3524       if (map_address != (address) MAP_FAILED) {
       
  3525         // Map succeeded, but polling_page is not at wished address, unmap and continue.
       
  3526         ::munmap(map_address, map_size);
       
  3527         map_address = (address) MAP_FAILED;
       
  3528       }
       
  3529       // Map failed, continue loop.
       
  3530     }
       
  3531   } // end OptimizePollingPageLocation
       
  3532 
       
  3533   if (map_address == (address) MAP_FAILED) {
       
  3534     map_address = (address) ::mmap(NULL, map_size, prot, flags, -1, 0);
       
  3535   }
       
  3536   guarantee(map_address != MAP_FAILED, "os::init_2: failed to allocate polling page");
       
  3537   os::set_polling_page(map_address);
       
  3538 
       
  3539   if (!UseMembar) {
       
  3540     address mem_serialize_page = (address) ::mmap(NULL, Aix::page_size(), PROT_READ | PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
       
  3541     guarantee(mem_serialize_page != NULL, "mmap Failed for memory serialize page");
       
  3542     os::set_memory_serialize_page(mem_serialize_page);
       
  3543 
       
  3544     trcVerbose("Memory Serialize  Page address: %p - %p, size %IX (%IB)",
       
  3545         mem_serialize_page, mem_serialize_page + Aix::page_size(),
       
  3546         Aix::page_size(), Aix::page_size());
       
  3547   }
       
  3548 
       
  3549   // initialize suspend/resume support - must do this before signal_sets_init()
  3480   // initialize suspend/resume support - must do this before signal_sets_init()
  3550   if (SR_initialize() != 0) {
  3481   if (SR_initialize() != 0) {
  3551     perror("SR_initialize failed");
  3482     perror("SR_initialize failed");
  3552     return JNI_ERR;
  3483     return JNI_ERR;
  3553   }
  3484   }