< prev index next >

src/share/vm/classfile/javaClasses.cpp

Print this page




1030   // The stackSize field is only present starting in 1.4
1031   if (_stackSize_offset > 0) {
1032     assert(JDK_Version::is_gte_jdk14x_version(), "sanity check");
1033     return java_thread->long_field(_stackSize_offset);
1034   } else {
1035     return 0;
1036   }
1037 }
1038 
1039 // Write the thread status value to threadStatus field in java.lang.Thread java class.
1040 void java_lang_Thread::set_thread_status(oop java_thread,
1041                                          java_lang_Thread::ThreadStatus status) {
1042   // The threadStatus is only present starting in 1.5
1043   if (_thread_status_offset > 0) {
1044     java_thread->int_field_put(_thread_status_offset, status);
1045   }
1046 }
1047 
1048 // Read thread status value from threadStatus field in java.lang.Thread java class.
1049 java_lang_Thread::ThreadStatus java_lang_Thread::get_thread_status(oop java_thread) {
1050   assert(Thread::current()->is_Watcher_thread() || Thread::current()->is_VM_thread() ||

1051          JavaThread::current()->thread_state() == _thread_in_vm,
1052          "Java Thread is not running in vm");
1053   // The threadStatus is only present starting in 1.5
1054   if (_thread_status_offset > 0) {
1055     return (java_lang_Thread::ThreadStatus)java_thread->int_field(_thread_status_offset);
1056   } else {
1057     // All we can easily figure out is if it is alive, but that is
1058     // enough info for a valid unknown status.
1059     // These aren't restricted to valid set ThreadStatus values, so
1060     // use JVMTI values and cast.
1061     JavaThread* thr = java_lang_Thread::thread(java_thread);
1062     if (thr == NULL) {
1063       // the thread hasn't run yet or is in the process of exiting
1064       return NEW;
1065     }
1066     return (java_lang_Thread::ThreadStatus)JVMTI_THREAD_STATE_ALIVE;
1067   }
1068 }
1069 
1070 




1030   // The stackSize field is only present starting in 1.4
1031   if (_stackSize_offset > 0) {
1032     assert(JDK_Version::is_gte_jdk14x_version(), "sanity check");
1033     return java_thread->long_field(_stackSize_offset);
1034   } else {
1035     return 0;
1036   }
1037 }
1038 
1039 // Write the thread status value to threadStatus field in java.lang.Thread java class.
1040 void java_lang_Thread::set_thread_status(oop java_thread,
1041                                          java_lang_Thread::ThreadStatus status) {
1042   // The threadStatus is only present starting in 1.5
1043   if (_thread_status_offset > 0) {
1044     java_thread->int_field_put(_thread_status_offset, status);
1045   }
1046 }
1047 
1048 // Read thread status value from threadStatus field in java.lang.Thread java class.
1049 java_lang_Thread::ThreadStatus java_lang_Thread::get_thread_status(oop java_thread) {
1050   assert(Threads_lock->owned_by_self() || Thread::current()->is_Watcher_thread() ||
1051          Thread::current()->is_VM_thread() ||
1052          JavaThread::current()->thread_state() == _thread_in_vm,
1053          "Java Thread is not running in vm");
1054   // The threadStatus is only present starting in 1.5
1055   if (_thread_status_offset > 0) {
1056     return (java_lang_Thread::ThreadStatus)java_thread->int_field(_thread_status_offset);
1057   } else {
1058     // All we can easily figure out is if it is alive, but that is
1059     // enough info for a valid unknown status.
1060     // These aren't restricted to valid set ThreadStatus values, so
1061     // use JVMTI values and cast.
1062     JavaThread* thr = java_lang_Thread::thread(java_thread);
1063     if (thr == NULL) {
1064       // the thread hasn't run yet or is in the process of exiting
1065       return NEW;
1066     }
1067     return (java_lang_Thread::ThreadStatus)JVMTI_THREAD_STATE_ALIVE;
1068   }
1069 }
1070 
1071 


< prev index next >