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 101 size_t extra_size = size + alignment; 102 assert(extra_size >= size, "overflow, size is too large to allow alignment"); 103 104 char* extra_base = os::reserve_memory(extra_size, NULL, alignment); 105 106 if (extra_base == NULL) { 107 return NULL; 108 } 109 110 // Do manual alignment 111 char* aligned_base = (char*) align_size_up((uintptr_t) extra_base, alignment); 112 113 // [ | | ] 114 // ^ extra_base 115 // ^ extra_base + begin_offset == aligned_base 116 // extra_base + begin_offset + size ^ 117 // extra_base + extra_size ^ 118 // |<>| == begin_offset 119 // end_offset == |<>| 120 size_t begin_offset = aligned_base - extra_base; 121 size_t end_offset = (extra_base + extra_size) - (aligned_base + size); 122 123 if (begin_offset > 0) { 124 os::release_memory(extra_base, begin_offset); 125 } 126 127 if (end_offset > 0) { 128 os::release_memory(extra_base + begin_offset + size, end_offset); 129 } 130 131 return aligned_base; 132 } 133 134 void os::Posix::print_load_average(outputStream* st) { 135 st->print("load average:"); 136 double loadavg[3]; 137 os::loadavg(loadavg, 3); 138 st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]); 139 st->cr(); 140 } 141 142 void os::Posix::print_rlimit_info(outputStream* st) { 143 st->print("rlimit:"); 144 struct rlimit rlim; 145 146 st->print(" STACK "); 147 getrlimit(RLIMIT_STACK, &rlim); 148 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); 149 else st->print("%uk", rlim.rlim_cur >> 10); 150 151 st->print(", CORE "); 152 getrlimit(RLIMIT_CORE, &rlim); 153 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); |