-
Bug
-
Resolution: Fixed
-
P4
-
hs16, 6
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2183195 | 7 | Daniel Daugherty | P4 | Closed | Fixed | b72 |
JDK-2189967 | 6u21 | Daniel Daugherty | P4 | Resolved | Fixed | b01 |
JDK-2182815 | 6u18 | Daniel Daugherty | P4 | Resolved | Fixed | b02 |
JDK-2182434 | hs16 | Daniel Daugherty | P4 | Closed | Fixed | b09 |
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>);
</xsl:text>
<xsl:text> if (method_oop == NULL) {
</xsl:text>
causes hprof to run noticeably faster.
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>);
</xsl:text>
<xsl:text> if (method_oop == NULL) {
</xsl:text>
causes hprof to run noticeably faster.
- backported by
-
JDK-2182815 conversion of jmethodID to methodOop in JVMTI is too expensive
- Resolved
-
JDK-2189967 conversion of jmethodID to methodOop in JVMTI is too expensive
- Resolved
-
JDK-2182434 conversion of jmethodID to methodOop in JVMTI is too expensive
- Closed
-
JDK-2183195 conversion of jmethodID to methodOop in JVMTI is too expensive
- Closed
- relates to
-
JDK-6949515 VM crash when calling GetMethodDeclaringClass
- Closed
-
JDK-6404550 Cannot implement late attach in NetBeans Profiler due to missing functionality in JVMTI
- Resolved
(1 relates to)