Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8308001

add PopFrame support for virtual threads

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 21
    • hotspot
    • None
    • behavioral
    • minimal
    • The compatibility risk is minimal. The spec update only defines the PopFrame minimal support for virtual threads which was undefined before.
    • Other
    • SE

      Summary

      Specify minimal JVMTI PopFrame support for virtual threads.

      Problem

      The JVMTI PopFrame is allowed to be supported by implementations in a general form but no minimal support is defined by the spec.

      Solution

      Specify that the PopFrame can be used to pop current frame of a virtual thread suspended at an event.

      Specification

      The PopFrame thread parameter is described with only one statement:

      The thread whose current frame is to be popped.

      Extend it with:

      The `PopFrame` function may be used to pop the current frame of a virtual
      thread when it is suspended at an event. An implementation may support
      popping the current frame of a suspended virtual thread in other cases.

      The description of the JVMTI_ERROR_OPAQUE_FRAME error code is:

      The thread is a virtual thread and the implementation is unable
      to pop this frame.

      Replace it with:

      The thread is a suspended virtual thread and the implementation
      was unable to pop the current frame.

      The spec change is:

      diff --git a/src/hotspot/share/prims/jvmti.xml b/src/hotspot/share/prims/jvmti.xml
      index ae466071de2..d55db4f82ae 100644
      --- a/src/hotspot/share/prims/jvmti.xml
      +++ b/src/hotspot/share/prims/jvmti.xml
      @@ -2958,6 +2958,10 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
                 <jthread impl="noconvert"/>
                   <description>
                     The thread whose current frame is to be popped.
      +              The <functionlink id="PopFrame"></functionlink> function may be used to
      +              pop the current frame of a virtual thread when it is suspended at an event.
      +              An implementation may support popping the current frame of a suspended
      +              virtual thread in other cases.
                   </description>
               </param>
             </parameters>
      @@ -2967,8 +2971,8 @@ err = (*jvmti)-&gt;Deallocate(jvmti, stack_info);
                 The implementation is unable to pop this frame.
               </error>
               <error id="JVMTI_ERROR_OPAQUE_FRAME">
      -          The thread is a virtual thread and the implementation is unable
      -          to pop this frame.
      +          The thread is a suspended virtual thread and the implementation
      +          was unable to pop the current frame.
               </error>
               <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
                 Thread was not suspended and was not the current thread.

            sspitsyn Serguei Spitsyn
            sspitsyn Serguei Spitsyn
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: