src/share/vm/prims/jvmtiThreadState.cpp
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 61,70 ****
--- 61,71 ----
_head_env_thread_state = NULL;
_dynamic_code_event_collector = NULL;
_vm_object_alloc_event_collector = NULL;
_the_class_for_redefinition_verification = NULL;
_scratch_class_for_redefinition_verification = NULL;
+ _cur_stack_depth = UNKNOWN_STACK_DEPTH;
// JVMTI ForceEarlyReturn support
_pending_step_for_earlyret = false;
_earlyret_state = earlyret_inactive;
_earlyret_tos = ilgl;
*** 212,224 ****
// Helper routine used in several places
int JvmtiThreadState::count_frames() {
#ifdef ASSERT
uint32_t debug_bits = 0;
#endif
! assert(SafepointSynchronize::is_at_safepoint() ||
JvmtiEnv::is_thread_fully_suspended(get_thread(), false, &debug_bits),
"at safepoint or must be suspended");
if (!get_thread()->has_last_Java_frame()) return 0; // no Java frames
--- 213,226 ----
// Helper routine used in several places
int JvmtiThreadState::count_frames() {
#ifdef ASSERT
+ Thread *cur = Thread::current();
uint32_t debug_bits = 0;
#endif
! assert((cur->is_VM_thread() && SafepointSynchronize::is_at_safepoint()) ||
JvmtiEnv::is_thread_fully_suspended(get_thread(), false, &debug_bits),
"at safepoint or must be suspended");
if (!get_thread()->has_last_Java_frame()) return 0; // no Java frames
*** 242,259 ****
}
void JvmtiThreadState::invalidate_cur_stack_depth() {
Thread *cur = Thread::current();
- uint32_t debug_bits = 0;
- // The caller can be the VMThread at a safepoint, the current thread
- // or the target thread must be suspended.
guarantee((cur->is_VM_thread() && SafepointSynchronize::is_at_safepoint()) ||
! (JavaThread *)cur == get_thread() ||
! JvmtiEnv::is_thread_fully_suspended(get_thread(), false, &debug_bits),
! "sanity check");
_cur_stack_depth = UNKNOWN_STACK_DEPTH;
}
void JvmtiThreadState::incr_cur_stack_depth() {
--- 244,257 ----
}
void JvmtiThreadState::invalidate_cur_stack_depth() {
Thread *cur = Thread::current();
guarantee((cur->is_VM_thread() && SafepointSynchronize::is_at_safepoint()) ||
! (JavaThread *)cur == get_thread(),
! "must be current thread or at safepoint");
_cur_stack_depth = UNKNOWN_STACK_DEPTH;
}
void JvmtiThreadState::incr_cur_stack_depth() {
*** 278,292 ****
assert(_cur_stack_depth >= 0, "incr/decr_cur_stack_depth mismatch");
}
}
int JvmtiThreadState::cur_stack_depth() {
! uint32_t debug_bits = 0;
! guarantee(JavaThread::current() == get_thread() ||
! JvmtiEnv::is_thread_fully_suspended(get_thread(), false, &debug_bits),
! "must be current thread or suspended");
if (!is_interp_only_mode() || _cur_stack_depth == UNKNOWN_STACK_DEPTH) {
_cur_stack_depth = count_frames();
} else {
// heavy weight assert
assert(_cur_stack_depth == count_frames(),
--- 276,291 ----
assert(_cur_stack_depth >= 0, "incr/decr_cur_stack_depth mismatch");
}
}
int JvmtiThreadState::cur_stack_depth() {
! Thread *cur = Thread::current();
+ guarantee((cur->is_VM_thread() && SafepointSynchronize::is_at_safepoint()) ||
+ (JavaThread *)cur == get_thread(),
+ "must be current thread or at safepoint");
+
if (!is_interp_only_mode() || _cur_stack_depth == UNKNOWN_STACK_DEPTH) {
_cur_stack_depth = count_frames();
} else {
// heavy weight assert
assert(_cur_stack_depth == count_frames(),