--- a/hotspot/src/share/vm/runtime/thread.cpp Wed Jul 05 21:25:35 2017 +0200
+++ b/hotspot/src/share/vm/runtime/thread.cpp Sat Mar 05 20:46:42 2016 -0800
@@ -324,6 +324,10 @@
// record thread's native stack, stack grows downward
MemTracker::record_thread_stack(stack_end(), stack_size());
#endif // INCLUDE_NMT
+ log_debug(os, thread)("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);
}
@@ -1690,7 +1694,7 @@
EventThreadStart event;
if (event.should_commit()) {
- event.set_javalangthread(java_lang_Thread::thread_id(this->threadObj()));
+ event.set_thread(THREAD_TRACE_ID(this));
event.commit();
}
@@ -1795,7 +1799,7 @@
// from java_lang_Thread object
EventThreadEnd event;
if (event.should_commit()) {
- event.set_javalangthread(java_lang_Thread::thread_id(this->threadObj()));
+ event.set_thread(THREAD_TRACE_ID(this));
event.commit();
}
@@ -1924,6 +1928,10 @@
}
#endif // INCLUDE_ALL_GCS
+ log_info(os, thread)("JavaThread %s (tid: " UINTX_FORMAT ").",
+ exit_type == JavaThread::normal_exit ? "exiting" : "detaching",
+ os::current_thread_id());
+
// Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread
Threads::remove(this);
}
@@ -2491,18 +2499,25 @@
// 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.");
+ log_warning(os, thread)("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.");
+ log_warning(os, thread)("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)) {
- warning("Attempt to deallocate stack guard pages failed.");
+ log_warning(os, thread)("Attempt to deallocate stack guard pages failed.");
}
+ return;
}
+
+ log_debug(os, thread)("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() {
@@ -2515,16 +2530,25 @@
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.");
+ log_warning(os, thread)("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 {
- warning("Attempt to unprotect stack guard pages failed.");
+ log_warning(os, thread)("Attempt to unprotect stack guard pages failed ("
+ PTR_FORMAT "-" PTR_FORMAT ").", p2i(low_addr), p2i(low_addr + len));
+ return;
}
}
+
+ log_debug(os, thread)("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() {
@@ -3530,6 +3554,10 @@
return status;
}
+ if (TRACE_INITIALIZE() != JNI_OK) {
+ vm_exit_during_initialization("Failed to initialize tracing backend");
+ }
+
// Should be done after the heap is fully created
main_thread->cache_global_variables();
@@ -3598,11 +3626,6 @@
quicken_jni_functions();
- // Must be run after init_ft which initializes ft_enabled
- if (TRACE_INITIALIZE() != JNI_OK) {
- vm_exit_during_initialization("Failed to initialize tracing backend");
- }
-
// No more stub generation allowed after that point.
StubCodeDesc::freeze();
@@ -4110,6 +4133,7 @@
if (version == JNI_VERSION_1_4) return JNI_TRUE;
if (version == JNI_VERSION_1_6) return JNI_TRUE;
if (version == JNI_VERSION_1_8) return JNI_TRUE;
+ if (version == JNI_VERSION_9) return JNI_TRUE;
return JNI_FALSE;
}