src/share/vm/prims/jvmtiEnvThreadState.cpp

Print this page




 174       // a repeat step. The new_bci and method_id is same as current_bci
 175       // and current method_id after pop and step for recursive calls.
 176       // This has been handled by clearing the location
 177       _single_stepping_posted = true;
 178       break;
 179     default:
 180       assert(false, "invalid event value passed");
 181       break;
 182     }
 183     return;
 184   }
 185 
 186   set_current_location(new_method_id, new_bci);
 187   _breakpoint_posted = false;
 188   _single_stepping_posted = false;
 189 }
 190 
 191 
 192 JvmtiFramePops* JvmtiEnvThreadState::get_frame_pops() {
 193 #ifdef ASSERT
 194   uint32_t debug_bits = 0;
 195 #endif
 196   assert(get_thread() == Thread::current() || JvmtiEnv::is_thread_fully_suspended(get_thread(), false, &debug_bits),
 197          "frame pop data only accessible from same thread or while suspended");
 198 
 199   if (_frame_pops == NULL) {
 200     _frame_pops = new JvmtiFramePops();
 201     assert(_frame_pops != NULL, "_frame_pops != NULL");
 202   }
 203   return _frame_pops;
 204 }
 205 
 206 
 207 bool JvmtiEnvThreadState::has_frame_pops() {
 208   return _frame_pops == NULL? false : (_frame_pops->length() > 0);
 209 }
 210 
 211 void JvmtiEnvThreadState::set_frame_pop(int frame_number) {
 212 #ifdef ASSERT
 213   uint32_t debug_bits = 0;
 214 #endif
 215   assert(get_thread() == Thread::current() || JvmtiEnv::is_thread_fully_suspended(get_thread(), false, &debug_bits),
 216          "frame pop data only accessible from same thread or while suspended");
 217   JvmtiFramePop fpop(frame_number);
 218   JvmtiEventController::set_frame_pop(this, fpop);
 219 }
 220 
 221 
 222 void JvmtiEnvThreadState::clear_frame_pop(int frame_number) {
 223 #ifdef ASSERT
 224   uint32_t debug_bits = 0;
 225 #endif
 226   assert(get_thread() == Thread::current() || JvmtiEnv::is_thread_fully_suspended(get_thread(), false, &debug_bits),
 227          "frame pop data only accessible from same thread or while suspended");
 228   JvmtiFramePop fpop(frame_number);
 229   JvmtiEventController::clear_frame_pop(this, fpop);
 230 }
 231 
 232 
 233 void JvmtiEnvThreadState::clear_to_frame_pop(int frame_number)  {
 234 #ifdef ASSERT
 235   uint32_t debug_bits = 0;
 236 #endif
 237   assert(get_thread() == Thread::current() || JvmtiEnv::is_thread_fully_suspended(get_thread(), false, &debug_bits),
 238          "frame pop data only accessible from same thread or while suspended");
 239   JvmtiFramePop fpop(frame_number);
 240   JvmtiEventController::clear_to_frame_pop(this, fpop);
 241 }
 242 
 243 
 244 bool JvmtiEnvThreadState::is_frame_pop(int cur_frame_number) {
 245 #ifdef ASSERT
 246   uint32_t debug_bits = 0;
 247 #endif
 248   assert(get_thread() == Thread::current() || JvmtiEnv::is_thread_fully_suspended(get_thread(), false, &debug_bits),
 249          "frame pop data only accessible from same thread or while suspended");
 250   if (!get_thread()->is_interp_only_mode() || _frame_pops == NULL) {
 251     return false;
 252   }
 253   JvmtiFramePop fp(cur_frame_number);
 254   return get_frame_pops()->contains(fp);
 255 }
 256 
 257 
 258 class VM_GetCurrentLocation : public VM_Operation {
 259  private:
 260    JavaThread *_thread;
 261    jmethodID _method_id;
 262    int _bci;
 263 
 264  public:
 265   VM_GetCurrentLocation(JavaThread *thread) {
 266      _thread = thread;
 267    }
 268   VMOp_Type type() const { return VMOp_GetCurrentLocation; }
 269   void doit() {




 174       // a repeat step. The new_bci and method_id is same as current_bci
 175       // and current method_id after pop and step for recursive calls.
 176       // This has been handled by clearing the location
 177       _single_stepping_posted = true;
 178       break;
 179     default:
 180       assert(false, "invalid event value passed");
 181       break;
 182     }
 183     return;
 184   }
 185 
 186   set_current_location(new_method_id, new_bci);
 187   _breakpoint_posted = false;
 188   _single_stepping_posted = false;
 189 }
 190 
 191 
 192 JvmtiFramePops* JvmtiEnvThreadState::get_frame_pops() {
 193 #ifdef ASSERT
 194   Thread* cur =  Thread::current();
 195 #endif
 196   assert(get_thread() == cur || (cur->is_VM_thread() && SafepointSynchronize::is_at_safepoint()),
 197          "frame pop data only accessible from same thread or at safepoint");

 198   if (_frame_pops == NULL) {
 199     _frame_pops = new JvmtiFramePops();
 200     assert(_frame_pops != NULL, "_frame_pops != NULL");
 201   }
 202   return _frame_pops;
 203 }
 204 
 205 
 206 bool JvmtiEnvThreadState::has_frame_pops() {
 207   return _frame_pops == NULL? false : (_frame_pops->length() > 0);
 208 }
 209 
 210 void JvmtiEnvThreadState::set_frame_pop(int frame_number) {
 211 #ifdef ASSERT
 212   Thread* cur =  Thread::current();
 213 #endif
 214   assert(get_thread() == cur || (cur->is_VM_thread() && SafepointSynchronize::is_at_safepoint()),
 215          "frame pop data only accessible from same thread or at safepoint");
 216   JvmtiFramePop fpop(frame_number);
 217   JvmtiEventController::set_frame_pop(this, fpop);
 218 }
 219 
 220 
 221 void JvmtiEnvThreadState::clear_frame_pop(int frame_number) {
 222 #ifdef ASSERT
 223   Thread* cur =  Thread::current();
 224 #endif
 225   assert(get_thread() == cur || (cur->is_VM_thread() && SafepointSynchronize::is_at_safepoint()),
 226          "frame pop data only accessible from same thread or at safepoint");
 227   JvmtiFramePop fpop(frame_number);
 228   JvmtiEventController::clear_frame_pop(this, fpop);
 229 }
 230 
 231 
 232 void JvmtiEnvThreadState::clear_to_frame_pop(int frame_number)  {
 233 #ifdef ASSERT
 234   Thread* cur =  Thread::current();
 235 #endif
 236   assert(get_thread() == cur || (cur->is_VM_thread() && SafepointSynchronize::is_at_safepoint()),
 237          "frame pop data only accessible from same thread or at safepoint");
 238   JvmtiFramePop fpop(frame_number);
 239   JvmtiEventController::clear_to_frame_pop(this, fpop);
 240 }
 241 
 242 
 243 bool JvmtiEnvThreadState::is_frame_pop(int cur_frame_number) {
 244 #ifdef ASSERT
 245   Thread* cur =  Thread::current();
 246 #endif
 247   assert(get_thread() == cur || (cur->is_VM_thread() && SafepointSynchronize::is_at_safepoint()),
 248          "frame pop data only accessible from same thread or at safepoint");
 249   if (!get_thread()->is_interp_only_mode() || _frame_pops == NULL) {
 250     return false;
 251   }
 252   JvmtiFramePop fp(cur_frame_number);
 253   return get_frame_pops()->contains(fp);
 254 }
 255 
 256 
 257 class VM_GetCurrentLocation : public VM_Operation {
 258  private:
 259    JavaThread *_thread;
 260    jmethodID _method_id;
 261    int _bci;
 262 
 263  public:
 264   VM_GetCurrentLocation(JavaThread *thread) {
 265      _thread = thread;
 266    }
 267   VMOp_Type type() const { return VMOp_GetCurrentLocation; }
 268   void doit() {