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

Should disable Escape Analysis when JVMTI capability can_tag_objects is taken

    Details

    • Subcomponent:
    • Understanding:
      Fix Understood

      Description

      JVMTI provides functions to follow references beginning at the roots of the object graph and it
      provides functions to iterate all objects on the heap[1][2]. These functions are means to access
      objects which are otherwise local to a Java thread. In terms of escape analysis these local objects
      escape through these JVMTI functions invalidating optimizations based on escape analysis. Agents are
      required to possess the capability can_tag_objects in order to call the mentioned functions.

      Example:

      - Let J be a JavaThread that calls a compiled method M with a NoEscape instance I of class C that is
        scalar replaced.

      - JVMTI agent A uses JVMTI FollowReferences() to iterate the objects in the object graph tagging all
        instances of C.

      - A uses GetObjectsWithTags() to retrieve the tagged instances of C.

      - Error: I is missing because its allocation was eliminated / scalar replaced.

      Currently it is not possible to revert EA based optimizations just before objects escape through
      JVMTI therefore escape analysis should be disabled as soon as the JVMTI capability can_tag_objects
      is taken.

      But this is not sufficient, because there may be compiled frames on stack with EA based
      optimizations when a JVMTI agent takes can_tag_objects, and then it does not help to disable escape
      analysis or invalidate compiled methods with ea based optimizations. In general it is still an
      improvement to do so. JDK-8227745 would be a complete solution to the issue.

      [1] https://docs.oracle.com/en/java/javase/11/docs/specs/jvmti.html#Heap
      [2] https://docs.oracle.com/en/java/javase/11/docs/specs/jvmti.html#Heap_1_0

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rrich Richard Reingruber
                Reporter:
                rrich Richard Reingruber
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: