199 } 200 } 201 202 203 204 205 void JvmtiThreadState::enter_interp_only_mode() { 206 assert(_thread->get_interp_only_mode() == 0, "entering interp only when mode not zero"); 207 _thread->increment_interp_only_mode(); 208 } 209 210 211 void JvmtiThreadState::leave_interp_only_mode() { 212 assert(_thread->get_interp_only_mode() == 1, "leaving interp only when mode not one"); 213 _thread->decrement_interp_only_mode(); 214 } 215 216 217 // Helper routine used in several places 218 int JvmtiThreadState::count_frames() { 219 guarantee(SafepointSynchronize::is_at_safepoint() || 220 (JavaThread *)Thread::current() == get_thread(), 221 "must be current thread or at safepoint"); 222 223 if (!get_thread()->has_last_Java_frame()) return 0; // no Java frames 224 225 ResourceMark rm; 226 RegisterMap reg_map(get_thread()); 227 javaVFrame *jvf = get_thread()->last_java_vframe(®_map); 228 int n = 0; 229 while (jvf != NULL) { 230 Method* method = jvf->method(); 231 jvf = jvf->java_sender(); 232 n++; 233 } 234 return n; 235 } 236 237 238 void JvmtiThreadState::invalidate_cur_stack_depth() { 239 assert(SafepointSynchronize::is_at_safepoint() || 240 (JavaThread *)Thread::current() == get_thread() || 241 Thread::current() == get_thread()->active_handshaker(), 242 "bad synchronization with owner thread"); 243 244 _cur_stack_depth = UNKNOWN_STACK_DEPTH; 245 } | 199 } 200 } 201 202 203 204 205 void JvmtiThreadState::enter_interp_only_mode() { 206 assert(_thread->get_interp_only_mode() == 0, "entering interp only when mode not zero"); 207 _thread->increment_interp_only_mode(); 208 } 209 210 211 void JvmtiThreadState::leave_interp_only_mode() { 212 assert(_thread->get_interp_only_mode() == 1, "leaving interp only when mode not one"); 213 _thread->decrement_interp_only_mode(); 214 } 215 216 217 // Helper routine used in several places 218 int JvmtiThreadState::count_frames() { 219 Thread *current_thread = Thread::current(); 220 guarantee(SafepointSynchronize::is_at_safepoint() || 221 current_thread == get_thread() || 222 (current_thread->is_Java_thread() && (current_thread == get_thread()->active_handshaker())), 223 "must be at safepoint or target thread is suspended"); 224 225 if (!get_thread()->has_last_Java_frame()) return 0; // no Java frames 226 227 ResourceMark rm(current_thread); 228 RegisterMap reg_map(get_thread()); 229 javaVFrame *jvf = get_thread()->last_java_vframe(®_map); 230 int n = 0; 231 while (jvf != NULL) { 232 Method* method = jvf->method(); 233 jvf = jvf->java_sender(); 234 n++; 235 } 236 return n; 237 } 238 239 240 void JvmtiThreadState::invalidate_cur_stack_depth() { 241 assert(SafepointSynchronize::is_at_safepoint() || 242 (JavaThread *)Thread::current() == get_thread() || 243 Thread::current() == get_thread()->active_handshaker(), 244 "bad synchronization with owner thread"); 245 246 _cur_stack_depth = UNKNOWN_STACK_DEPTH; 247 } |