United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6957004 MethodComparator uses the wrong CP index accessor
JDK-6957004 : MethodComparator uses the wrong CP index accessor

Details
Type:
Bug
Submit Date:
2010-05-28
Status:
Closed
Updated Date:
2011-03-08
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
hotspot
OS:
generic
Sub-Component:
compiler
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:
hs19 (b03)

Related Reports
Backport:
Backport:
Backport:
Backport:
Relates:

Sub Tasks

Description
The changes to constant pool accessors in 6939207 picked the wrong CP accessor for MethodComparator.  The original change wrongly assumed the classes being compared had not yet been rewritten.

This causes an assertion "clean u2" to throw when using JVMTI class redefinition methods, in the debug build.  It will also cause unpredictable failures on little-endian systems.

                                    

Comments
SUGGESTED FIX

diff --git a/src/share/vm/prims/methodComparator.cpp b/src/share/vm/prims/methodComparator.cpp
--- a/src/share/vm/prims/methodComparator.cpp
+++ b/src/share/vm/prims/methodComparator.cpp
@@ -149,8 +149,8 @@
   case Bytecodes::_invokestatic    : // fall through
   case Bytecodes::_invokedynamic   : // fall through
   case Bytecodes::_invokeinterface : {
-    u2 cpci_old = _s_old->has_index_u4() ? _s_old->get_index_u4() : _s_old->get_index_u2();
-    u2 cpci_new = _s_new->has_index_u4() ? _s_new->get_index_u4() : _s_new->get_index_u2();
+    int cpci_old = _s_old->has_index_u4() ? _s_old->get_index_u4() : _s_old->get_index_u2_cpcache();
+    int cpci_new = _s_new->has_index_u4() ? _s_new->get_index_u4() : _s_new->get_index_u2_cpcache();
     // Check if the names of classes, field/method names and signatures at these indexes
     // are the same. Indices which are really into constantpool cache (rather than constant
     // pool itself) are accepted by the constantpool query routines below.
                                     
2010-05-28
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/beb77f0d41b3
                                     
2010-05-29



Hardware and Software, Engineered to Work Together