< prev index next >

src/hotspot/share/prims/jvmtiEnvBase.hpp

Print this page

343   bool is_enabled(jvmtiEvent event_type) {
344     return _env_event_enable.is_enabled(event_type);
345   }
346 
347 // Random Utilities
348 
349  protected:
350   // helper methods for creating arrays of global JNI Handles from local Handles
351   // allocated into environment specific storage
352   jthread * new_jthreadArray(int length, Handle *handles);
353   jthreadGroup * new_jthreadGroupArray(int length, objArrayHandle groups);
354 
355   // convert to a jni jclass from a non-null Klass*
356   jclass get_jni_class_non_null(Klass* k);
357 
358   jint count_locked_objects(JavaThread *java_thread, Handle hobj);
359   jvmtiError get_locked_objects_in_frame(JavaThread *calling_thread,
360                                    JavaThread* java_thread,
361                                    javaVFrame *jvf,
362                                    GrowableArray<jvmtiMonitorStackDepthInfo*>* owned_monitors_list,
363                                    jint depth);
364  public:
365   static javaVFrame* jvf_for_thread_and_depth(JavaThread* java_thread, jint depth);
366 
367   // get a field descriptor for the specified class and field
368   static bool get_field_descriptor(Klass* k, jfieldID field, fieldDescriptor* fd);
369 
370   // check and skip frames hidden in mount/unmount transitions
371   static javaVFrame* check_and_skip_hidden_frames(bool is_in_VTMS_transition, javaVFrame* jvf);
372   static javaVFrame* check_and_skip_hidden_frames(JavaThread* jt, javaVFrame* jvf);
373   static javaVFrame* check_and_skip_hidden_frames(oop vthread, javaVFrame* jvf);
374 
375   // check if virtual thread is not terminated (alive)
376   static bool is_vthread_alive(oop vt);
377 
378   // return JavaThread if virtual thread is mounted, null otherwise
379   static JavaThread* get_JavaThread_or_null(oop vthread);
380 
381   // get virtual thread last java vframe
382   static javaVFrame* get_vthread_jvf(oop vthread);
383 

404   jvmtiError get_frame_count(oop frame_oop, jint *count_ptr);
405   jvmtiError get_frame_location(javaVFrame* jvf, jint depth,
406                                 jmethodID* method_ptr, jlocation* location_ptr);
407   jvmtiError get_frame_location(JavaThread* java_thread, jint depth,
408                                 jmethodID* method_ptr, jlocation* location_ptr);
409   jvmtiError get_frame_location(oop vthread_oop, jint depth,
410                                 jmethodID* method_ptr, jlocation* location_ptr);
411   jvmtiError set_frame_pop(JvmtiThreadState* state, javaVFrame* jvf, jint depth);
412   jvmtiError get_object_monitor_usage(JavaThread* calling_thread,
413                                       jobject object, jvmtiMonitorUsage* info_ptr);
414   jvmtiError get_stack_trace(javaVFrame* jvf,
415                              jint stack_depth, jint max_count,
416                              jvmtiFrameInfo* frame_buffer, jint* count_ptr);
417   jvmtiError get_stack_trace(JavaThread* java_thread,
418                              jint stack_depth, jint max_count,
419                              jvmtiFrameInfo* frame_buffer, jint* count_ptr);
420   jvmtiError get_current_contended_monitor(JavaThread* calling_thread, JavaThread* java_thread,
421                                            jobject* monitor_ptr, bool is_virtual);
422   jvmtiError get_owned_monitors(JavaThread* calling_thread, JavaThread* java_thread,
423                                 GrowableArray<jvmtiMonitorStackDepthInfo*> *owned_monitors_list);
424   jvmtiError get_owned_monitors(JavaThread* calling_thread, JavaThread* java_thread, javaVFrame* jvf,
425                                 GrowableArray<jvmtiMonitorStackDepthInfo*> *owned_monitors_list);
426   static jvmtiError check_top_frame(Thread* current_thread, JavaThread* java_thread,
427                                     jvalue value, TosState tos, Handle* ret_ob_h);
428   jvmtiError force_early_return(jthread thread, jvalue value, TosState tos);
429 };
430 
431 // This class is the only safe means of iterating through environments.
432 // Note that this iteratation includes invalid environments pending
433 // deallocation -- in fact, some uses depend on this behavior.
434 
435 class JvmtiEnvIterator : public StackObj {
436  private:
437   bool _entry_was_marked;
438  public:
439   JvmtiEnvIterator() {
440     if (Threads::number_of_threads() == 0) {
441       _entry_was_marked = false; // we are single-threaded, no need
442     } else {
443       Thread::current()->entering_jvmti_env_iteration();
444       _entry_was_marked = true;
445     }

343   bool is_enabled(jvmtiEvent event_type) {
344     return _env_event_enable.is_enabled(event_type);
345   }
346 
347 // Random Utilities
348 
349  protected:
350   // helper methods for creating arrays of global JNI Handles from local Handles
351   // allocated into environment specific storage
352   jthread * new_jthreadArray(int length, Handle *handles);
353   jthreadGroup * new_jthreadGroupArray(int length, objArrayHandle groups);
354 
355   // convert to a jni jclass from a non-null Klass*
356   jclass get_jni_class_non_null(Klass* k);
357 
358   jint count_locked_objects(JavaThread *java_thread, Handle hobj);
359   jvmtiError get_locked_objects_in_frame(JavaThread *calling_thread,
360                                    JavaThread* java_thread,
361                                    javaVFrame *jvf,
362                                    GrowableArray<jvmtiMonitorStackDepthInfo*>* owned_monitors_list,
363                                    jint depth, oop vthread = nullptr);
364  public:
365   static javaVFrame* jvf_for_thread_and_depth(JavaThread* java_thread, jint depth);
366 
367   // get a field descriptor for the specified class and field
368   static bool get_field_descriptor(Klass* k, jfieldID field, fieldDescriptor* fd);
369 
370   // check and skip frames hidden in mount/unmount transitions
371   static javaVFrame* check_and_skip_hidden_frames(bool is_in_VTMS_transition, javaVFrame* jvf);
372   static javaVFrame* check_and_skip_hidden_frames(JavaThread* jt, javaVFrame* jvf);
373   static javaVFrame* check_and_skip_hidden_frames(oop vthread, javaVFrame* jvf);
374 
375   // check if virtual thread is not terminated (alive)
376   static bool is_vthread_alive(oop vt);
377 
378   // return JavaThread if virtual thread is mounted, null otherwise
379   static JavaThread* get_JavaThread_or_null(oop vthread);
380 
381   // get virtual thread last java vframe
382   static javaVFrame* get_vthread_jvf(oop vthread);
383 

404   jvmtiError get_frame_count(oop frame_oop, jint *count_ptr);
405   jvmtiError get_frame_location(javaVFrame* jvf, jint depth,
406                                 jmethodID* method_ptr, jlocation* location_ptr);
407   jvmtiError get_frame_location(JavaThread* java_thread, jint depth,
408                                 jmethodID* method_ptr, jlocation* location_ptr);
409   jvmtiError get_frame_location(oop vthread_oop, jint depth,
410                                 jmethodID* method_ptr, jlocation* location_ptr);
411   jvmtiError set_frame_pop(JvmtiThreadState* state, javaVFrame* jvf, jint depth);
412   jvmtiError get_object_monitor_usage(JavaThread* calling_thread,
413                                       jobject object, jvmtiMonitorUsage* info_ptr);
414   jvmtiError get_stack_trace(javaVFrame* jvf,
415                              jint stack_depth, jint max_count,
416                              jvmtiFrameInfo* frame_buffer, jint* count_ptr);
417   jvmtiError get_stack_trace(JavaThread* java_thread,
418                              jint stack_depth, jint max_count,
419                              jvmtiFrameInfo* frame_buffer, jint* count_ptr);
420   jvmtiError get_current_contended_monitor(JavaThread* calling_thread, JavaThread* java_thread,
421                                            jobject* monitor_ptr, bool is_virtual);
422   jvmtiError get_owned_monitors(JavaThread* calling_thread, JavaThread* java_thread,
423                                 GrowableArray<jvmtiMonitorStackDepthInfo*> *owned_monitors_list);
424   jvmtiError get_owned_monitors(JavaThread* calling_thread, JavaThread* carrier, javaVFrame* jvf,
425                                 GrowableArray<jvmtiMonitorStackDepthInfo*> *owned_monitors_list, oop vthread);
426   static jvmtiError check_top_frame(Thread* current_thread, JavaThread* java_thread,
427                                     jvalue value, TosState tos, Handle* ret_ob_h);
428   jvmtiError force_early_return(jthread thread, jvalue value, TosState tos);
429 };
430 
431 // This class is the only safe means of iterating through environments.
432 // Note that this iteratation includes invalid environments pending
433 // deallocation -- in fact, some uses depend on this behavior.
434 
435 class JvmtiEnvIterator : public StackObj {
436  private:
437   bool _entry_was_marked;
438  public:
439   JvmtiEnvIterator() {
440     if (Threads::number_of_threads() == 0) {
441       _entry_was_marked = false; // we are single-threaded, no need
442     } else {
443       Thread::current()->entering_jvmti_env_iteration();
444       _entry_was_marked = true;
445     }
< prev index next >