hotspot/src/share/vm/classfile/javaClasses.hpp
changeset 37064 5c82fa70d313
parent 35606 d873b64009cc
child 37172 ff4d69314a4c
equal deleted inserted replaced
37063:c9d5a3727011 37064:5c82fa70d313
   438 
   438 
   439 // Interface to java.lang.Throwable objects
   439 // Interface to java.lang.Throwable objects
   440 
   440 
   441 class java_lang_Throwable: AllStatic {
   441 class java_lang_Throwable: AllStatic {
   442   friend class BacktraceBuilder;
   442   friend class BacktraceBuilder;
       
   443   friend class BacktraceIterator;
   443 
   444 
   444  private:
   445  private:
   445   // Offsets
   446   // Offsets
   446   enum {
   447   enum {
   447     hc_backtrace_offset     =  0,
   448     hc_backtrace_offset     =  0,
   463     trace_chunk_size     = 32
   464     trace_chunk_size     = 32
   464   };
   465   };
   465 
   466 
   466   static int backtrace_offset;
   467   static int backtrace_offset;
   467   static int detailMessage_offset;
   468   static int detailMessage_offset;
   468   static int cause_offset;
       
   469   static int stackTrace_offset;
   469   static int stackTrace_offset;
       
   470   static int depth_offset;
   470   static int static_unassigned_stacktrace_offset;
   471   static int static_unassigned_stacktrace_offset;
   471 
   472 
   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)
   473   // StackTrace (programmatic access, new since 1.4)
   475   static void clear_stacktrace(oop throwable);
   474   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)
   475   // Stacktrace (post JDK 1.7.0 to allow immutability protocol to be followed)
   479   static void set_stacktrace(oop throwable, oop st_element_array);
   476   static void set_stacktrace(oop throwable, oop st_element_array);
   480   static oop unassigned_stacktrace();
   477   static oop unassigned_stacktrace();
   481 
   478 
   482  public:
   479  public:
   483   // Backtrace
   480   // Backtrace
   484   static oop backtrace(oop throwable);
   481   static oop backtrace(oop throwable);
   485   static void set_backtrace(oop throwable, oop value);
   482   static void set_backtrace(oop throwable, oop value);
       
   483   static int depth(oop throwable);
       
   484   static void set_depth(oop throwable, int value);
   486   // Needed by JVMTI to filter out this internal field.
   485   // Needed by JVMTI to filter out this internal field.
   487   static int get_backtrace_offset() { return backtrace_offset;}
   486   static int get_backtrace_offset() { return backtrace_offset;}
   488   static int get_detailMessage_offset() { return detailMessage_offset;}
   487   static int get_detailMessage_offset() { return detailMessage_offset;}
   489   // Message
   488   // Message
   490   static oop message(oop throwable);
       
   491   static oop message(Handle throwable);
   489   static oop message(Handle throwable);
   492   static void set_message(oop throwable, oop value);
   490   static void set_message(oop throwable, oop value);
   493   static Symbol* detail_message(oop throwable);
   491   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);
   492   static void print_stack_element(outputStream *st, const methodHandle& method, int bci);
   497   static void print_stack_usage(Handle stream);
   493   static void print_stack_usage(Handle stream);
       
   494 
       
   495   static void compute_offsets();
   498 
   496 
   499   // Allocate space for backtrace (created but stack trace not filled in)
   497   // Allocate space for backtrace (created but stack trace not filled in)
   500   static void allocate_backtrace(Handle throwable, TRAPS);
   498   static void allocate_backtrace(Handle throwable, TRAPS);
   501   // Fill in current stack trace for throwable with preallocated backtrace (no GC)
   499   // Fill in current stack trace for throwable with preallocated backtrace (no GC)
   502   static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable);
   500   static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable);
   503   // Fill in current stack trace, can cause GC
   501   // Fill in current stack trace, can cause GC
   504   static void fill_in_stack_trace(Handle throwable, const methodHandle& method, TRAPS);
   502   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());
   503   static void fill_in_stack_trace(Handle throwable, const methodHandle& method = methodHandle());
   506   // Programmatic access to stack trace
   504   // Programmatic access to stack trace
   507   static oop  get_stack_trace_element(oop throwable, int index, TRAPS);
   505   static void get_stack_trace_elements(Handle throwable, objArrayHandle stack_trace, TRAPS);
   508   static int  get_stack_trace_depth(oop throwable, TRAPS);
       
   509   // Printing
   506   // Printing
   510   static void print(Handle throwable, outputStream* st);
   507   static void print(Handle throwable, outputStream* st);
   511   static void print_stack_trace(Handle throwable, outputStream* st);
   508   static void print_stack_trace(Handle throwable, outputStream* st);
   512   static void java_printStackTrace(Handle throwable, TRAPS);
   509   static void java_printStackTrace(Handle throwable, TRAPS);
   513   // Debugging
   510   // Debugging
  1275   static int declaringClass_offset;
  1272   static int declaringClass_offset;
  1276   static int methodName_offset;
  1273   static int methodName_offset;
  1277   static int fileName_offset;
  1274   static int fileName_offset;
  1278   static int lineNumber_offset;
  1275   static int lineNumber_offset;
  1279 
  1276 
  1280  public:
       
  1281   // Setters
  1277   // Setters
  1282   static void set_declaringClass(oop element, oop value);
  1278   static void set_declaringClass(oop element, oop value);
  1283   static void set_methodName(oop element, oop value);
  1279   static void set_methodName(oop element, oop value);
  1284   static void set_fileName(oop element, oop value);
  1280   static void set_fileName(oop element, oop value);
  1285   static void set_lineNumber(oop element, int value);
  1281   static void set_lineNumber(oop element, int value);
  1286 
  1282 
       
  1283  public:
  1287   // Create an instance of StackTraceElement
  1284   // 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);
  1285   static oop create(const methodHandle& method, int bci, TRAPS);
       
  1286 
       
  1287   static void fill_in(Handle element, InstanceKlass* holder, const methodHandle& method,
       
  1288                       int version, int bci, int cpref, TRAPS);
  1290 
  1289 
  1291   // Debugging
  1290   // Debugging
  1292   friend class JavaClasses;
  1291   friend class JavaClasses;
  1293 };
  1292 };
  1294 
  1293