src/os/posix/vm/os_posix.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hs-gc-mmap Sdiff src/os/posix/vm

src/os/posix/vm/os_posix.cpp

Print this page




  76     return fr.pc();
  77   } else {
  78     return NULL;
  79   }
  80 }
  81 
  82 int os::get_last_error() {
  83   return errno;
  84 }
  85 
  86 bool os::is_debugger_attached() {
  87   // not implemented
  88   return false;
  89 }
  90 
  91 void os::wait_for_keypress_at_exit(void) {
  92   // don't do anything on posix platforms
  93   return;
  94 }
  95 



































  96 void os::Posix::print_load_average(outputStream* st) {
  97   st->print("load average:");
  98   double loadavg[3];
  99   os::loadavg(loadavg, 3);
 100   st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
 101   st->cr();
 102 }
 103 
 104 void os::Posix::print_rlimit_info(outputStream* st) {
 105   st->print("rlimit:");
 106   struct rlimit rlim;
 107 
 108   st->print(" STACK ");
 109   getrlimit(RLIMIT_STACK, &rlim);
 110   if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
 111   else st->print("%uk", rlim.rlim_cur >> 10);
 112 
 113   st->print(", CORE ");
 114   getrlimit(RLIMIT_CORE, &rlim);
 115   if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");




  76     return fr.pc();
  77   } else {
  78     return NULL;
  79   }
  80 }
  81 
  82 int os::get_last_error() {
  83   return errno;
  84 }
  85 
  86 bool os::is_debugger_attached() {
  87   // not implemented
  88   return false;
  89 }
  90 
  91 void os::wait_for_keypress_at_exit(void) {
  92   // don't do anything on posix platforms
  93   return;
  94 }
  95 
  96 char* os::reserve_memory_aligned(size_t size, size_t alignment) {
  97   assert(alignment & (os::vm_allocation_granularity() - 1) == 0,
  98       "Alignment must be a multiple of allocation granularity (page size)");
  99   assert(size & (alignment -1) == 0, "size must be 'alignment' aligned");
 100   size_t extra_size = size + alignment;
 101   char* extra_base = os::reserve_memory(extra_size, NULL, alignment);
 102 
 103   if (extra_base == NULL) {
 104     return NULL;
 105   }
 106 
 107   // Do manual alignment
 108   char* aligned_base = (char*) align_size_up((uintptr_t) extra_base, alignment);
 109 
 110   // [  |                                       |  ]
 111   // ^ extra_base
 112   //    ^ extra_base + begin_offset == aligned_base
 113   //     extra_base + begin_offset + size       ^
 114   //                       extra_base + extra_size ^
 115   // |<>| == begin_offset
 116   //                              end_offset == |<>|
 117   size_t begin_offset = aligned_base - extra_base;
 118   size_t end_offset = (extra_base + extra_size) - (aligned_base + size);
 119 
 120   if (begin_offset > 0) {
 121       os::release_memory(extra_base, begin_offset);
 122   }
 123 
 124   if (end_offset > 0) {
 125       os::release_memory(extra_base + begin_offset + size, end_offset);
 126   }
 127 
 128   return aligned_base;
 129 }
 130 
 131 void os::Posix::print_load_average(outputStream* st) {
 132   st->print("load average:");
 133   double loadavg[3];
 134   os::loadavg(loadavg, 3);
 135   st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
 136   st->cr();
 137 }
 138 
 139 void os::Posix::print_rlimit_info(outputStream* st) {
 140   st->print("rlimit:");
 141   struct rlimit rlim;
 142 
 143   st->print(" STACK ");
 144   getrlimit(RLIMIT_STACK, &rlim);
 145   if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
 146   else st->print("%uk", rlim.rlim_cur >> 10);
 147 
 148   st->print(", CORE ");
 149   getrlimit(RLIMIT_CORE, &rlim);
 150   if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");


src/os/posix/vm/os_posix.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File