< prev index next >
src/share/vm/runtime/thread.cpp
Print this page
*** 322,331 ****
--- 322,335 ----
}
#if INCLUDE_NMT
// record thread's native stack, stack grows downward
MemTracker::record_thread_stack(stack_end(), stack_size());
#endif // INCLUDE_NMT
+ log_debug(os)("Thread " UINTX_FORMAT " stack dimensions: "
+ PTR_FORMAT "-" PTR_FORMAT " (" SIZE_FORMAT "k).",
+ os::current_thread_id(), p2i(stack_base() - stack_size()),
+ p2i(stack_base()), stack_size()/1024);
}
Thread::~Thread() {
// Reclaim the objectmonitors from the omFreeList of the moribund thread.
*** 1800,1809 ****
--- 1804,1817 ----
}
// Call after last event on thread
EVENT_THREAD_EXIT(this);
+ log_debug(os)("Thread " UINTX_FORMAT " %s.",
+ os::current_thread_id(),
+ exit_type == JavaThread::normal_exit ? "exiting" : "detaching");
+
// Call Thread.exit(). We try 3 times in case we got another Thread.stop during
// the execution of the method. If that is not enough, then we don't really care. Thread.stop
// is deprecated anyhow.
if (!is_Compiler_thread()) {
int count = 3;
*** 2489,2510 ****
int allocate = os::allocate_stack_guard_pages();
// warning("Guarding at " PTR_FORMAT " for len " SIZE_FORMAT "\n", low_addr, len);
if (allocate && !os::create_stack_guard_pages((char *) low_addr, len)) {
! warning("Attempt to allocate stack guard pages failed.");
return;
}
if (os::guard_memory((char *) low_addr, len)) {
_stack_guard_state = stack_guard_enabled;
} else {
! warning("Attempt to protect stack guard pages failed.");
if (os::uncommit_memory((char *) low_addr, len)) {
! warning("Attempt to deallocate stack guard pages failed.");
}
}
}
void JavaThread::remove_stack_guard_pages() {
assert(Thread::current() == this, "from different thread");
if (_stack_guard_state == stack_guard_unused) return;
--- 2497,2525 ----
int allocate = os::allocate_stack_guard_pages();
// warning("Guarding at " PTR_FORMAT " for len " SIZE_FORMAT "\n", low_addr, len);
if (allocate && !os::create_stack_guard_pages((char *) low_addr, len)) {
! log_warning(os)("Attempt to allocate stack guard pages failed.");
return;
}
if (os::guard_memory((char *) low_addr, len)) {
_stack_guard_state = stack_guard_enabled;
} else {
! log_warning(os)("Attempt to protect stack guard pages failed ("
! PTR_FORMAT "-" PTR_FORMAT ").", p2i(low_addr), p2i(low_addr + len));
if (os::uncommit_memory((char *) low_addr, len)) {
! log_warning(os)("Attempt to deallocate stack guard pages failed.");
}
+ return;
}
+
+ log_debug(os)("Thread " UINTX_FORMAT " stack guard pages activated: "
+ PTR_FORMAT "-" PTR_FORMAT ".",
+ os::current_thread_id(), p2i(low_addr), p2i(low_addr + len));
+
}
void JavaThread::remove_stack_guard_pages() {
assert(Thread::current() == this, "from different thread");
if (_stack_guard_state == stack_guard_unused) return;
*** 2513,2532 ****
if (os::allocate_stack_guard_pages()) {
if (os::remove_stack_guard_pages((char *) low_addr, len)) {
_stack_guard_state = stack_guard_unused;
} else {
! warning("Attempt to deallocate stack guard pages failed.");
}
} else {
if (_stack_guard_state == stack_guard_unused) return;
if (os::unguard_memory((char *) low_addr, len)) {
_stack_guard_state = stack_guard_unused;
} else {
! warning("Attempt to unprotect stack guard pages failed.");
}
}
}
void JavaThread::enable_stack_reserved_zone() {
assert(_stack_guard_state != stack_guard_unused, "must be using guard pages.");
assert(_stack_guard_state != stack_guard_enabled, "already enabled");
--- 2528,2556 ----
if (os::allocate_stack_guard_pages()) {
if (os::remove_stack_guard_pages((char *) low_addr, len)) {
_stack_guard_state = stack_guard_unused;
} else {
! log_warning(os)("Attempt to deallocate stack guard pages failed ("
! PTR_FORMAT "-" PTR_FORMAT ").", p2i(low_addr), p2i(low_addr + len));
! return;
}
} else {
if (_stack_guard_state == stack_guard_unused) return;
if (os::unguard_memory((char *) low_addr, len)) {
_stack_guard_state = stack_guard_unused;
} else {
! log_warning(os)("Attempt to unprotect stack guard pages failed ("
! PTR_FORMAT "-" PTR_FORMAT ").", p2i(low_addr), p2i(low_addr + len));
! return;
}
}
+
+ log_debug(os)("Thread " UINTX_FORMAT " stack guard pages removed: "
+ PTR_FORMAT "-" PTR_FORMAT ".",
+ os::current_thread_id(), p2i(low_addr), p2i(low_addr + len));
+
}
void JavaThread::enable_stack_reserved_zone() {
assert(_stack_guard_state != stack_guard_unused, "must be using guard pages.");
assert(_stack_guard_state != stack_guard_enabled, "already enabled");
< prev index next >