< prev index next >

src/hotspot/share/runtime/os.cpp

Print this page
rev 49465 : 8200245: Zero fails to build on linux-ia64 due to ia64-specific cruft


1141   // Check if in metaspace and print types that have vptrs (only method now)
1142   if (Metaspace::contains(addr)) {
1143     if (Method::has_method_vptr((const void*)addr)) {
1144       ((Method*)addr)->print_value_on(st);
1145       st->cr();
1146     } else {
1147       // Use addr->print() from the debugger instead (not here)
1148       st->print_cr(INTPTR_FORMAT " is pointing into metadata", p2i(addr));
1149     }
1150     return;
1151   }
1152 
1153   // Try an OS specific find
1154   if (os::find(addr, st)) {
1155     return;
1156   }
1157 
1158   st->print_cr(INTPTR_FORMAT " is an unknown value", p2i(addr));
1159 }
1160 
1161 // Looks like all platforms except IA64 can use the same function to check
1162 // if C stack is walkable beyond current frame. The check for fp() is not
1163 // necessary on Sparc, but it's harmless.
1164 bool os::is_first_C_frame(frame* fr) {
1165 #if (defined(IA64) && !defined(AIX)) && !defined(_WIN32)
1166   // On IA64 we have to check if the callers bsp is still valid
1167   // (i.e. within the register stack bounds).
1168   // Notice: this only works for threads created by the VM and only if
1169   // we walk the current stack!!! If we want to be able to walk
1170   // arbitrary other threads, we'll have to somehow store the thread
1171   // object in the frame.
1172   Thread *thread = Thread::current();
1173   if ((address)fr->fp() <=
1174       thread->register_stack_base() HPUX_ONLY(+ 0x0) LINUX_ONLY(+ 0x50)) {
1175     // This check is a little hacky, because on Linux the first C
1176     // frame's ('start_thread') register stack frame starts at
1177     // "register_stack_base + 0x48" while on HPUX, the first C frame's
1178     // ('__pthread_bound_body') register stack frame seems to really
1179     // start at "register_stack_base".
1180     return true;
1181   } else {
1182     return false;
1183   }
1184 #elif defined(IA64) && defined(_WIN32)
1185   return true;
1186 #else
1187   // Load up sp, fp, sender sp and sender fp, check for reasonable values.
1188   // Check usp first, because if that's bad the other accessors may fault
1189   // on some architectures.  Ditto ufp second, etc.
1190   uintptr_t fp_align_mask = (uintptr_t)(sizeof(address)-1);
1191   // sp on amd can be 32 bit aligned.
1192   uintptr_t sp_align_mask = (uintptr_t)(sizeof(int)-1);
1193 
1194   uintptr_t usp    = (uintptr_t)fr->sp();
1195   if ((usp & sp_align_mask) != 0) return true;
1196 
1197   uintptr_t ufp    = (uintptr_t)fr->fp();
1198   if ((ufp & fp_align_mask) != 0) return true;
1199 
1200   uintptr_t old_sp = (uintptr_t)fr->sender_sp();
1201   if ((old_sp & sp_align_mask) != 0) return true;
1202   if (old_sp == 0 || old_sp == (uintptr_t)-1) return true;
1203 
1204   uintptr_t old_fp = (uintptr_t)fr->link();
1205   if ((old_fp & fp_align_mask) != 0) return true;
1206   if (old_fp == 0 || old_fp == (uintptr_t)-1 || old_fp == ufp) return true;
1207 
1208   // stack grows downwards; if old_fp is below current fp or if the stack
1209   // frame is too large, either the stack is corrupted or fp is not saved
1210   // on stack (i.e. on x86, ebp may be used as general register). The stack
1211   // is not walkable beyond current frame.
1212   if (old_fp < ufp) return true;
1213   if (old_fp - ufp > 64 * K) return true;
1214 
1215   return false;
1216 #endif
1217 }
1218 
1219 
1220 // Set up the boot classpath.
1221 
1222 char* os::format_boot_path(const char* format_string,
1223                            const char* home,
1224                            int home_len,
1225                            char fileSep,
1226                            char pathSep) {
1227     assert((fileSep == '/' && pathSep == ':') ||
1228            (fileSep == '\\' && pathSep == ';'), "unexpected separator chars");
1229 
1230     // Scan the format string to determine the length of the actual
1231     // boot classpath, and handle platform dependencies as well.
1232     int formatted_path_len = 0;
1233     const char* p;
1234     for (p = format_string; *p != 0; ++p) {
1235         if (*p == '%') formatted_path_len += home_len - 1;
1236         ++formatted_path_len;




1141   // Check if in metaspace and print types that have vptrs (only method now)
1142   if (Metaspace::contains(addr)) {
1143     if (Method::has_method_vptr((const void*)addr)) {
1144       ((Method*)addr)->print_value_on(st);
1145       st->cr();
1146     } else {
1147       // Use addr->print() from the debugger instead (not here)
1148       st->print_cr(INTPTR_FORMAT " is pointing into metadata", p2i(addr));
1149     }
1150     return;
1151   }
1152 
1153   // Try an OS specific find
1154   if (os::find(addr, st)) {
1155     return;
1156   }
1157 
1158   st->print_cr(INTPTR_FORMAT " is an unknown value", p2i(addr));
1159 }
1160 
1161 // Looks like all platforms can use the same function to check if C
1162 // stack is walkable beyond current frame. The check for fp() is not
1163 // necessary on Sparc, but it's harmless.
1164 bool os::is_first_C_frame(frame* fr) {






















1165   // Load up sp, fp, sender sp and sender fp, check for reasonable values.
1166   // Check usp first, because if that's bad the other accessors may fault
1167   // on some architectures.  Ditto ufp second, etc.
1168   uintptr_t fp_align_mask = (uintptr_t)(sizeof(address)-1);
1169   // sp on amd can be 32 bit aligned.
1170   uintptr_t sp_align_mask = (uintptr_t)(sizeof(int)-1);
1171 
1172   uintptr_t usp    = (uintptr_t)fr->sp();
1173   if ((usp & sp_align_mask) != 0) return true;
1174 
1175   uintptr_t ufp    = (uintptr_t)fr->fp();
1176   if ((ufp & fp_align_mask) != 0) return true;
1177 
1178   uintptr_t old_sp = (uintptr_t)fr->sender_sp();
1179   if ((old_sp & sp_align_mask) != 0) return true;
1180   if (old_sp == 0 || old_sp == (uintptr_t)-1) return true;
1181 
1182   uintptr_t old_fp = (uintptr_t)fr->link();
1183   if ((old_fp & fp_align_mask) != 0) return true;
1184   if (old_fp == 0 || old_fp == (uintptr_t)-1 || old_fp == ufp) return true;
1185 
1186   // stack grows downwards; if old_fp is below current fp or if the stack
1187   // frame is too large, either the stack is corrupted or fp is not saved
1188   // on stack (i.e. on x86, ebp may be used as general register). The stack
1189   // is not walkable beyond current frame.
1190   if (old_fp < ufp) return true;
1191   if (old_fp - ufp > 64 * K) return true;
1192 
1193   return false;

1194 }
1195 
1196 
1197 // Set up the boot classpath.
1198 
1199 char* os::format_boot_path(const char* format_string,
1200                            const char* home,
1201                            int home_len,
1202                            char fileSep,
1203                            char pathSep) {
1204     assert((fileSep == '/' && pathSep == ':') ||
1205            (fileSep == '\\' && pathSep == ';'), "unexpected separator chars");
1206 
1207     // Scan the format string to determine the length of the actual
1208     // boot classpath, and handle platform dependencies as well.
1209     int formatted_path_len = 0;
1210     const char* p;
1211     for (p = format_string; *p != 0; ++p) {
1212         if (*p == '%') formatted_path_len += home_len - 1;
1213         ++formatted_path_len;


< prev index next >