hotspot/src/os/solaris/vm/os_solaris.cpp
changeset 37430 fd743dadef12
parent 37118 42d3dc23603e
child 37442 942637261b21
equal deleted inserted replaced
37428:6e724f3d488b 37430:fd743dadef12
  2752     return addr;
  2752     return addr;
  2753   } else if (addr != NULL) {
  2753   } else if (addr != NULL) {
  2754     pd_unmap_memory(addr, bytes);
  2754     pd_unmap_memory(addr, bytes);
  2755   }
  2755   }
  2756 
  2756 
  2757   if (PrintMiscellaneous && Verbose) {
  2757   if (log_is_enabled(Warning, os)) {
  2758     char buf[256];
  2758     char buf[256];
  2759     buf[0] = '\0';
  2759     buf[0] = '\0';
  2760     if (addr == NULL) {
  2760     if (addr == NULL) {
  2761       jio_snprintf(buf, sizeof(buf), ": %s", os::strerror(err));
  2761       jio_snprintf(buf, sizeof(buf), ": %s", os::strerror(err));
  2762     }
  2762     }
  2763     warning("attempt_reserve_memory_at: couldn't reserve " SIZE_FORMAT " bytes at "
  2763     log_info(os)("attempt_reserve_memory_at: couldn't reserve " SIZE_FORMAT " bytes at "
  2764             PTR_FORMAT ": reserve_memory_helper returned " PTR_FORMAT
  2764             PTR_FORMAT ": reserve_memory_helper returned " PTR_FORMAT
  2765             "%s", bytes, requested_addr, addr, buf);
  2765             "%s", bytes, requested_addr, addr, buf);
  2766   }
  2766   }
  2767 
  2767 
  2768   // Address hint method didn't work.  Fall back to the old method.
  2768   // Address hint method didn't work.  Fall back to the old method.
  2788         if (gap != actual_gap) {
  2788         if (gap != actual_gap) {
  2789           // adjust the gap value and retry the last 2 allocations
  2789           // adjust the gap value and retry the last 2 allocations
  2790           assert(i > 0, "gap adjustment code problem");
  2790           assert(i > 0, "gap adjustment code problem");
  2791           have_adjusted_gap = true;  // adjust the gap only once, just in case
  2791           have_adjusted_gap = true;  // adjust the gap only once, just in case
  2792           gap = actual_gap;
  2792           gap = actual_gap;
  2793           if (PrintMiscellaneous && Verbose) {
  2793           log_info(os)("attempt_reserve_memory_at: adjusted gap to 0x%lx", gap);
  2794             warning("attempt_reserve_memory_at: adjusted gap to 0x%lx", gap);
       
  2795           }
       
  2796           unmap_memory(base[i], bytes);
  2794           unmap_memory(base[i], bytes);
  2797           unmap_memory(base[i-1], size[i-1]);
  2795           unmap_memory(base[i-1], size[i-1]);
  2798           i-=2;
  2796           i-=2;
  2799           continue;
  2797           continue;
  2800         }
  2798         }
  2822         base[i] += top_overlap;
  2820         base[i] += top_overlap;
  2823         size[i] = bytes - top_overlap;
  2821         size[i] = bytes - top_overlap;
  2824       } else {
  2822       } else {
  2825         size_t bottom_overlap = base[i] + bytes - requested_addr;
  2823         size_t bottom_overlap = base[i] + bytes - requested_addr;
  2826         if (bottom_overlap >= 0 && bottom_overlap < bytes) {
  2824         if (bottom_overlap >= 0 && bottom_overlap < bytes) {
  2827           if (PrintMiscellaneous && Verbose && bottom_overlap == 0) {
  2825           if (bottom_overlap == 0) {
  2828             warning("attempt_reserve_memory_at: possible alignment bug");
  2826             log_info(os)("attempt_reserve_memory_at: possible alignment bug");
  2829           }
  2827           }
  2830           unmap_memory(requested_addr, bottom_overlap);
  2828           unmap_memory(requested_addr, bottom_overlap);
  2831           size[i] = bytes - bottom_overlap;
  2829           size[i] = bytes - bottom_overlap;
  2832         } else {
  2830         } else {
  2833           size[i] = bytes;
  2831           size[i] = bytes;
  4353 static pset_getloadavg_type pset_getloadavg_ptr = NULL;
  4351 static pset_getloadavg_type pset_getloadavg_ptr = NULL;
  4354 
  4352 
  4355 void init_pset_getloadavg_ptr(void) {
  4353 void init_pset_getloadavg_ptr(void) {
  4356   pset_getloadavg_ptr =
  4354   pset_getloadavg_ptr =
  4357     (pset_getloadavg_type)dlsym(RTLD_DEFAULT, "pset_getloadavg");
  4355     (pset_getloadavg_type)dlsym(RTLD_DEFAULT, "pset_getloadavg");
  4358   if (PrintMiscellaneous && Verbose && pset_getloadavg_ptr == NULL) {
  4356   if (pset_getloadavg_ptr == NULL) {
  4359     warning("pset_getloadavg function not found");
  4357     log_warning(os)("pset_getloadavg function not found");
  4360   }
  4358   }
  4361 }
  4359 }
  4362 
  4360 
  4363 int os::Solaris::_dev_zero_fd = -1;
  4361 int os::Solaris::_dev_zero_fd = -1;
  4364 
  4362 
  4437     polling_page = (address)Solaris::mmap_chunk(NULL, page_size, MAP_PRIVATE,
  4435     polling_page = (address)Solaris::mmap_chunk(NULL, page_size, MAP_PRIVATE,
  4438                                                 PROT_READ);
  4436                                                 PROT_READ);
  4439   }
  4437   }
  4440 
  4438 
  4441   os::set_polling_page(polling_page);
  4439   os::set_polling_page(polling_page);
  4442 
  4440   log_info(os)("SafePoint Polling address: " INTPTR_FORMAT, p2i(polling_page));
  4443 #ifndef PRODUCT
       
  4444   if (Verbose && PrintMiscellaneous) {
       
  4445     tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n",
       
  4446                (intptr_t)polling_page);
       
  4447   }
       
  4448 #endif
       
  4449 
  4441 
  4450   if (!UseMembar) {
  4442   if (!UseMembar) {
  4451     address mem_serialize_page = (address)Solaris::mmap_chunk(NULL, page_size, MAP_PRIVATE, PROT_READ | PROT_WRITE);
  4443     address mem_serialize_page = (address)Solaris::mmap_chunk(NULL, page_size, MAP_PRIVATE, PROT_READ | PROT_WRITE);
  4452     guarantee(mem_serialize_page != NULL, "mmap Failed for memory serialize page");
  4444     guarantee(mem_serialize_page != NULL, "mmap Failed for memory serialize page");
  4453     os::set_memory_serialize_page(mem_serialize_page);
  4445     os::set_memory_serialize_page(mem_serialize_page);
  4454 
  4446     log_info(os)("Memory Serialize Page address: " INTPTR_FORMAT, p2i(mem_serialize_page));
  4455 #ifndef PRODUCT
       
  4456     if (Verbose && PrintMiscellaneous) {
       
  4457       tty->print("[Memory Serialize  Page address: " INTPTR_FORMAT "]\n",
       
  4458                  (intptr_t)mem_serialize_page);
       
  4459     }
       
  4460 #endif
       
  4461   }
  4447   }
  4462 
  4448 
  4463   // Check minimum allowable stack size for thread creation and to initialize
  4449   // Check minimum allowable stack size for thread creation and to initialize
  4464   // the java system classes, including StackOverflowError - depends on page
  4450   // the java system classes, including StackOverflowError - depends on page
  4465   // size.  Add a page for compiler2 recursion in main thread.
  4451   // size.  Add a page for compiler2 recursion in main thread.
  4535     // set the number of file descriptors to max. print out error
  4521     // set the number of file descriptors to max. print out error
  4536     // if getrlimit/setrlimit fails but continue regardless.
  4522     // if getrlimit/setrlimit fails but continue regardless.
  4537     struct rlimit nbr_files;
  4523     struct rlimit nbr_files;
  4538     int status = getrlimit(RLIMIT_NOFILE, &nbr_files);
  4524     int status = getrlimit(RLIMIT_NOFILE, &nbr_files);
  4539     if (status != 0) {
  4525     if (status != 0) {
  4540       if (PrintMiscellaneous && (Verbose || WizardMode)) {
  4526       log_info(os)("os::init_2 getrlimit failed: %s", os::strerror(errno));
  4541         perror("os::init_2 getrlimit failed");
       
  4542       }
       
  4543     } else {
  4527     } else {
  4544       nbr_files.rlim_cur = nbr_files.rlim_max;
  4528       nbr_files.rlim_cur = nbr_files.rlim_max;
  4545       status = setrlimit(RLIMIT_NOFILE, &nbr_files);
  4529       status = setrlimit(RLIMIT_NOFILE, &nbr_files);
  4546       if (status != 0) {
  4530       if (status != 0) {
  4547         if (PrintMiscellaneous && (Verbose || WizardMode)) {
  4531         log_info(os)("os::init_2 setrlimit failed: %s", os::strerror(errno));
  4548           perror("os::init_2 setrlimit failed");
       
  4549         }
       
  4550       }
  4532       }
  4551     }
  4533     }
  4552   }
  4534   }
  4553 
  4535 
  4554   // Calculate theoretical max. size of Threads to guard gainst
  4536   // Calculate theoretical max. size of Threads to guard gainst