< prev index next >

src/hotspot/share/prims/jvmtiManageCapabilities.cpp

Print this page
@@ -21,10 +21,11 @@
   * questions.
   *
   */
  
  #include "precompiled.hpp"
+ #include "classfile/javaClasses.hpp"
  #include "jvmtifiles/jvmtiEnv.hpp"
  #include "logging/log.hpp"
  #include "prims/jvmtiExport.hpp"
  #include "prims/jvmtiManageCapabilities.hpp"
  

@@ -127,10 +128,11 @@
    jc.can_get_owned_monitor_info = 1;
    jc.can_get_owned_monitor_stack_depth_info = 1;
    jc.can_get_current_contended_monitor = 1;
    jc.can_generate_early_vmstart = 1;
    jc.can_generate_early_class_hook_events = 1;
+   jc.can_support_virtual_threads = 1;
    return jc;
  }
  
  
  jvmtiCapabilities JvmtiManageCapabilities::init_always_solo_capabilities() {

@@ -267,10 +269,14 @@
    exclude(&onload_solo_remaining_capabilities, desired, &onload_solo_remaining_capabilities);
  
    // return the result
    either(current, desired, result);
  
+   // special case for virtual thread events
+   // TBD: There can be a performance impact after check for can_support_virtual_threads has been removed.
+   java_lang_VirtualThread::set_notify_jvmti_events(true);
+ 
    update();
  
    return JVMTI_ERROR_NONE;
  }
  

@@ -362,12 +368,14 @@
    JvmtiExport::set_can_post_field_access(avail.can_generate_field_access_events);
    JvmtiExport::set_can_post_field_modification(avail.can_generate_field_modification_events);
    JvmtiExport::set_can_post_method_entry(avail.can_generate_method_entry_events);
    JvmtiExport::set_can_post_method_exit(avail.can_generate_method_exit_events ||
                                          avail.can_generate_frame_pop_events);
+   JvmtiExport::set_can_post_frame_pop(avail.can_generate_frame_pop_events);
    JvmtiExport::set_can_pop_frame(avail.can_pop_frame);
    JvmtiExport::set_can_force_early_return(avail.can_force_early_return);
+   JvmtiExport::set_can_support_virtual_threads(avail.can_support_virtual_threads);
    JvmtiExport::set_should_clean_up_heap_objects(avail.can_generate_breakpoint_events);
    JvmtiExport::set_can_get_owned_monitor_info(avail.can_get_owned_monitor_info ||
                                                avail.can_get_owned_monitor_stack_depth_info);
  }
  

@@ -457,8 +465,10 @@
      log_trace(jvmti)("can_generate_resource_exhaustion_threads_events");
    if (cap->can_generate_early_vmstart)
      log_trace(jvmti)("can_generate_early_vmstart");
    if (cap->can_generate_early_class_hook_events)
      log_trace(jvmti)("can_generate_early_class_hook_events");
+   if (cap->can_support_virtual_threads)
+     log_trace(jvmti)("can_support_virtual_threads");
  }
  
  #endif
< prev index next >