< prev index next >

hotspot/src/share/vm/prims/stackwalk.hpp

Print this page




  28 
  29 #include "oops/oop.hpp"
  30 #include "runtime/vframe.hpp"
  31 
  32 class StackWalkAnchor : public StackObj {
  33 private:
  34   enum {
  35     magic_pos = 0
  36   };
  37 
  38   JavaThread*           _thread;
  39   vframeStream          _vfst;
  40   jlong                 _anchor;
  41 public:
  42   StackWalkAnchor(JavaThread* thread)
  43     : _thread(thread), _vfst(thread), _anchor(0L) {}
  44 
  45   vframeStream&   vframe_stream()         { return _vfst; }
  46   JavaThread*     thread()                { return _thread; }
  47 
  48   void setup_magic_on_entry(objArrayHandle classes_array);
  49   bool check_magic(objArrayHandle classes_array);
  50   bool cleanup_magic_on_exit(objArrayHandle classes_array);
  51 
  52   bool is_valid_in(Thread* thread, objArrayHandle classes_array) {
  53     return (_thread == thread && check_magic(classes_array));
  54   }
  55 
  56   jlong address_value() {
  57     return (jlong) castable_address(this);
  58   }
  59 
  60   static StackWalkAnchor* from_current(JavaThread* thread, jlong anchor, objArrayHandle frames_array);
  61 };
  62 
  63 class StackWalk : public AllStatic {
  64 private:
  65   static int fill_in_frames(jlong mode, vframeStream& vfst,
  66                             int max_nframes, int start_index,
  67                             objArrayHandle classes_array,
  68                             objArrayHandle frames_array,
  69                             int& end_index, TRAPS);
  70 
  71   static void fill_stackframe(Handle stackFrame, const methodHandle& method, int bci);
  72 
  73   static void fill_live_stackframe(Handle stackFrame, const methodHandle& method, int bci,
  74                                    javaVFrame* jvf, TRAPS);
  75 
  76   static inline bool skip_hidden_frames(int mode) {
  77     return (mode & JVM_STACKWALK_SHOW_HIDDEN_FRAMES) == 0;
  78   }
  79   static inline bool need_method_info(int mode) {
  80     return (mode & JVM_STACKWALK_FILL_CLASS_REFS_ONLY) == 0;
  81   }
  82   static inline bool live_frame_info(int mode) {
  83     return (mode & JVM_STACKWALK_FILL_LIVE_STACK_FRAMES) != 0;
  84   }
  85   static inline bool fill_in_stacktrace(int mode) {
  86     return (mode & JVM_STACKWALK_FILTER_FILL_IN_STACK_TRACE) != 0;
  87   }
  88 
  89 public:



  90   static oop walk(Handle stackStream, jlong mode,
  91                   int skip_frames, int frame_count, int start_index,
  92                   objArrayHandle classes_array,
  93                   objArrayHandle frames_array,
  94                   TRAPS);
  95 
  96   static jint moreFrames(Handle stackStream, jlong mode, jlong magic,
  97                          int frame_count, int start_index,
  98                          objArrayHandle classes_array,
  99                          objArrayHandle frames_array,
 100                          TRAPS);
 101 };
 102 #endif // SHARE_VM_PRIMS_STACKWALK_HPP


  28 
  29 #include "oops/oop.hpp"
  30 #include "runtime/vframe.hpp"
  31 
  32 class StackWalkAnchor : public StackObj {
  33 private:
  34   enum {
  35     magic_pos = 0
  36   };
  37 
  38   JavaThread*           _thread;
  39   vframeStream          _vfst;
  40   jlong                 _anchor;
  41 public:
  42   StackWalkAnchor(JavaThread* thread)
  43     : _thread(thread), _vfst(thread), _anchor(0L) {}
  44 
  45   vframeStream&   vframe_stream()         { return _vfst; }
  46   JavaThread*     thread()                { return _thread; }
  47 
  48   void setup_magic_on_entry(objArrayHandle frames_array);
  49   bool check_magic(objArrayHandle frames_array);
  50   bool cleanup_magic_on_exit(objArrayHandle frames_array);
  51 
  52   bool is_valid_in(Thread* thread, objArrayHandle frames_array) {
  53     return (_thread == thread && check_magic(frames_array));
  54   }
  55 
  56   jlong address_value() {
  57     return (jlong) castable_address(this);
  58   }
  59 
  60   static StackWalkAnchor* from_current(JavaThread* thread, jlong anchor, objArrayHandle frames_array);
  61 };
  62 
  63 class StackWalk : public AllStatic {
  64 private:
  65   static int fill_in_frames(jlong mode, vframeStream& vfst,
  66                             int max_nframes, int start_index,

  67                             objArrayHandle frames_array,
  68                             int& end_index, TRAPS);
  69 
  70   static void fill_stackframe(Handle stackFrame, const methodHandle& method, int bci);
  71 
  72   static void fill_live_stackframe(Handle stackFrame, const methodHandle& method, int bci,
  73                                    javaVFrame* jvf, TRAPS);
  74 
  75   static inline bool skip_hidden_frames(int mode) {
  76     return (mode & JVM_STACKWALK_SHOW_HIDDEN_FRAMES) == 0;
  77   }
  78   static inline bool need_method_info(int mode) {
  79     return (mode & JVM_STACKWALK_FILL_CLASS_REFS_ONLY) == 0;
  80   }
  81   static inline bool live_frame_info(int mode) {
  82     return (mode & JVM_STACKWALK_FILL_LIVE_STACK_FRAMES) != 0;
  83   }



  84 
  85 public:
  86   static inline bool use_frames_array(int mode) {
  87     return (mode & JVM_STACKWALK_FILL_CLASS_REFS_ONLY) == 0;
  88   }
  89   static oop walk(Handle stackStream, jlong mode,
  90                   int skip_frames, int frame_count, int start_index,

  91                   objArrayHandle frames_array,
  92                   TRAPS);
  93 
  94   static jint moreFrames(Handle stackStream, jlong mode, jlong magic,
  95                          int frame_count, int start_index,

  96                          objArrayHandle frames_array,
  97                          TRAPS);
  98 };
  99 #endif // SHARE_VM_PRIMS_STACKWALK_HPP
< prev index next >