comparison src/share/vm/runtime/thread.hpp @ 1119:547f81740344

6361589: Print out stack trace for target thread of GC crash Summary: If GC crashed with java thread involved, print out the java stack trace in error report Reviewed-by: never, ysr, coleenp, dholmes
author minqi
date Fri, 11 Dec 2009 11:09:49 -0800
parents 39b01ab7035a
children 9b9c1ee9b3f6
comparison
equal deleted inserted replaced
1118:3115100553b5 1119:547f81740344
46 class ThreadClosure; 46 class ThreadClosure;
47 class IdealGraphPrinter; 47 class IdealGraphPrinter;
48 48
49 // Class hierarchy 49 // Class hierarchy
50 // - Thread 50 // - Thread
51 // - VMThread 51 // - NamedThread
52 // - VMThread
53 // - ConcurrentGCThread
54 // - WorkerThread
55 // - GangWorker
56 // - GCTaskThread
52 // - JavaThread 57 // - JavaThread
53 // - WatcherThread 58 // - WatcherThread
54 59
55 class Thread: public ThreadShadow { 60 class Thread: public ThreadShadow {
56 friend class VMStructs; 61 friend class VMStructs;
247 // Generally will be true only of VM thread and parallel GC WorkGang 252 // Generally will be true only of VM thread and parallel GC WorkGang
248 // threads. 253 // threads.
249 virtual bool is_GC_task_thread() const { return false; } 254 virtual bool is_GC_task_thread() const { return false; }
250 virtual bool is_Watcher_thread() const { return false; } 255 virtual bool is_Watcher_thread() const { return false; }
251 virtual bool is_ConcurrentGC_thread() const { return false; } 256 virtual bool is_ConcurrentGC_thread() const { return false; }
257 virtual bool is_Named_thread() const { return false; }
252 258
253 virtual char* name() const { return (char*)"Unknown thread"; } 259 virtual char* name() const { return (char*)"Unknown thread"; }
254 260
255 // Returns the current thread 261 // Returns the current thread
256 static inline Thread* current(); 262 static inline Thread* current();
566 enum { 572 enum {
567 max_name_len = 64 573 max_name_len = 64
568 }; 574 };
569 private: 575 private:
570 char* _name; 576 char* _name;
577 // log JavaThread being processed by oops_do
578 JavaThread* _processed_thread;
579
571 public: 580 public:
572 NamedThread(); 581 NamedThread();
573 ~NamedThread(); 582 ~NamedThread();
574 // May only be called once per thread. 583 // May only be called once per thread.
575 void set_name(const char* format, ...); 584 void set_name(const char* format, ...);
585 virtual bool is_Named_thread() const { return true; }
576 virtual char* name() const { return _name == NULL ? (char*)"Unknown Thread" : _name; } 586 virtual char* name() const { return _name == NULL ? (char*)"Unknown Thread" : _name; }
587 JavaThread *processed_thread() { return _processed_thread; }
588 void set_processed_thread(JavaThread *thread) { _processed_thread = thread; }
577 }; 589 };
578 590
579 // Worker threads are named and have an id of an assigned work. 591 // Worker threads are named and have an id of an assigned work.
580 class WorkerThread: public NamedThread { 592 class WorkerThread: public NamedThread {
581 private: 593 private: