United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6981788 GC map generator sometimes picks up the wrong kind of instruction operand
JDK-6981788 : GC map generator sometimes picks up the wrong kind of instruction operand

Details
Type:
Bug
Submit Date:
2010-09-02
Status:
Closed
Updated Date:
2011-04-23
Project Name:
JDK
Resolved Date:
2011-04-23
Component:
hotspot
OS:
generic
Sub-Component:
runtime
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:
hs20 (b03)

Related Reports
Backport:
Backport:
Relates:

Sub Tasks

Description
A colleague wrote:  I noticed another problem with the new cp/cpcache indexing separation if you run with -XX:+TraceNewOopMapGeneration.  It sort of looks like a bootstrap issue.

 [1] report_vm_error(file = 0xfe8c374a "/export/ws/symbols/src/share/vm/oops/constantPoolOop.cpp", line = 305, error_msg = 0xfe8c3783 "assert((int)(u2)cpc_index == cpc_index) failed", detail_msg = 0xfe8c37b2 "clean u2"), line 174 in "debug.cpp"
 [2] constantPoolOopDesc::remap_instruction_operand_from_cache(this = 0xb669ae48, operand = 12), line 305 in "constantPoolOop.cpp"
=>[3] constantPoolOopDesc::impl_name_and_type_ref_index_at(this = 0xb669ae48, which = 12, uncached = false), line 275 in "constantPoolOop.cpp"
 [4] constantPoolOopDesc::name_and_type_ref_index_at(this = 0xb669ae48, which = 12), line 464 in "constantPoolOop.hpp"
 [5] GenerateOopMap::print_current_state(this = 0xb5e4c7e8, os = 0x8063168, currentBC = 0xb5e4c698, detailed = false), line 1291 in "generateOopMap.cpp"
 [6] GenerateOopMap::interp1(this = 0xb5e4c7e8, itr = 0xb5e4c698), line 1304 in "generateOopMap.cpp"
 [7] GenerateOopMap::interp_bb(this = 0xb5e4c7e8, bb = 0x80bbe48), line 1097 in "generateOopMap.cpp"
 [8] GenerateOopMap::interp_all(this = 0xb5e4c7e8), line 1066 in "generateOopMap.cpp"
 [9] GenerateOopMap::do_interpretation(this = 0xb5e4c7e8), line 889 in "generateOopMap.cpp"
 [10] GenerateOopMap::compute_map(this = 0xb5e4c7e8, __the_thread__ = 0x81fac00), line 2074 in "generateOopMap.cpp"
 [11] OopMapForCacheEntry::compute_map(this = 0xb5e4c7e8, __the_thread__ = 0x81fac00), line 99 in "oopMapCache.cpp"
 [12] OopMapCacheEntry::fill(this = 0x82966e0, method = CLASS, bci = 44), line 384 in "oopMapCache.cpp"
 [13] OopMapCache::lookup(this = 0x8277828, method = CLASS, bci = 44, entry_for = 0xb5e4ca14), line 597 in "oopMapCache.cpp"
 [14] instanceKlass::mask_for(this = 0xb669b8c0, method = CLASS, bci = 44, entry_for = 0xb5e4ca14), line 721 in "instanceKlass.cpp"
 [15] methodOopDesc::mask_for(this = 0xb669b728, bci = 44, mask = 0xb5e4ca14), line 158 in "methodOop.cpp"
 [16] frame::oops_interpreted_do(this = 0xb5e4cafc, f = 0xfec73904, map = 0xb5e4cb14, query_oop_map_cache = true), line 924 in "frame.cpp"
 [17] frame::oops_do_internal(this = 0xb5e4cafc, f = 0xfec73904, cf = (nil), map = 0xb5e4cb14, use_interpreter_oop_map_cache = true), line 1092 in "frame.cpp"
 [18] frame::oops_do(this = 0xb5e4cafc, f = 0xfec73904, cf = (nil), map = 0xb5e4cb14), line 369 in "frame.hpp"
 [19] JavaThread::oops_do(this = 0x8209c00, f = 0xfec73904, cf = (nil)), line 2401 in "thread.cpp"
 [20] JavaThread::verify(this = 0x8209c00), line 2516 in "thread.cpp"
 [21] Threads::verify(), line 4107 in "thread.cpp"
 [22] Universe::verify(allow_dirty = true, silent = true, option = true), line 1224 in "universe.cpp"
 [23] VMThread::run(this = 0x81fac00), line 272 in "vmThread.cpp"
 [24] java_start(thread_addr = 0x81fac00), line 1010 in "os_solaris.cpp"
 [25] _thr_setup(0xfd9d4a00), at 0xfeec59a9 
 [26] _lwp_start(0xfe140379, 0x589, 0xb5e4c548, 0xfdef833f, 0xb7, 0x0), at 0xfeec5c90

                                    

Comments
SUGGESTED FIX

diff --git a/src/share/vm/oops/generateOopMap.cpp b/src/share/vm/oops/generateOopMap.cpp
--- a/src/share/vm/oops/generateOopMap.cpp
+++ b/src/share/vm/oops/generateOopMap.cpp
@@ -1254,7 +1254,7 @@
       case Bytecodes::_invokestatic:
       case Bytecodes::_invokedynamic:
       case Bytecodes::_invokeinterface:
-        int idx = currentBC->has_index_u4() ? currentBC->get_index_u4() : currentBC->get_index_u2();
+        int idx = currentBC->has_index_u4() ? currentBC->get_index_u4() : currentBC->get_index_u2_cpcache();
         constantPoolOop cp    = method()->constants();
         int nameAndTypeIdx    = cp->name_and_type_ref_index_at(idx);
         int signatureIdx      = cp->signature_ref_index_at(nameAndTypeIdx);
@@ -1286,7 +1286,7 @@
       case Bytecodes::_invokestatic:
       case Bytecodes::_invokedynamic:
       case Bytecodes::_invokeinterface:
-        int idx = currentBC->has_index_u4() ? currentBC->get_index_u4() : currentBC->get_index_u2();
+        int idx = currentBC->has_index_u4() ? currentBC->get_index_u4() : currentBC->get_index_u2_cpcache();
         constantPoolOop cp    = method()->constants();
         int nameAndTypeIdx    = cp->name_and_type_ref_index_at(idx);
         int signatureIdx      = cp->signature_ref_index_at(nameAndTypeIdx);
@@ -1356,8 +1356,11 @@
 
     case Bytecodes::_ldc2_w:            ppush(vvCTS);               break;
 
-    case Bytecodes::_ldc:               do_ldc(itr->get_index(),    itr->bci()); break;
-    case Bytecodes::_ldc_w:             do_ldc(itr->get_index_u2(), itr->bci()); break;
+    case Bytecodes::_ldc:               // fall through:
+    case Bytecodes::_ldc_w:           { Bytecode_loadconstant* ldc = Bytecode_loadconstant_at(itr->method(), itr->bci());
+                                        do_ldc(ldc->pool_index(), itr->bci());
+                                        break;
+                                      }
 
     case Bytecodes::_iload:
     case Bytecodes::_fload:             ppload(vCTS, itr->get_index()); break;
                                     
2010-09-02
EVALUATION

See comments
                                     
2010-11-19
EVALUATION

http://hg.openjdk.java.net/jdk7/build/hotspot/rev/d1896d1dda3e
                                     
2010-12-04



Hardware and Software, Engineered to Work Together