hotspot/src/os/bsd/vm/os_bsd.cpp
changeset 24424 2658d7834c6e
parent 24351 61b33cc6d3cf
child 24931 4bba680186bd
equal deleted inserted replaced
24358:8528b67f6562 24424:2658d7834c6e
   122 
   122 
   123 // for timer info max values which include all bits
   123 // for timer info max values which include all bits
   124 #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
   124 #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
   125 
   125 
   126 #define LARGEPAGES_BIT (1 << 6)
   126 #define LARGEPAGES_BIT (1 << 6)
       
   127 
       
   128 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
       
   129 
   127 ////////////////////////////////////////////////////////////////////////////////
   130 ////////////////////////////////////////////////////////////////////////////////
   128 // global variables
   131 // global variables
   129 julong os::Bsd::_physical_memory = 0;
   132 julong os::Bsd::_physical_memory = 0;
   130 
   133 
   131 #ifdef __APPLE__
   134 #ifdef __APPLE__
  2392 
  2395 
  2393   bool warn_on_failure = UseLargePages &&
  2396   bool warn_on_failure = UseLargePages &&
  2394                         (!FLAG_IS_DEFAULT(UseLargePages) ||
  2397                         (!FLAG_IS_DEFAULT(UseLargePages) ||
  2395                          !FLAG_IS_DEFAULT(LargePageSizeInBytes)
  2398                          !FLAG_IS_DEFAULT(LargePageSizeInBytes)
  2396                         );
  2399                         );
  2397   char msg[128];
       
  2398 
  2400 
  2399   // Create a large shared memory region to attach to based on size.
  2401   // Create a large shared memory region to attach to based on size.
  2400   // Currently, size is the total size of the heap
  2402   // Currently, size is the total size of the heap
  2401   int shmid = shmget(key, bytes, IPC_CREAT|SHM_R|SHM_W);
  2403   int shmid = shmget(key, bytes, IPC_CREAT|SHM_R|SHM_W);
  2402   if (shmid == -1) {
  2404   if (shmid == -1) {
  2413      //      Note 2: it's possible there's enough physical memory available but
  2415      //      Note 2: it's possible there's enough physical memory available but
  2414      //            they are so fragmented after a long run that they can't
  2416      //            they are so fragmented after a long run that they can't
  2415      //            coalesce into large pages. Try to reserve large pages when
  2417      //            coalesce into large pages. Try to reserve large pages when
  2416      //            the system is still "fresh".
  2418      //            the system is still "fresh".
  2417      if (warn_on_failure) {
  2419      if (warn_on_failure) {
  2418        jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno);
  2420        warning("Failed to reserve shared memory (errno = %d).", errno);
  2419        warning(msg);
       
  2420      }
  2421      }
  2421      return NULL;
  2422      return NULL;
  2422   }
  2423   }
  2423 
  2424 
  2424   // attach to the region
  2425   // attach to the region
  2431   // segment immediately.
  2432   // segment immediately.
  2432   shmctl(shmid, IPC_RMID, NULL);
  2433   shmctl(shmid, IPC_RMID, NULL);
  2433 
  2434 
  2434   if ((intptr_t)addr == -1) {
  2435   if ((intptr_t)addr == -1) {
  2435      if (warn_on_failure) {
  2436      if (warn_on_failure) {
  2436        jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err);
  2437        warning("Failed to attach shared memory (errno = %d).", err);
  2437        warning(msg);
       
  2438      }
  2438      }
  2439      return NULL;
  2439      return NULL;
  2440   }
  2440   }
  2441 
  2441 
  2442   // The memory is committed
  2442   // The memory is committed
  3808 
  3808 
  3809 bool os::check_heap(bool force) {
  3809 bool os::check_heap(bool force) {
  3810   return true;
  3810   return true;
  3811 }
  3811 }
  3812 
  3812 
       
  3813 ATTRIBUTE_PRINTF(3, 0)
  3813 int local_vsnprintf(char* buf, size_t count, const char* format, va_list args) {
  3814 int local_vsnprintf(char* buf, size_t count, const char* format, va_list args) {
  3814   return ::vsnprintf(buf, count, format, args);
  3815   return ::vsnprintf(buf, count, format, args);
  3815 }
  3816 }
  3816 
  3817 
  3817 // Is a (classpath) directory empty?
  3818 // Is a (classpath) directory empty?