735
736 void set_crash_protection(os::WatcherThreadCrashProtection* crash_protection) {
737 assert(Thread::current()->is_Watcher_thread(), "Can only be set by WatcherThread");
738 _crash_protection = crash_protection;
739 }
740
741 bool has_crash_protection() const { return _crash_protection != NULL; }
742 os::WatcherThreadCrashProtection* crash_protection() const { return _crash_protection; }
743
744 private:
745 int sleep() const;
746 };
747
748
749 class CompilerThread;
750
751 typedef void (*ThreadFunction)(JavaThread*, TRAPS);
752
753 class JavaThread: public Thread {
754 friend class VMStructs;
755 private:
756 JavaThread* _next; // The next thread in the Threads list
757 oop _threadObj; // The Java level thread object
758
759 #ifdef ASSERT
760 private:
761 int _java_call_counter;
762
763 public:
764 int java_call_counter() { return _java_call_counter; }
765 void inc_java_call_counter() { _java_call_counter++; }
766 void dec_java_call_counter() {
767 assert(_java_call_counter > 0, "Invalid nesting of JavaCallWrapper");
768 _java_call_counter--;
769 }
770 private: // restore original namespace restriction
771 #endif // ifdef ASSERT
772
773 #ifndef PRODUCT
774 public:
986 // Thread oop. threadObj() can be NULL for initial JavaThread
987 // (or for threads attached via JNI)
988 oop threadObj() const { return _threadObj; }
989 void set_threadObj(oop p) { _threadObj = p; }
990
991 ThreadPriority java_priority() const; // Read from threadObj()
992
993 // Prepare thread and add to priority queue. If a priority is
994 // not specified, use the priority of the thread object. Threads_lock
995 // must be held while this function is called.
996 void prepare(jobject jni_thread, ThreadPriority prio=NoPriority);
997 void prepare_ext();
998
999 void set_saved_exception_pc(address pc) { _saved_exception_pc = pc; }
1000 address saved_exception_pc() { return _saved_exception_pc; }
1001
1002
1003 ThreadFunction entry_point() const { return _entry_point; }
1004
1005 // Allocates a new Java level thread object for this thread. thread_name may be NULL.
1006 void allocate_threadObj(Handle thread_group, char* thread_name, bool daemon, TRAPS);
1007
1008 // Last frame anchor routines
1009
1010 JavaFrameAnchor* frame_anchor(void) { return &_anchor; }
1011
1012 // last_Java_sp
1013 bool has_last_Java_frame() const { return _anchor.has_last_Java_frame(); }
1014 intptr_t* last_Java_sp() const { return _anchor.last_Java_sp(); }
1015
1016 // last_Java_pc
1017
1018 address last_Java_pc(void) { return _anchor.last_Java_pc(); }
1019
1020 // Safepoint support
1021 #ifndef PPC64
1022 JavaThreadState thread_state() const { return _thread_state; }
1023 void set_thread_state(JavaThreadState s) { _thread_state = s; }
1024 #else
1025 // Use membars when accessing volatile _thread_state. See
1026 // Threads::create_vm() for size checks.
|
735
736 void set_crash_protection(os::WatcherThreadCrashProtection* crash_protection) {
737 assert(Thread::current()->is_Watcher_thread(), "Can only be set by WatcherThread");
738 _crash_protection = crash_protection;
739 }
740
741 bool has_crash_protection() const { return _crash_protection != NULL; }
742 os::WatcherThreadCrashProtection* crash_protection() const { return _crash_protection; }
743
744 private:
745 int sleep() const;
746 };
747
748
749 class CompilerThread;
750
751 typedef void (*ThreadFunction)(JavaThread*, TRAPS);
752
753 class JavaThread: public Thread {
754 friend class VMStructs;
755 friend class WhiteBox;
756 private:
757 JavaThread* _next; // The next thread in the Threads list
758 oop _threadObj; // The Java level thread object
759
760 #ifdef ASSERT
761 private:
762 int _java_call_counter;
763
764 public:
765 int java_call_counter() { return _java_call_counter; }
766 void inc_java_call_counter() { _java_call_counter++; }
767 void dec_java_call_counter() {
768 assert(_java_call_counter > 0, "Invalid nesting of JavaCallWrapper");
769 _java_call_counter--;
770 }
771 private: // restore original namespace restriction
772 #endif // ifdef ASSERT
773
774 #ifndef PRODUCT
775 public:
987 // Thread oop. threadObj() can be NULL for initial JavaThread
988 // (or for threads attached via JNI)
989 oop threadObj() const { return _threadObj; }
990 void set_threadObj(oop p) { _threadObj = p; }
991
992 ThreadPriority java_priority() const; // Read from threadObj()
993
994 // Prepare thread and add to priority queue. If a priority is
995 // not specified, use the priority of the thread object. Threads_lock
996 // must be held while this function is called.
997 void prepare(jobject jni_thread, ThreadPriority prio=NoPriority);
998 void prepare_ext();
999
1000 void set_saved_exception_pc(address pc) { _saved_exception_pc = pc; }
1001 address saved_exception_pc() { return _saved_exception_pc; }
1002
1003
1004 ThreadFunction entry_point() const { return _entry_point; }
1005
1006 // Allocates a new Java level thread object for this thread. thread_name may be NULL.
1007 void allocate_threadObj(Handle thread_group, const char* thread_name, bool daemon, TRAPS);
1008
1009 // Last frame anchor routines
1010
1011 JavaFrameAnchor* frame_anchor(void) { return &_anchor; }
1012
1013 // last_Java_sp
1014 bool has_last_Java_frame() const { return _anchor.has_last_Java_frame(); }
1015 intptr_t* last_Java_sp() const { return _anchor.last_Java_sp(); }
1016
1017 // last_Java_pc
1018
1019 address last_Java_pc(void) { return _anchor.last_Java_pc(); }
1020
1021 // Safepoint support
1022 #ifndef PPC64
1023 JavaThreadState thread_state() const { return _thread_state; }
1024 void set_thread_state(JavaThreadState s) { _thread_state = s; }
1025 #else
1026 // Use membars when accessing volatile _thread_state. See
1027 // Threads::create_vm() for size checks.
|