comparison src/share/vm/prims/jvmtiThreadState.cpp @ 14726:92aa6797d639

Backed out merge changeset: b51e29501f30 Backed out merge revision to its first parent (8f483e200405)
author Doug Simon <doug.simon@oracle.com>
date Mon, 24 Mar 2014 21:30:43 +0100
parents 0d8d78c0329a
children
comparison
equal deleted inserted replaced
14719:0bdd0d157040 14726:92aa6797d639
1 /* 1 /*
2 * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
61 _head_env_thread_state = NULL; 61 _head_env_thread_state = NULL;
62 _dynamic_code_event_collector = NULL; 62 _dynamic_code_event_collector = NULL;
63 _vm_object_alloc_event_collector = NULL; 63 _vm_object_alloc_event_collector = NULL;
64 _the_class_for_redefinition_verification = NULL; 64 _the_class_for_redefinition_verification = NULL;
65 _scratch_class_for_redefinition_verification = NULL; 65 _scratch_class_for_redefinition_verification = NULL;
66 _cur_stack_depth = UNKNOWN_STACK_DEPTH;
67 66
68 // JVMTI ForceEarlyReturn support 67 // JVMTI ForceEarlyReturn support
69 _pending_step_for_earlyret = false; 68 _pending_step_for_earlyret = false;
70 _earlyret_state = earlyret_inactive; 69 _earlyret_state = earlyret_inactive;
71 _earlyret_tos = ilgl; 70 _earlyret_tos = ilgl;
212 } 211 }
213 212
214 213
215 // Helper routine used in several places 214 // Helper routine used in several places
216 int JvmtiThreadState::count_frames() { 215 int JvmtiThreadState::count_frames() {
217 guarantee(SafepointSynchronize::is_at_safepoint() || 216 #ifdef ASSERT
218 (JavaThread *)Thread::current() == get_thread(), 217 uint32_t debug_bits = 0;
219 "must be current thread or at safepoint"); 218 #endif
219 assert(SafepointSynchronize::is_at_safepoint() ||
220 JvmtiEnv::is_thread_fully_suspended(get_thread(), false, &debug_bits),
221 "at safepoint or must be suspended");
220 222
221 if (!get_thread()->has_last_Java_frame()) return 0; // no Java frames 223 if (!get_thread()->has_last_Java_frame()) return 0; // no Java frames
222 224
223 ResourceMark rm; 225 ResourceMark rm;
224 RegisterMap reg_map(get_thread()); 226 RegisterMap reg_map(get_thread());
239 return n; 241 return n;
240 } 242 }
241 243
242 244
243 void JvmtiThreadState::invalidate_cur_stack_depth() { 245 void JvmtiThreadState::invalidate_cur_stack_depth() {
244 guarantee(SafepointSynchronize::is_at_safepoint() || 246 Thread *cur = Thread::current();
245 (JavaThread *)Thread::current() == get_thread(), 247 uint32_t debug_bits = 0;
246 "must be current thread or at safepoint"); 248
249 // The caller can be the VMThread at a safepoint, the current thread
250 // or the target thread must be suspended.
251 guarantee((cur->is_VM_thread() && SafepointSynchronize::is_at_safepoint()) ||
252 (JavaThread *)cur == get_thread() ||
253 JvmtiEnv::is_thread_fully_suspended(get_thread(), false, &debug_bits),
254 "sanity check");
247 255
248 _cur_stack_depth = UNKNOWN_STACK_DEPTH; 256 _cur_stack_depth = UNKNOWN_STACK_DEPTH;
249 } 257 }
250 258
251 void JvmtiThreadState::incr_cur_stack_depth() { 259 void JvmtiThreadState::incr_cur_stack_depth() {
270 assert(_cur_stack_depth >= 0, "incr/decr_cur_stack_depth mismatch"); 278 assert(_cur_stack_depth >= 0, "incr/decr_cur_stack_depth mismatch");
271 } 279 }
272 } 280 }
273 281
274 int JvmtiThreadState::cur_stack_depth() { 282 int JvmtiThreadState::cur_stack_depth() {
275 guarantee(SafepointSynchronize::is_at_safepoint() || 283 uint32_t debug_bits = 0;
276 (JavaThread *)Thread::current() == get_thread(), 284 guarantee(JavaThread::current() == get_thread() ||
277 "must be current thread or at safepoint"); 285 JvmtiEnv::is_thread_fully_suspended(get_thread(), false, &debug_bits),
286 "must be current thread or suspended");
278 287
279 if (!is_interp_only_mode() || _cur_stack_depth == UNKNOWN_STACK_DEPTH) { 288 if (!is_interp_only_mode() || _cur_stack_depth == UNKNOWN_STACK_DEPTH) {
280 _cur_stack_depth = count_frames(); 289 _cur_stack_depth = count_frames();
281 } else { 290 } else {
282 // heavy weight assert 291 // heavy weight assert