changeset 4777:1478a623482d

8016074: NMT: assertion failed: assert(thread->thread_state() == from) failed: coming from wrong thread state Summary: Uses os::NakedYield() on Solaris instead of os::yield_all() Reviewed-by: acorn, coleenp, hseigel
author zgu
date Thu, 04 Jul 2013 06:24:08 -0400
parents dd7d57bcd749
children 25a649574b3b 0d7106aa7e08 f4d7fb7ba02e
files src/share/vm/services/memTracker.hpp
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/services/memTracker.hpp	Tue Jul 09 10:03:28 2013 +0200
+++ b/src/share/vm/services/memTracker.hpp	Thu Jul 04 06:24:08 2013 -0400
@@ -402,7 +402,21 @@
   static void check_NMT_load(Thread* thr) {
     assert(thr != NULL, "Sanity check");
     if (_slowdown_calling_thread && thr != _worker_thread) {
+#ifdef _WINDOWS
+      // On Windows, os::NakedYield() does not work as well
+      // as os::yield_all()
       os::yield_all();
+#else
+     // On Solaris, os::yield_all() depends on os::sleep()
+     // which requires JavaTherad in _thread_in_vm state.
+     // Transits thread to _thread_in_vm state can be dangerous
+     // if caller holds lock, as it may deadlock with Threads_lock.
+     // So use NaKedYield instead.
+     //
+     // Linux and BSD, NakedYield() and yield_all() implementations
+     // are the same.
+      os::NakedYield();
+#endif
     }
   }