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

conversion of jmethodID to methodOop in JVMTI is too expensive

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: hs16, 6
    • Fix Version/s: hs17
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Introduced In Build:
      b83
    • Introduced In Version:
      6
    • Resolved In Build:
      b01
    • CPU:
      generic, sparc
    • OS:
      generic, solaris_9
    • Verification:
      Verified

      Backports

        Description

        While hacking on hprof I became intrigued by why it's so ridiculously slow when dumping traces. Digging around a bit showed that the problem was that converting a jmethodID to a methodOop always uses JNIHandles::checked_resolve_jmethod_id which attempts to confirm that the JNI reference being used is weak. Unfortunately this requires searching the entire set of weak JNI handles to see if it's in the table and since hprof is using a huge number of weak references this becomes very slow. It's also not a very interesting thing to test for since it never actually checks that the underlying object is really a methodOop which seems a lot more important. Making the following change:

        diff --git a/src/share/vm/prims/jvmtiEnter.xsl b/src/share/vm/prims/jvmtiEnter.xsl
        --- a/src/share/vm/prims/jvmtiEnter.xsl
        +++ b/src/share/vm/prims/jvmtiEnter.xsl
        @@ -896,7 +896,7 @@ static jvmtiError JNICALL

         <xsl:template match="jmethodID" mode="dochecks">
           <xsl:param name="name"/>
        - <xsl:text> methodOop method_oop = JNIHandles::checked_resolve_jmethod_id(</xsl:text>
        + <xsl:text> methodOop method_oop = JNIHandles::resolve_jmethod_id(</xsl:text>
           <xsl:value-of select="$name"/>
           <xsl:text>);&#xA;</xsl:text>
           <xsl:text> if (method_oop == NULL) {&#xA;</xsl:text>

        causes hprof to run noticeably faster.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                dcubed Daniel Daugherty
                Reporter:
                never Tom Rodriguez
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: