< prev index next >

src/hotspot/share/prims/jvmtiEnv.cpp

Print this page




 816     }
 817     break;
 818   case JVMTI_VERBOSE_JNI:
 819     PrintJNIResolving = value != 0;
 820     break;
 821   default:
 822     return JVMTI_ERROR_ILLEGAL_ARGUMENT;
 823   };
 824   return JVMTI_ERROR_NONE;
 825 } /* end SetVerboseFlag */
 826 
 827 
 828 // format_ptr - pre-checked for NULL
 829 jvmtiError
 830 JvmtiEnv::GetJLocationFormat(jvmtiJlocationFormat* format_ptr) {
 831   *format_ptr = JVMTI_JLOCATION_JVMBCI;
 832   return JVMTI_ERROR_NONE;
 833 } /* end GetJLocationFormat */
 834 
 835   //














































































































 836   // Thread functions
 837   //
 838 
 839 // Threads_lock NOT held
 840 // thread - NOT pre-checked
 841 // thread_state_ptr - pre-checked for NULL
 842 jvmtiError
 843 JvmtiEnv::GetThreadState(jthread thread, jint* thread_state_ptr) {
 844   JavaThread* current_thread = JavaThread::current();
 845   JavaThread* java_thread = NULL;
 846   oop thread_oop = NULL;
 847   ThreadsListHandle tlh(current_thread);
 848 
 849   if (thread == NULL) {
 850     java_thread = current_thread;
 851     thread_oop = java_thread->threadObj();
 852 
 853     if (thread_oop == NULL || !thread_oop->is_a(SystemDictionary::Thread_klass())) {
 854       return JVMTI_ERROR_INVALID_THREAD;
 855     }




 816     }
 817     break;
 818   case JVMTI_VERBOSE_JNI:
 819     PrintJNIResolving = value != 0;
 820     break;
 821   default:
 822     return JVMTI_ERROR_ILLEGAL_ARGUMENT;
 823   };
 824   return JVMTI_ERROR_NONE;
 825 } /* end SetVerboseFlag */
 826 
 827 
 828 // format_ptr - pre-checked for NULL
 829 jvmtiError
 830 JvmtiEnv::GetJLocationFormat(jvmtiJlocationFormat* format_ptr) {
 831   *format_ptr = JVMTI_JLOCATION_JVMBCI;
 832   return JVMTI_ERROR_NONE;
 833 } /* end GetJLocationFormat */
 834 
 835   //
 836   // Functions supporting Fibers
 837   //
 838 
 839 // object - pre-checked for NULL
 840 // is_fiber_ptr - pre-checked for NULL
 841 jvmtiError
 842 JvmtiEnv::IsFiber(jobject object, jboolean* is_fiber_ptr) {
 843   oop obj = JNIHandles::resolve_external_guard(object);
 844 
 845   *is_fiber_ptr = java_lang_Fiber::is_instance(obj);
 846   return JVMTI_ERROR_NONE;
 847 } /* end IsFiber */
 848 
 849 
 850 // java_thread - pre-checked
 851 // fiber_ptr - pre-checked for NULL
 852 jvmtiError
 853 JvmtiEnv::GetThreadFiber(JavaThread* java_thread, jobject* fiber_ptr) {
 854   JavaThread* current_thread  = JavaThread::current();
 855   ResourceMark rm(current_thread);
 856   oop fiber_oop = NULL;
 857   uint32_t debug_bits = 0;
 858 
 859   JvmtiThreadState *state = JvmtiThreadState::state_for(java_thread);
 860   if (state == NULL) {
 861     return JVMTI_ERROR_THREAD_NOT_ALIVE;
 862   }
 863   if (!java_thread->is_thread_fully_suspended(true, &debug_bits)) {
 864     return JVMTI_ERROR_THREAD_NOT_SUSPENDED;
 865   }
 866   fiber_oop = java_lang_Thread::fiber(java_thread->threadObj());
 867   *fiber_ptr = JNIHandles::make_local(current_thread, fiber_oop);
 868   return JVMTI_ERROR_NONE;
 869 } /* end GetThreadFiber */
 870 
 871 // thread_ptr - pre-checked for NULL
 872 jvmtiError
 873 JvmtiEnv::GetFiberThread(jobject fiber, jthread* thread_ptr) {
 874   JavaThread* current_thread  = JavaThread::current();
 875   HandleMark hm(current_thread);
 876   oop fiber_obj = JNIHandles::resolve_external_guard(fiber);
 877 
 878   if (!java_lang_Fiber::is_instance(fiber_obj)) {
 879     return JVMTI_ERROR_INVALID_FIBER;
 880   }
 881 
 882   VM_GetFiberThread op(current_thread, Handle(current_thread, fiber_obj), thread_ptr);
 883   VMThread::execute(&op);
 884 
 885   return op.result();
 886 } /* end GetFiberThread */
 887 
 888 // max_frame_count - pre-checked to be greater than or equal to 0
 889 // frame_buffer - pre-checked for NULL
 890 // count_ptr - pre-checked for NULL
 891 jvmtiError
 892 JvmtiEnv::GetFiberStackTrace(jobject fiber, jint start_depth, jint max_frame_count, jvmtiFrameInfo* frame_buffer, jint* count_ptr) {
 893   JavaThread* current_thread = JavaThread::current();
 894   HandleMark hm(current_thread);
 895   oop fiber_obj = JNIHandles::resolve_external_guard(fiber);
 896 
 897   if (!java_lang_Fiber::is_instance(fiber_obj)) {
 898     return JVMTI_ERROR_INVALID_FIBER;
 899   }
 900 
 901   VM_GetFiberStackTrace op(this, Handle(current_thread, fiber_obj),
 902                            start_depth, max_frame_count, frame_buffer, count_ptr);
 903   VMThread::execute(&op);
 904 
 905   return op.result();
 906 } /* end GetFiberStackTrace */
 907 
 908 // count_ptr - pre-checked for NULL
 909 jvmtiError
 910 JvmtiEnv::GetFiberFrameCount(jobject fiber, jint* count_ptr) {
 911   JavaThread* current_thread = JavaThread::current();
 912   HandleMark hm(current_thread);
 913   oop fiber_obj = JNIHandles::resolve_external_guard(fiber);
 914 
 915   if (!java_lang_Fiber::is_instance(fiber_obj)) {
 916     return JVMTI_ERROR_INVALID_FIBER;
 917   }
 918 
 919   VM_GetFiberFrameCount op(this, Handle(current_thread, fiber_obj), count_ptr);
 920   VMThread::execute(&op);
 921 
 922   return op.result();
 923 } /* end GetFiberFrameCount */
 924 
 925 // depth - pre-checked as non-negative
 926 // method_ptr - pre-checked for NULL
 927 // location_ptr - pre-checked for NULL
 928 jvmtiError
 929 JvmtiEnv::GetFiberFrameLocation(jobject fiber, jint depth, jmethodID* method_ptr, jlocation* location_ptr) {
 930   JavaThread* current_thread  = JavaThread::current();
 931   HandleMark hm(current_thread);
 932   oop fiber_obj = JNIHandles::resolve_external_guard(fiber);
 933 
 934   if (!java_lang_Fiber::is_instance(fiber_obj)) {
 935     return JVMTI_ERROR_INVALID_FIBER;
 936   }
 937 
 938   VM_GetFiberFrameLocation op(this, Handle(current_thread, fiber_obj), depth, method_ptr, location_ptr);
 939   VMThread::execute(&op);
 940 
 941   return op.result();
 942 } /* end GetFiberFrameLocation */
 943 
 944 
 945   //
 946   // Thread functions
 947   //
 948 
 949 // Threads_lock NOT held
 950 // thread - NOT pre-checked
 951 // thread_state_ptr - pre-checked for NULL
 952 jvmtiError
 953 JvmtiEnv::GetThreadState(jthread thread, jint* thread_state_ptr) {
 954   JavaThread* current_thread = JavaThread::current();
 955   JavaThread* java_thread = NULL;
 956   oop thread_oop = NULL;
 957   ThreadsListHandle tlh(current_thread);
 958 
 959   if (thread == NULL) {
 960     java_thread = current_thread;
 961     thread_oop = java_thread->threadObj();
 962 
 963     if (thread_oop == NULL || !thread_oop->is_a(SystemDictionary::Thread_klass())) {
 964       return JVMTI_ERROR_INVALID_THREAD;
 965     }


< prev index next >