423 // groups 424 static objArrayOop groups(oop java_thread_group); 425 // maxPriority in group 426 static ThreadPriority maxPriority(oop java_thread_group); 427 // Destroyed 428 static bool is_destroyed(oop java_thread_group); 429 // Daemon 430 static bool is_daemon(oop java_thread_group); 431 // vmAllowSuspension 432 static bool is_vmAllowSuspension(oop java_thread_group); 433 // Debugging 434 friend class JavaClasses; 435 }; 436 437 438 439 // Interface to java.lang.Throwable objects 440 441 class java_lang_Throwable: AllStatic { 442 friend class BacktraceBuilder; 443 444 private: 445 // Offsets 446 enum { 447 hc_backtrace_offset = 0, 448 hc_detailMessage_offset = 1, 449 hc_cause_offset = 2, // New since 1.4 450 hc_stackTrace_offset = 3 // New since 1.4 451 }; 452 enum { 453 hc_static_unassigned_stacktrace_offset = 0 // New since 1.7 454 }; 455 // Trace constants 456 enum { 457 trace_methods_offset = 0, 458 trace_bcis_offset = 1, 459 trace_mirrors_offset = 2, 460 trace_cprefs_offset = 3, 461 trace_next_offset = 4, 462 trace_size = 5, 463 trace_chunk_size = 32 464 }; 465 466 static int backtrace_offset; 467 static int detailMessage_offset; 468 static int cause_offset; 469 static int stackTrace_offset; 470 static int static_unassigned_stacktrace_offset; 471 472 // Printing 473 static char* print_stack_element_to_buffer(Handle mirror, int method, int version, int bci, int cpref); 474 // StackTrace (programmatic access, new since 1.4) 475 static void clear_stacktrace(oop throwable); 476 // No stack trace available 477 static const char* no_stack_trace_message(); 478 // Stacktrace (post JDK 1.7.0 to allow immutability protocol to be followed) 479 static void set_stacktrace(oop throwable, oop st_element_array); 480 static oop unassigned_stacktrace(); 481 482 public: 483 // Backtrace 484 static oop backtrace(oop throwable); 485 static void set_backtrace(oop throwable, oop value); 486 // Needed by JVMTI to filter out this internal field. 487 static int get_backtrace_offset() { return backtrace_offset;} 488 static int get_detailMessage_offset() { return detailMessage_offset;} 489 // Message 490 static oop message(oop throwable); 491 static oop message(Handle throwable); 492 static void set_message(oop throwable, oop value); 493 static Symbol* detail_message(oop throwable); 494 static void print_stack_element(outputStream *st, Handle mirror, int method, 495 int version, int bci, int cpref); 496 static void print_stack_element(outputStream *st, const methodHandle& method, int bci); 497 static void print_stack_usage(Handle stream); 498 499 // Allocate space for backtrace (created but stack trace not filled in) 500 static void allocate_backtrace(Handle throwable, TRAPS); 501 // Fill in current stack trace for throwable with preallocated backtrace (no GC) 502 static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable); 503 // Fill in current stack trace, can cause GC 504 static void fill_in_stack_trace(Handle throwable, const methodHandle& method, TRAPS); 505 static void fill_in_stack_trace(Handle throwable, const methodHandle& method = methodHandle()); 506 // Programmatic access to stack trace 507 static oop get_stack_trace_element(oop throwable, int index, TRAPS); 508 static int get_stack_trace_depth(oop throwable, TRAPS); 509 // Printing 510 static void print(Handle throwable, outputStream* st); 511 static void print_stack_trace(Handle throwable, outputStream* st); 512 static void java_printStackTrace(Handle throwable, TRAPS); 513 // Debugging 514 friend class JavaClasses; 515 }; 516 517 518 // Interface to java.lang.reflect.AccessibleObject objects 519 520 class java_lang_reflect_AccessibleObject: AllStatic { 521 private: 522 // Note that to reduce dependencies on the JDK we compute these 523 // offsets at run-time. 524 static int override_offset; 525 526 static void compute_offsets(); 527 528 public: 1260 friend class JavaClasses; 1261 }; 1262 1263 1264 // Interface to java.lang.StackTraceElement objects 1265 1266 class java_lang_StackTraceElement: AllStatic { 1267 private: 1268 enum { 1269 hc_declaringClass_offset = 0, 1270 hc_methodName_offset = 1, 1271 hc_fileName_offset = 2, 1272 hc_lineNumber_offset = 3 1273 }; 1274 1275 static int declaringClass_offset; 1276 static int methodName_offset; 1277 static int fileName_offset; 1278 static int lineNumber_offset; 1279 1280 public: 1281 // Setters 1282 static void set_declaringClass(oop element, oop value); 1283 static void set_methodName(oop element, oop value); 1284 static void set_fileName(oop element, oop value); 1285 static void set_lineNumber(oop element, int value); 1286 1287 // Create an instance of StackTraceElement 1288 static oop create(Handle mirror, int method, int version, int bci, int cpref, TRAPS); 1289 static oop create(const methodHandle& method, int bci, TRAPS); 1290 1291 // Debugging 1292 friend class JavaClasses; 1293 }; 1294 1295 1296 class Backtrace: AllStatic { 1297 public: 1298 // Helper backtrace functions to store bci|version together. 1299 static int merge_bci_and_version(int bci, int version); 1300 static int merge_mid_and_cpref(int mid, int cpref); 1301 static int bci_at(unsigned int merged); 1302 static int version_at(unsigned int merged); 1303 static int mid_at(unsigned int merged); 1304 static int cpref_at(unsigned int merged); 1305 static int get_line_number(const methodHandle& method, int bci); 1306 static Symbol* get_source_file_name(InstanceKlass* holder, int version); 1307 1308 // Debugging 1309 friend class JavaClasses; | 423 // groups 424 static objArrayOop groups(oop java_thread_group); 425 // maxPriority in group 426 static ThreadPriority maxPriority(oop java_thread_group); 427 // Destroyed 428 static bool is_destroyed(oop java_thread_group); 429 // Daemon 430 static bool is_daemon(oop java_thread_group); 431 // vmAllowSuspension 432 static bool is_vmAllowSuspension(oop java_thread_group); 433 // Debugging 434 friend class JavaClasses; 435 }; 436 437 438 439 // Interface to java.lang.Throwable objects 440 441 class java_lang_Throwable: AllStatic { 442 friend class BacktraceBuilder; 443 friend class BacktraceIterator; 444 445 private: 446 // Offsets 447 enum { 448 hc_backtrace_offset = 0, 449 hc_detailMessage_offset = 1, 450 hc_cause_offset = 2, // New since 1.4 451 hc_stackTrace_offset = 3 // New since 1.4 452 }; 453 enum { 454 hc_static_unassigned_stacktrace_offset = 0 // New since 1.7 455 }; 456 // Trace constants 457 enum { 458 trace_methods_offset = 0, 459 trace_bcis_offset = 1, 460 trace_mirrors_offset = 2, 461 trace_cprefs_offset = 3, 462 trace_next_offset = 4, 463 trace_size = 5, 464 trace_chunk_size = 32 465 }; 466 467 static int backtrace_offset; 468 static int detailMessage_offset; 469 static int stackTrace_offset; 470 static int depth_offset; 471 static int static_unassigned_stacktrace_offset; 472 473 // StackTrace (programmatic access, new since 1.4) 474 static void clear_stacktrace(oop throwable); 475 // Stacktrace (post JDK 1.7.0 to allow immutability protocol to be followed) 476 static void set_stacktrace(oop throwable, oop st_element_array); 477 static oop unassigned_stacktrace(); 478 479 public: 480 // Backtrace 481 static oop backtrace(oop throwable); 482 static void set_backtrace(oop throwable, oop value); 483 static void set_depth(oop throwable, int value); 484 // Needed by JVMTI to filter out this internal field. 485 static int get_backtrace_offset() { return backtrace_offset;} 486 static int get_detailMessage_offset() { return detailMessage_offset;} 487 // Message 488 static oop message(Handle throwable); 489 static void set_message(oop throwable, oop value); 490 static Symbol* detail_message(oop throwable); 491 static void print_stack_element(outputStream *st, const methodHandle& method, int bci); 492 static void print_stack_usage(Handle stream); 493 494 static void compute_offsets(); 495 496 // Allocate space for backtrace (created but stack trace not filled in) 497 static void allocate_backtrace(Handle throwable, TRAPS); 498 // Fill in current stack trace for throwable with preallocated backtrace (no GC) 499 static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable); 500 // Fill in current stack trace, can cause GC 501 static void fill_in_stack_trace(Handle throwable, const methodHandle& method, TRAPS); 502 static void fill_in_stack_trace(Handle throwable, const methodHandle& method = methodHandle()); 503 // Programmatic access to stack trace 504 static void get_stack_trace_elements(Handle throwable, objArrayHandle stack_trace, TRAPS); 505 // Printing 506 static void print(Handle throwable, outputStream* st); 507 static void print_stack_trace(Handle throwable, outputStream* st); 508 static void java_printStackTrace(Handle throwable, TRAPS); 509 // Debugging 510 friend class JavaClasses; 511 }; 512 513 514 // Interface to java.lang.reflect.AccessibleObject objects 515 516 class java_lang_reflect_AccessibleObject: AllStatic { 517 private: 518 // Note that to reduce dependencies on the JDK we compute these 519 // offsets at run-time. 520 static int override_offset; 521 522 static void compute_offsets(); 523 524 public: 1256 friend class JavaClasses; 1257 }; 1258 1259 1260 // Interface to java.lang.StackTraceElement objects 1261 1262 class java_lang_StackTraceElement: AllStatic { 1263 private: 1264 enum { 1265 hc_declaringClass_offset = 0, 1266 hc_methodName_offset = 1, 1267 hc_fileName_offset = 2, 1268 hc_lineNumber_offset = 3 1269 }; 1270 1271 static int declaringClass_offset; 1272 static int methodName_offset; 1273 static int fileName_offset; 1274 static int lineNumber_offset; 1275 1276 // Setters 1277 static void set_declaringClass(oop element, oop value); 1278 static void set_methodName(oop element, oop value); 1279 static void set_fileName(oop element, oop value); 1280 static void set_lineNumber(oop element, int value); 1281 1282 public: 1283 // Create an instance of StackTraceElement 1284 static oop create(const methodHandle& method, int bci, TRAPS); 1285 1286 static void fill_in(Handle element, InstanceKlass* holder, const methodHandle& method, 1287 int version, int bci, int cpref, TRAPS); 1288 1289 // Debugging 1290 friend class JavaClasses; 1291 }; 1292 1293 1294 class Backtrace: AllStatic { 1295 public: 1296 // Helper backtrace functions to store bci|version together. 1297 static int merge_bci_and_version(int bci, int version); 1298 static int merge_mid_and_cpref(int mid, int cpref); 1299 static int bci_at(unsigned int merged); 1300 static int version_at(unsigned int merged); 1301 static int mid_at(unsigned int merged); 1302 static int cpref_at(unsigned int merged); 1303 static int get_line_number(const methodHandle& method, int bci); 1304 static Symbol* get_source_file_name(InstanceKlass* holder, int version); 1305 1306 // Debugging 1307 friend class JavaClasses; |