< prev index next >

src/hotspot/share/prims/jvmtiEnv.cpp

Print this page

        

*** 831,840 **** --- 831,950 ---- *format_ptr = JVMTI_JLOCATION_JVMBCI; return JVMTI_ERROR_NONE; } /* end GetJLocationFormat */ // + // Functions supporting Fibers + // + + // object - pre-checked for NULL + // is_fiber_ptr - pre-checked for NULL + jvmtiError + JvmtiEnv::IsFiber(jobject object, jboolean* is_fiber_ptr) { + oop obj = JNIHandles::resolve_external_guard(object); + + *is_fiber_ptr = java_lang_Fiber::is_instance(obj); + return JVMTI_ERROR_NONE; + } /* end IsFiber */ + + + // java_thread - pre-checked + // fiber_ptr - pre-checked for NULL + jvmtiError + JvmtiEnv::GetThreadFiber(JavaThread* java_thread, jobject* fiber_ptr) { + JavaThread* current_thread = JavaThread::current(); + ResourceMark rm(current_thread); + oop fiber_oop = NULL; + uint32_t debug_bits = 0; + + JvmtiThreadState *state = JvmtiThreadState::state_for(java_thread); + if (state == NULL) { + return JVMTI_ERROR_THREAD_NOT_ALIVE; + } + if (!java_thread->is_thread_fully_suspended(true, &debug_bits)) { + return JVMTI_ERROR_THREAD_NOT_SUSPENDED; + } + fiber_oop = java_lang_Thread::fiber(java_thread->threadObj()); + *fiber_ptr = JNIHandles::make_local(current_thread, fiber_oop); + return JVMTI_ERROR_NONE; + } /* end GetThreadFiber */ + + // thread_ptr - pre-checked for NULL + jvmtiError + JvmtiEnv::GetFiberThread(jobject fiber, jthread* thread_ptr) { + JavaThread* current_thread = JavaThread::current(); + HandleMark hm(current_thread); + oop fiber_obj = JNIHandles::resolve_external_guard(fiber); + + if (!java_lang_Fiber::is_instance(fiber_obj)) { + return JVMTI_ERROR_INVALID_FIBER; + } + + VM_GetFiberThread op(current_thread, Handle(current_thread, fiber_obj), thread_ptr); + VMThread::execute(&op); + + return op.result(); + } /* end GetFiberThread */ + + // max_frame_count - pre-checked to be greater than or equal to 0 + // frame_buffer - pre-checked for NULL + // count_ptr - pre-checked for NULL + jvmtiError + JvmtiEnv::GetFiberStackTrace(jobject fiber, jint start_depth, jint max_frame_count, jvmtiFrameInfo* frame_buffer, jint* count_ptr) { + JavaThread* current_thread = JavaThread::current(); + HandleMark hm(current_thread); + oop fiber_obj = JNIHandles::resolve_external_guard(fiber); + + if (!java_lang_Fiber::is_instance(fiber_obj)) { + return JVMTI_ERROR_INVALID_FIBER; + } + + VM_GetFiberStackTrace op(this, Handle(current_thread, fiber_obj), + start_depth, max_frame_count, frame_buffer, count_ptr); + VMThread::execute(&op); + + return op.result(); + } /* end GetFiberStackTrace */ + + // count_ptr - pre-checked for NULL + jvmtiError + JvmtiEnv::GetFiberFrameCount(jobject fiber, jint* count_ptr) { + JavaThread* current_thread = JavaThread::current(); + HandleMark hm(current_thread); + oop fiber_obj = JNIHandles::resolve_external_guard(fiber); + + if (!java_lang_Fiber::is_instance(fiber_obj)) { + return JVMTI_ERROR_INVALID_FIBER; + } + + VM_GetFiberFrameCount op(this, Handle(current_thread, fiber_obj), count_ptr); + VMThread::execute(&op); + + return op.result(); + } /* end GetFiberFrameCount */ + + // depth - pre-checked as non-negative + // method_ptr - pre-checked for NULL + // location_ptr - pre-checked for NULL + jvmtiError + JvmtiEnv::GetFiberFrameLocation(jobject fiber, jint depth, jmethodID* method_ptr, jlocation* location_ptr) { + JavaThread* current_thread = JavaThread::current(); + HandleMark hm(current_thread); + oop fiber_obj = JNIHandles::resolve_external_guard(fiber); + + if (!java_lang_Fiber::is_instance(fiber_obj)) { + return JVMTI_ERROR_INVALID_FIBER; + } + + VM_GetFiberFrameLocation op(this, Handle(current_thread, fiber_obj), depth, method_ptr, location_ptr); + VMThread::execute(&op); + + return op.result(); + } /* end GetFiberFrameLocation */ + + + // // Thread functions // // Threads_lock NOT held // thread - NOT pre-checked
< prev index next >