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

Clarify JVMTI heap functions spec about virtual thread stack.

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 21
    • hotspot
    • None
    • behavioral
    • low
    • JVM TI based heap profilers may need updates to support virtual threads, irrespective of the changes in this CSR.
    • Other
    • SE

      Summary

      Update the specification of the FollowReferences and IterateOverReachableObjects functions to make it clear that virtual threads are not heap roots.

      Problem

      Currently the FollowReferences and IterateOverReachableObjects functions specify that heap roots include references from thread stacks. Virtual Threads are just objects in the heap, they should not be reported to JVMTI agents as heap roots.

      Solution

      Update the descriptions of FollowReferences and IterateOverReachableObjects to say that heap roots include references from platform threads stacks (rather than just thread stacks).

      Drop "heap root reference" from the descriptions of JVMTI_HEAP_REFERENCE_STACK_LOCAL and JVMTI_HEAP_REFERENCE_JNI_LOCAL.

      Specification

      diff --git a/src/hotspot/share/prims/jvmti.xml b/src/hotspot/share/prims/jvmti.xml
      index 456876fbcb9..3788d3c5ce7 100644
      --- a/src/hotspot/share/prims/jvmti.xml
      +++ b/src/hotspot/share/prims/jvmti.xml
      @@ -3517,10 +3517,10 @@ err = (*jvmti)->Deallocate(jvmti, stack_info);
               Heap root reference: monitor.
             </constant>
             <constant id="JVMTI_HEAP_REFERENCE_STACK_LOCAL" num="24">
      -            Heap root reference: local variable on the stack.
      +            Local variable on a thread stack.
             </constant>
             <constant id="JVMTI_HEAP_REFERENCE_JNI_LOCAL" num="25">
      -            Heap root reference: JNI local reference.
      +            JNI local reference.
             </constant>
             <constant id="JVMTI_HEAP_REFERENCE_THREAD" num="26">
               Heap root reference: Thread.
      @@ -4535,7 +4535,7 @@ class C2 extends C1 implements I2 {
           if <code>initial_object</code> is not specified, all objects
           reachable from the heap roots.
           The heap root are the set of system classes,
      -        JNI globals, references from thread stacks, and other objects used as roots
      +        JNI globals, references from platform thread stacks, and other objects used as roots
           for the purposes of garbage collection.
           <p/>
           This function operates by traversing the reference graph.
      @@ -5579,7 +5579,7 @@ class C2 extends C1 implements I2 {
           This function iterates over the root objects and all objects that
           are directly and indirectly reachable from the root objects.
           The root objects comprise the set of system classes,
      -        JNI globals, references from thread stacks, and other objects used as roots
      +        JNI globals, references from platform thread stacks, and other objects used as roots
           for the purposes of garbage collection.
           <p/>
           For each root the <paramlink id="heap_root_callback"></paramlink>

            amenkov Alex Menkov
            amenkov Alex Menkov
            Alan Bateman, Serguei Spitsyn
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: