< prev index next >

src/jdk.jdwp.agent/share/native/libjdwp/util.c

Print this page
@@ -1546,10 +1546,17 @@
  {
      JNIEnv *env = getEnv();
      return JNI_FUNC_PTR(env,IsInstanceOf)(env, object, gdata->classClass);
  }
  
+ jboolean
+ isVThread(jobject object)
+ {
+     JNIEnv *env = getEnv();
+     return JNI_FUNC_PTR(env,IsVirtualThread)(env, object);
+ }
+ 
  jboolean
  isThread(jobject object)
  {
      JNIEnv *env = getEnv();
      return JNI_FUNC_PTR(env,IsInstanceOf)(env, object, gdata->threadClass);

@@ -1939,10 +1946,12 @@
      index2jvmti[EI_MONITOR_CONTENDED_ENTERED    -EI_min] = JVMTI_EVENT_MONITOR_CONTENDED_ENTERED;
      index2jvmti[EI_MONITOR_WAIT       -EI_min] = JVMTI_EVENT_MONITOR_WAIT;
      index2jvmti[EI_MONITOR_WAITED     -EI_min] = JVMTI_EVENT_MONITOR_WAITED;
      index2jvmti[EI_VM_INIT            -EI_min] = JVMTI_EVENT_VM_INIT;
      index2jvmti[EI_VM_DEATH           -EI_min] = JVMTI_EVENT_VM_DEATH;
+     index2jvmti[EI_VIRTUAL_THREAD_START -EI_min] = JVMTI_EVENT_VIRTUAL_THREAD_START;
+     index2jvmti[EI_VIRTUAL_THREAD_END   -EI_min] = JVMTI_EVENT_VIRTUAL_THREAD_END;
  
      index2jdwp[EI_SINGLE_STEP         -EI_min] = JDWP_EVENT(SINGLE_STEP);
      index2jdwp[EI_BREAKPOINT          -EI_min] = JDWP_EVENT(BREAKPOINT);
      index2jdwp[EI_FRAME_POP           -EI_min] = JDWP_EVENT(FRAME_POP);
      index2jdwp[EI_EXCEPTION           -EI_min] = JDWP_EVENT(EXCEPTION);

@@ -1960,10 +1969,13 @@
      index2jdwp[EI_MONITOR_CONTENDED_ENTERED           -EI_min] = JDWP_EVENT(MONITOR_CONTENDED_ENTERED);
      index2jdwp[EI_MONITOR_WAIT        -EI_min] = JDWP_EVENT(MONITOR_WAIT);
      index2jdwp[EI_MONITOR_WAITED      -EI_min] = JDWP_EVENT(MONITOR_WAITED);
      index2jdwp[EI_VM_INIT             -EI_min] = JDWP_EVENT(VM_INIT);
      index2jdwp[EI_VM_DEATH            -EI_min] = JDWP_EVENT(VM_DEATH);
+     /* Just map VIRTUAL_THREAD_START/END to THREAD_START/END. */
+     index2jdwp[EI_VIRTUAL_THREAD_START -EI_min] = JDWP_EVENT(THREAD_START);
+     index2jdwp[EI_VIRTUAL_THREAD_END   -EI_min] = JDWP_EVENT(THREAD_END);
  }
  
  jdwpEvent
  eventIndex2jdwp(EventIndex i)
  {

@@ -2026,10 +2038,14 @@
              return "EI_MONITOR_WAITED";
          case EI_VM_INIT:
              return "EI_VM_INIT";
          case EI_VM_DEATH:
              return "EI_VM_DEATH";
+         case EI_VIRTUAL_THREAD_START:
+             return "EI_VIRTUAL_THREAD_START";
+         case EI_VIRTUAL_THREAD_END:
+             return "EI_VIRTUAL_THREAD_END";
          default:
              JDI_ASSERT(JNI_FALSE);
              return "Bad EI";
      }
  }

@@ -2139,10 +2155,16 @@
              return EI_MONITOR_WAITED;
          case JVMTI_EVENT_VM_INIT:
              return EI_VM_INIT;
          case JVMTI_EVENT_VM_DEATH:
              return EI_VM_DEATH;
+         /* vthread events */
+         case JVMTI_EVENT_VIRTUAL_THREAD_START:
+             return EI_VIRTUAL_THREAD_START;
+         case JVMTI_EVENT_VIRTUAL_THREAD_END:
+             return EI_VIRTUAL_THREAD_END;
+ 
          default:
              EXIT_ERROR(AGENT_ERROR_INVALID_INDEX,"JVMTI to EventIndex mapping");
              break;
      }
      return (EventIndex)0;
< prev index next >