< prev index next >

src/share/vm/prims/jvmtiThreadState.hpp

Print this page




  59  private:
  60   JvmtiThreadState* state;
  61  public:
  62   JvmtiEnvThreadStateIterator(JvmtiThreadState* thread_state);
  63   ~JvmtiEnvThreadStateIterator();
  64   JvmtiEnvThreadState* first();
  65   JvmtiEnvThreadState* next(JvmtiEnvThreadState* ets);
  66 };
  67 
  68 
  69 ///////////////////////////////////////////////////////////////
  70 //
  71 // class JvmtiThreadState
  72 //
  73 // The Jvmti state for each thread (across all JvmtiEnv):
  74 // 1. Local table of enabled events.
  75 class JvmtiThreadState : public CHeapObj<mtInternal> {
  76  private:
  77   friend class JvmtiEnv;
  78   JavaThread        *_thread;
  79   bool              _exception_detected;
  80   bool              _exception_caught;
  81   bool              _hide_single_stepping;
  82   bool              _pending_step_for_popframe;
  83   bool              _pending_step_for_earlyret;
  84   int               _hide_level;
  85 










  86   // Used to send class being redefined/retransformed and kind of transform
  87   // info to the class file load hook event handler.
  88   KlassHandle           *_class_being_redefined;
  89   JvmtiClassLoadKind    _class_load_kind;
  90 
  91   // This is only valid when is_interp_only_mode() returns true
  92   int               _cur_stack_depth;
  93 
  94   JvmtiThreadEventEnable _thread_event_enable;
  95 
  96   // for support of JvmtiEnvThreadState
  97   JvmtiEnvThreadState*   _head_env_thread_state;
  98 
  99   // doubly-linked linear list of active thread state
 100   // needed in order to iterate the list without holding Threads_lock
 101   static JvmtiThreadState *_head;
 102   JvmtiThreadState *_next;
 103   JvmtiThreadState *_prev;
 104 
 105   // holds the current dynamic code event collector, NULL if no event collector in use


 144   static JvmtiThreadState *first() {
 145     assert(Threads::number_of_threads() == 0 || JvmtiThreadState_lock->is_locked(), "sanity check");
 146     return _head;
 147   }
 148 
 149   JvmtiThreadState *next()                  {
 150     return _next;
 151   }
 152 
 153   // Current stack depth is only valid when is_interp_only_mode() returns true.
 154   // These functions should only be called at a safepoint - usually called from same thread.
 155   // Returns the number of Java activations on the stack.
 156   int cur_stack_depth();
 157   void invalidate_cur_stack_depth();
 158   void incr_cur_stack_depth();
 159   void decr_cur_stack_depth();
 160 
 161   int count_frames();
 162 
 163   inline JavaThread *get_thread()      { return _thread;              }
 164   inline bool is_exception_detected()  { return _exception_detected;  }
 165   inline bool is_exception_caught()    { return _exception_caught;  }
 166   inline void set_exception_detected() { _exception_detected = true;
 167                                          _exception_caught = false; }
 168   inline void clear_exception_detected() {
 169     _exception_detected = false;
 170     assert(_exception_caught == false, "_exception_caught is out of phase");
 171   }
 172   inline void set_exception_caught()   { _exception_caught = true;
 173                                          _exception_detected = false; }


 174 
 175   inline void clear_hide_single_stepping() {
 176     if (_hide_level > 0) {
 177       _hide_level--;
 178     } else {
 179       assert(_hide_single_stepping, "hide_single_stepping is out of phase");
 180       _hide_single_stepping = false;
 181     }
 182   }
 183   inline bool hide_single_stepping() { return _hide_single_stepping; }
 184   inline void set_hide_single_stepping() {
 185     if (_hide_single_stepping) {
 186       _hide_level++;
 187     } else {
 188       assert(_hide_level == 0, "hide_level is out of phase");
 189       _hide_single_stepping = true;
 190     }
 191   }
 192 
 193   // Step pending flag is set when PopFrame is called and it is cleared




  59  private:
  60   JvmtiThreadState* state;
  61  public:
  62   JvmtiEnvThreadStateIterator(JvmtiThreadState* thread_state);
  63   ~JvmtiEnvThreadStateIterator();
  64   JvmtiEnvThreadState* first();
  65   JvmtiEnvThreadState* next(JvmtiEnvThreadState* ets);
  66 };
  67 
  68 
  69 ///////////////////////////////////////////////////////////////
  70 //
  71 // class JvmtiThreadState
  72 //
  73 // The Jvmti state for each thread (across all JvmtiEnv):
  74 // 1. Local table of enabled events.
  75 class JvmtiThreadState : public CHeapObj<mtInternal> {
  76  private:
  77   friend class JvmtiEnv;
  78   JavaThread        *_thread;


  79   bool              _hide_single_stepping;
  80   bool              _pending_step_for_popframe;
  81   bool              _pending_step_for_earlyret;
  82   int               _hide_level;
  83 
  84  public:
  85   enum ExceptionState {
  86     ES_CLEARED,
  87     ES_DETECTED,
  88     ES_CAUGHT
  89   };
  90 
  91  private:
  92   ExceptionState _exception_state;
  93 
  94   // Used to send class being redefined/retransformed and kind of transform
  95   // info to the class file load hook event handler.
  96   KlassHandle           *_class_being_redefined;
  97   JvmtiClassLoadKind    _class_load_kind;
  98 
  99   // This is only valid when is_interp_only_mode() returns true
 100   int               _cur_stack_depth;
 101 
 102   JvmtiThreadEventEnable _thread_event_enable;
 103 
 104   // for support of JvmtiEnvThreadState
 105   JvmtiEnvThreadState*   _head_env_thread_state;
 106 
 107   // doubly-linked linear list of active thread state
 108   // needed in order to iterate the list without holding Threads_lock
 109   static JvmtiThreadState *_head;
 110   JvmtiThreadState *_next;
 111   JvmtiThreadState *_prev;
 112 
 113   // holds the current dynamic code event collector, NULL if no event collector in use


 152   static JvmtiThreadState *first() {
 153     assert(Threads::number_of_threads() == 0 || JvmtiThreadState_lock->is_locked(), "sanity check");
 154     return _head;
 155   }
 156 
 157   JvmtiThreadState *next()                  {
 158     return _next;
 159   }
 160 
 161   // Current stack depth is only valid when is_interp_only_mode() returns true.
 162   // These functions should only be called at a safepoint - usually called from same thread.
 163   // Returns the number of Java activations on the stack.
 164   int cur_stack_depth();
 165   void invalidate_cur_stack_depth();
 166   void incr_cur_stack_depth();
 167   void decr_cur_stack_depth();
 168 
 169   int count_frames();
 170 
 171   inline JavaThread *get_thread()      { return _thread;              }
 172 
 173   inline bool is_exception_detected()  { return _exception_state == ES_DETECTED;  }
 174   inline bool is_exception_caught()    { return _exception_state == ES_CAUGHT;  }
 175 
 176   inline void set_exception_detected() { _exception_state = ES_DETECTED; }
 177   inline void set_exception_caught()   { _exception_state = ES_CAUGHT; }
 178 
 179   inline void clear_exception_state() { _exception_state = ES_CLEARED; }
 180 
 181   // We need to save and restore exception state inside JvmtiEventMark
 182   inline void save_exception_state(ExceptionState *state) { *state = _exception_state; }
 183   inline void restore_exception_state(ExceptionState state) { _exception_state = state; }
 184 
 185   inline void clear_hide_single_stepping() {
 186     if (_hide_level > 0) {
 187       _hide_level--;
 188     } else {
 189       assert(_hide_single_stepping, "hide_single_stepping is out of phase");
 190       _hide_single_stepping = false;
 191     }
 192   }
 193   inline bool hide_single_stepping() { return _hide_single_stepping; }
 194   inline void set_hide_single_stepping() {
 195     if (_hide_single_stepping) {
 196       _hide_level++;
 197     } else {
 198       assert(_hide_level == 0, "hide_level is out of phase");
 199       _hide_single_stepping = true;
 200     }
 201   }
 202 
 203   // Step pending flag is set when PopFrame is called and it is cleared


< prev index next >