comparison src/share/vm/oops/generateOopMap.cpp @ 1910:d1896d1dda3e

6981788: GC map generator sometimes picks up the wrong kind of instruction operand Summary: Distinguish pool indexes from cache indexes in recently changed code. Reviewed-by: never
author jrose
date Sat, 30 Oct 2010 11:45:35 -0700
parents 126ea7725993
children f95d63e2154a
comparison
equal deleted inserted replaced
1909:d2e35ffae982 1910:d1896d1dda3e
1252 case Bytecodes::_invokevirtual: 1252 case Bytecodes::_invokevirtual:
1253 case Bytecodes::_invokespecial: 1253 case Bytecodes::_invokespecial:
1254 case Bytecodes::_invokestatic: 1254 case Bytecodes::_invokestatic:
1255 case Bytecodes::_invokedynamic: 1255 case Bytecodes::_invokedynamic:
1256 case Bytecodes::_invokeinterface: 1256 case Bytecodes::_invokeinterface:
1257 int idx = currentBC->has_index_u4() ? currentBC->get_index_u4() : currentBC->get_index_u2(); 1257 int idx = currentBC->has_index_u4() ? currentBC->get_index_u4() : currentBC->get_index_u2_cpcache();
1258 constantPoolOop cp = method()->constants(); 1258 constantPoolOop cp = method()->constants();
1259 int nameAndTypeIdx = cp->name_and_type_ref_index_at(idx); 1259 int nameAndTypeIdx = cp->name_and_type_ref_index_at(idx);
1260 int signatureIdx = cp->signature_ref_index_at(nameAndTypeIdx); 1260 int signatureIdx = cp->signature_ref_index_at(nameAndTypeIdx);
1261 symbolOop signature = cp->symbol_at(signatureIdx); 1261 symbolOop signature = cp->symbol_at(signatureIdx);
1262 os->print("%s", signature->as_C_string()); 1262 os->print("%s", signature->as_C_string());
1284 case Bytecodes::_invokevirtual: 1284 case Bytecodes::_invokevirtual:
1285 case Bytecodes::_invokespecial: 1285 case Bytecodes::_invokespecial:
1286 case Bytecodes::_invokestatic: 1286 case Bytecodes::_invokestatic:
1287 case Bytecodes::_invokedynamic: 1287 case Bytecodes::_invokedynamic:
1288 case Bytecodes::_invokeinterface: 1288 case Bytecodes::_invokeinterface:
1289 int idx = currentBC->has_index_u4() ? currentBC->get_index_u4() : currentBC->get_index_u2(); 1289 int idx = currentBC->has_index_u4() ? currentBC->get_index_u4() : currentBC->get_index_u2_cpcache();
1290 constantPoolOop cp = method()->constants(); 1290 constantPoolOop cp = method()->constants();
1291 int nameAndTypeIdx = cp->name_and_type_ref_index_at(idx); 1291 int nameAndTypeIdx = cp->name_and_type_ref_index_at(idx);
1292 int signatureIdx = cp->signature_ref_index_at(nameAndTypeIdx); 1292 int signatureIdx = cp->signature_ref_index_at(nameAndTypeIdx);
1293 symbolOop signature = cp->symbol_at(signatureIdx); 1293 symbolOop signature = cp->symbol_at(signatureIdx);
1294 os->print("%s", signature->as_C_string()); 1294 os->print("%s", signature->as_C_string());
1354 case Bytecodes::_dconst_0: 1354 case Bytecodes::_dconst_0:
1355 case Bytecodes::_dconst_1: ppush(vvCTS); break; 1355 case Bytecodes::_dconst_1: ppush(vvCTS); break;
1356 1356
1357 case Bytecodes::_ldc2_w: ppush(vvCTS); break; 1357 case Bytecodes::_ldc2_w: ppush(vvCTS); break;
1358 1358
1359 case Bytecodes::_ldc: do_ldc(itr->get_index(), itr->bci()); break; 1359 case Bytecodes::_ldc: // fall through:
1360 case Bytecodes::_ldc_w: do_ldc(itr->get_index_u2(), itr->bci()); break; 1360 case Bytecodes::_ldc_w: do_ldc(itr->bci()); break;
1361 1361
1362 case Bytecodes::_iload: 1362 case Bytecodes::_iload:
1363 case Bytecodes::_fload: ppload(vCTS, itr->get_index()); break; 1363 case Bytecodes::_fload: ppload(vCTS, itr->get_index()); break;
1364 1364
1365 case Bytecodes::_lload: 1365 case Bytecodes::_lload:
1827 push(CellTypeState::make_addr(targ_bci)); 1827 push(CellTypeState::make_addr(targ_bci));
1828 } 1828 }
1829 1829
1830 1830
1831 1831
1832 void GenerateOopMap::do_ldc(int idx, int bci) { 1832 void GenerateOopMap::do_ldc(int bci) {
1833 Bytecode_loadconstant* ldc = Bytecode_loadconstant_at(method(), bci);
1833 constantPoolOop cp = method()->constants(); 1834 constantPoolOop cp = method()->constants();
1834 CellTypeState cts = cp->is_pointer_entry(idx) ? CellTypeState::make_line_ref(bci) : valCTS; 1835 BasicType bt = ldc->result_type();
1836 CellTypeState cts = (bt == T_OBJECT) ? CellTypeState::make_line_ref(bci) : valCTS;
1837 // Make sure bt==T_OBJECT is the same as old code (is_pointer_entry).
1838 // Note that CONSTANT_MethodHandle entries are u2 index pairs, not pointer-entries,
1839 // and they are processed by _fast_aldc and the CP cache.
1840 assert((ldc->has_cache_index() || cp->is_pointer_entry(ldc->pool_index()))
1841 ? (bt == T_OBJECT) : true, "expected object type");
1835 ppush1(cts); 1842 ppush1(cts);
1836 } 1843 }
1837 1844
1838 void GenerateOopMap::do_multianewarray(int dims, int bci) { 1845 void GenerateOopMap::do_multianewarray(int dims, int bci) {
1839 assert(dims >= 1, "sanity check"); 1846 assert(dims >= 1, "sanity check");