hotspot/src/share/vm/runtime/thread.cpp
changeset 35825 7c7652ee137b
parent 35495 e27da438fa13
child 36178 9739f8c767da
child 36074 11263906664c
equal deleted inserted replaced
35824:d3958ca72bf9 35825:7c7652ee137b
    29 #include "classfile/vmSymbols.hpp"
    29 #include "classfile/vmSymbols.hpp"
    30 #include "code/codeCache.hpp"
    30 #include "code/codeCache.hpp"
    31 #include "code/codeCacheExtensions.hpp"
    31 #include "code/codeCacheExtensions.hpp"
    32 #include "code/scopeDesc.hpp"
    32 #include "code/scopeDesc.hpp"
    33 #include "compiler/compileBroker.hpp"
    33 #include "compiler/compileBroker.hpp"
       
    34 #include "compiler/compileTask.hpp"
    34 #include "gc/shared/gcId.hpp"
    35 #include "gc/shared/gcId.hpp"
    35 #include "gc/shared/gcLocker.inline.hpp"
    36 #include "gc/shared/gcLocker.inline.hpp"
    36 #include "gc/shared/workgroup.hpp"
    37 #include "gc/shared/workgroup.hpp"
    37 #include "interpreter/interpreter.hpp"
    38 #include "interpreter/interpreter.hpp"
    38 #include "interpreter/linkResolver.hpp"
    39 #include "interpreter/linkResolver.hpp"
  2882   }
  2883   }
  2883 #ifndef PRODUCT
  2884 #ifndef PRODUCT
  2884   print_thread_state_on(st);
  2885   print_thread_state_on(st);
  2885   _safepoint_state->print_on(st);
  2886   _safepoint_state->print_on(st);
  2886 #endif // PRODUCT
  2887 #endif // PRODUCT
       
  2888   if (is_Compiler_thread()) {
       
  2889     CompilerThread* ct = (CompilerThread*)this;
       
  2890     if (ct->task() != NULL) {
       
  2891       st->print("   Compiling: ");
       
  2892       ct->task()->print(st, NULL, true, false);
       
  2893     } else {
       
  2894       st->print("   No compile task");
       
  2895     }
       
  2896     st->cr();
       
  2897   }
       
  2898 }
       
  2899 
       
  2900 void JavaThread::print_name_on_error(outputStream* st, char *buf, int buflen) const {
       
  2901   st->print("%s", get_thread_name_string(buf, buflen));
  2887 }
  2902 }
  2888 
  2903 
  2889 // Called by fatal error handler. The difference between this and
  2904 // Called by fatal error handler. The difference between this and
  2890 // JavaThread::print() is that we can't grab lock or allocate memory.
  2905 // JavaThread::print() is that we can't grab lock or allocate memory.
  2891 void JavaThread::print_on_error(outputStream* st, char *buf, int buflen) const {
  2906 void JavaThread::print_on_error(outputStream* st, char *buf, int buflen) const {
  4384   WatcherThread* wt = WatcherThread::watcher_thread();
  4399   WatcherThread* wt = WatcherThread::watcher_thread();
  4385   if (wt != NULL) {
  4400   if (wt != NULL) {
  4386     wt->print_on(st);
  4401     wt->print_on(st);
  4387     st->cr();
  4402     st->cr();
  4388   }
  4403   }
  4389   CompileBroker::print_compiler_threads_on(st);
       
  4390   st->flush();
  4404   st->flush();
  4391 }
  4405 }
  4392 
  4406 
  4393 // Threads::print_on_error() is called by fatal error handler. It's possible
  4407 // Threads::print_on_error() is called by fatal error handler. It's possible
  4394 // that VM is not at safepoint and/or current thread is inside signal handler.
  4408 // that VM is not at safepoint and/or current thread is inside signal handler.
  4437     st->cr();
  4451     st->cr();
  4438     st->print("=>" PTR_FORMAT " (exited) ", p2i(current));
  4452     st->print("=>" PTR_FORMAT " (exited) ", p2i(current));
  4439     current->print_on_error(st, buf, buflen);
  4453     current->print_on_error(st, buf, buflen);
  4440     st->cr();
  4454     st->cr();
  4441   }
  4455   }
  4442 }
  4456   st->cr();
       
  4457   st->print_cr("Threads with active compile tasks:");
       
  4458   print_threads_compiling(st, buf, buflen);
       
  4459 }
       
  4460 
       
  4461 void Threads::print_threads_compiling(outputStream* st, char* buf, int buflen) {
       
  4462   ALL_JAVA_THREADS(thread) {
       
  4463     if (thread->is_Compiler_thread()) {
       
  4464       CompilerThread* ct = (CompilerThread*) thread;
       
  4465       if (ct->task() != NULL) {
       
  4466         thread->print_name_on_error(st, buf, buflen);
       
  4467         ct->task()->print(st, NULL, true, true);
       
  4468       }
       
  4469     }
       
  4470   }
       
  4471 }
       
  4472 
  4443 
  4473 
  4444 // Internal SpinLock and Mutex
  4474 // Internal SpinLock and Mutex
  4445 // Based on ParkEvent
  4475 // Based on ParkEvent
  4446 
  4476 
  4447 // Ad-hoc mutual exclusion primitives: SpinLock and Mux
  4477 // Ad-hoc mutual exclusion primitives: SpinLock and Mux