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

Remove mode parameter from jdk.internal.perf.Perf.attach()

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 19
    • None
    • core-svc
    • None
    • b22

      The mode parameter for jdk.internal.perf.Perf.attach() has never supported the value "rw" since the source code was imported to the openjdk repo more than 15 years ago. In fact HotSpot throws IllegalArgumentException when such a mode is specified.

      It's unlikely such a mode will be required for future enhancements. Support for "rw" should be removed. The "mode" parameter should also be removed, since now "r" would be the only supported mode.
       
      ================

      https://github.com/openjdk/jdk/blame/master/src/java.base/share/classes/jdk/internal/perf/Perf.java#L179-L207

           * The attach mode specifies the access permissions requested for the
           * instrumentation buffer of the target virtual machine. The permitted
           * access permissions are:
           * <ul>
           * <li>"r" - Read only access. This Java virtual machine has only
           * read access to the instrumentation buffer for the target Java
           * virtual machine.
           * <li>"rw" - Read/Write access. This Java virtual machine has read and
           * write access to the instrumentation buffer for the target Java virtual
           * machine. This mode is currently not supported and is reserved for
           * future enhancements.
           * </ul>
           ....
           */
          public ByteBuffer attach(int lvmid, String mode)
                 throws IllegalArgumentException, IOException
          {
              if (mode.compareTo("r") == 0) {
                  return attachImpl(null, lvmid, PERF_MODE_RO);
              }
              else if (mode.compareTo("rw") == 0) {
                  return attachImpl(null, lvmid, PERF_MODE_RW);
              }

            iklam Ioi Lam
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: