comparison agent/src/share/classes/sun/jvm/hotspot/oops/GenerateOopMap.java @ 3838:6a991dcb52bb

7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries Reviewed-by: kvn, twisti, jrose
author never
date Thu, 21 Jul 2011 08:38:25 -0700
parents 1d1603768966
children 8150fa46d2ed
comparison
equal deleted inserted replaced
3837:43f9d800f276 3838:6a991dcb52bb
567 case Bytecodes._invokestatic: 567 case Bytecodes._invokestatic:
568 case Bytecodes._invokeinterface: 568 case Bytecodes._invokeinterface:
569 case Bytecodes._invokedynamic: 569 case Bytecodes._invokedynamic:
570 // FIXME: print signature of referenced method (need more 570 // FIXME: print signature of referenced method (need more
571 // accessors in ConstantPool and ConstantPoolCache) 571 // accessors in ConstantPool and ConstantPoolCache)
572 int idx = currentBC.getIndexBig(); 572 int idx = currentBC.hasIndexU4() ? currentBC.getIndexU4() : currentBC.getIndexU2();
573 tty.print(" idx " + idx); 573 tty.print(" idx " + idx);
574 /* 574 /*
575 int idx = currentBC.getIndexBig(); 575 int idx = currentBC.getIndexU2();
576 ConstantPool cp = method().getConstants(); 576 ConstantPool cp = method().getConstants();
577 int nameAndTypeIdx = cp.name_and_type_ref_index_at(idx); 577 int nameAndTypeIdx = cp.name_and_type_ref_index_at(idx);
578 int signatureIdx = cp.signature_ref_index_at(nameAndTypeIdx); 578 int signatureIdx = cp.signature_ref_index_at(nameAndTypeIdx);
579 Symbol* signature = cp.symbol_at(signatureIdx); 579 Symbol* signature = cp.symbol_at(signatureIdx);
580 tty.print("%s", signature.as_C_string()); 580 tty.print("%s", signature.as_C_string());
607 case Bytecodes._invokestatic: 607 case Bytecodes._invokestatic:
608 case Bytecodes._invokeinterface: 608 case Bytecodes._invokeinterface:
609 case Bytecodes._invokedynamic: 609 case Bytecodes._invokedynamic:
610 // FIXME: print signature of referenced method (need more 610 // FIXME: print signature of referenced method (need more
611 // accessors in ConstantPool and ConstantPoolCache) 611 // accessors in ConstantPool and ConstantPoolCache)
612 int idx = currentBC.getIndexBig(); 612 int idx = currentBC.hasIndexU4() ? currentBC.getIndexU4() : currentBC.getIndexU2();
613 tty.print(" idx " + idx); 613 tty.print(" idx " + idx);
614 /* 614 /*
615 int idx = currentBC.getIndexBig(); 615 int idx = currentBC.getIndexU2();
616 constantPoolOop cp = method().constants(); 616 constantPoolOop cp = method().constants();
617 int nameAndTypeIdx = cp.name_and_type_ref_index_at(idx); 617 int nameAndTypeIdx = cp.name_and_type_ref_index_at(idx);
618 int signatureIdx = cp.signature_ref_index_at(nameAndTypeIdx); 618 int signatureIdx = cp.signature_ref_index_at(nameAndTypeIdx);
619 Symbol* signature = cp.symbol_at(signatureIdx); 619 Symbol* signature = cp.symbol_at(signatureIdx);
620 tty.print("%s", signature.as_C_string()); 620 tty.print("%s", signature.as_C_string());
1116 1116
1117 /** Sets the current state to be the state after executing the 1117 /** Sets the current state to be the state after executing the
1118 current instruction, starting in the current state. */ 1118 current instruction, starting in the current state. */
1119 void interp1 (BytecodeStream itr) { 1119 void interp1 (BytecodeStream itr) {
1120 if (DEBUG) { 1120 if (DEBUG) {
1121 System.err.println(" - bci " + itr.bci()); 1121 System.err.println(" - bci " + itr.bci() + " " + itr.code());
1122 printCurrentState(System.err, itr, false);
1122 } 1123 }
1123 1124
1124 // if (TraceNewOopMapGeneration) { 1125 // if (TraceNewOopMapGeneration) {
1125 // print_current_state(tty, itr, TraceNewOopMapGenerationDetailed); 1126 // print_current_state(tty, itr, TraceNewOopMapGenerationDetailed);
1126 // } 1127 // }
1177 case Bytecodes._dconst_0: 1178 case Bytecodes._dconst_0:
1178 case Bytecodes._dconst_1: ppush(vvCTS); break; 1179 case Bytecodes._dconst_1: ppush(vvCTS); break;
1179 1180
1180 case Bytecodes._ldc2_w: ppush(vvCTS); break; 1181 case Bytecodes._ldc2_w: ppush(vvCTS); break;
1181 1182
1182 case Bytecodes._ldc: doLdc(itr.getIndex(), itr.bci()); break; 1183 case Bytecodes._ldc: doLdc(itr.bci()); break;
1183 case Bytecodes._ldc_w: doLdc(itr.getIndexBig(), itr.bci());break; 1184 case Bytecodes._ldc_w: doLdc(itr.bci()); break;
1184 1185
1185 case Bytecodes._iload: 1186 case Bytecodes._iload:
1186 case Bytecodes._fload: ppload(vCTS, itr.getIndex()); break; 1187 case Bytecodes._fload: ppload(vCTS, itr.getIndex()); break;
1187 1188
1188 case Bytecodes._lload: 1189 case Bytecodes._lload:
1370 case Bytecodes._if_acmpne: ppop(rrCTS); break; 1371 case Bytecodes._if_acmpne: ppop(rrCTS); break;
1371 1372
1372 case Bytecodes._jsr: doJsr(itr.dest()); break; 1373 case Bytecodes._jsr: doJsr(itr.dest()); break;
1373 case Bytecodes._jsr_w: doJsr(itr.dest_w()); break; 1374 case Bytecodes._jsr_w: doJsr(itr.dest_w()); break;
1374 1375
1375 case Bytecodes._getstatic: doField(true, true, 1376 case Bytecodes._getstatic: doField(true, true, itr.getIndexU2Cpcache(), itr.bci()); break;
1376 itr.getIndexBig(), 1377 case Bytecodes._putstatic: doField(false, true, itr.getIndexU2Cpcache(), itr.bci()); break;
1377 itr.bci()); break; 1378 case Bytecodes._getfield: doField(true, false, itr.getIndexU2Cpcache(), itr.bci()); break;
1378 case Bytecodes._putstatic: doField(false, true, itr.getIndexBig(), itr.bci()); break; 1379 case Bytecodes._putfield: doField(false, false, itr.getIndexU2Cpcache(), itr.bci()); break;
1379 case Bytecodes._getfield: doField(true, false, itr.getIndexBig(), itr.bci()); break;
1380 case Bytecodes._putfield: doField(false, false, itr.getIndexBig(), itr.bci()); break;
1381 1380
1382 case Bytecodes._invokevirtual: 1381 case Bytecodes._invokevirtual:
1383 case Bytecodes._invokespecial: doMethod(false, false, itr.getIndexBig(), itr.bci()); break; 1382 case Bytecodes._invokespecial: doMethod(false, false, itr.getIndexU2Cpcache(), itr.bci()); break;
1384 case Bytecodes._invokestatic: doMethod(true, false, itr.getIndexBig(), itr.bci()); break; 1383 case Bytecodes._invokestatic: doMethod(true, false, itr.getIndexU2Cpcache(), itr.bci()); break;
1385 case Bytecodes._invokedynamic: doMethod(false, true, itr.getIndexBig(), itr.bci()); break; 1384 case Bytecodes._invokedynamic: doMethod(true, false, itr.getIndexU4(), itr.bci()); break;
1386 case Bytecodes._invokeinterface: doMethod(false, true, itr.getIndexBig(), itr.bci()); break; 1385 case Bytecodes._invokeinterface: doMethod(false, true, itr.getIndexU2Cpcache(), itr.bci()); break;
1387 case Bytecodes._newarray: 1386 case Bytecodes._newarray:
1388 case Bytecodes._anewarray: ppNewRef(vCTS, itr.bci()); break; 1387 case Bytecodes._anewarray: ppNewRef(vCTS, itr.bci()); break;
1389 case Bytecodes._checkcast: doCheckcast(); break; 1388 case Bytecodes._checkcast: doCheckcast(); break;
1390 case Bytecodes._arraylength: 1389 case Bytecodes._arraylength:
1391 case Bytecodes._instanceof: pp(rCTS, vCTS); break; 1390 case Bytecodes._instanceof: pp(rCTS, vCTS); break;
1663 } 1662 }
1664 push(actual[idx]); 1663 push(actual[idx]);
1665 } 1664 }
1666 } 1665 }
1667 1666
1668 void doLdc (int idx, int bci) { 1667 void doLdc (int bci) {
1668 BytecodeLoadConstant ldc = BytecodeLoadConstant.at(_method, bci);
1669 ConstantPool cp = method().getConstants(); 1669 ConstantPool cp = method().getConstants();
1670 ConstantTag tag = cp.getTagAt(idx); 1670 BasicType bt = ldc.resultType();
1671 CellTypeState cts = (tag.isString() || tag.isUnresolvedString() || 1671 CellTypeState cts = (bt == BasicType.T_OBJECT) ? CellTypeState.makeLineRef(bci) : valCTS;
1672 tag.isKlass() || tag.isUnresolvedKlass())
1673 ? CellTypeState.makeLineRef(bci)
1674 : valCTS;
1675 ppush1(cts); 1672 ppush1(cts);
1676 } 1673 }
1677 1674
1678 void doAstore (int idx) { 1675 void doAstore (int idx) {
1679 CellTypeState r_or_p = pop(); 1676 CellTypeState r_or_p = pop();
1727 } 1724 }
1728 1725
1729 void doMethod (boolean is_static, boolean is_interface, int idx, int bci) { 1726 void doMethod (boolean is_static, boolean is_interface, int idx, int bci) {
1730 // Dig up signature for field in constant pool 1727 // Dig up signature for field in constant pool
1731 ConstantPool cp = _method.getConstants(); 1728 ConstantPool cp = _method.getConstants();
1732 int nameAndTypeIdx = cp.getTagAt(idx).isNameAndType() ? idx : cp.getNameAndTypeRefIndexAt(idx); 1729 Symbol signature = cp.getSignatureRefAt(idx);
1733 int signatureIdx = cp.getSignatureRefIndexAt(nameAndTypeIdx);
1734 Symbol signature = cp.getSymbolAt(signatureIdx);
1735
1736 if (DEBUG) {
1737 System.err.println("doMethod: signature = " + signature.asString() + ", idx = " + idx +
1738 ", nameAndTypeIdx = " + nameAndTypeIdx + ", signatureIdx = " + signatureIdx +
1739 ", bci = " + bci);
1740 }
1741 1730
1742 // Parse method signature 1731 // Parse method signature
1743 CellTypeStateList out = new CellTypeStateList(4); 1732 CellTypeStateList out = new CellTypeStateList(4);
1744 CellTypeStateList in = new CellTypeStateList(MAXARGSIZE+1); // Includes result 1733 CellTypeStateList in = new CellTypeStateList(MAXARGSIZE+1); // Includes result
1745 ComputeCallStack cse = new ComputeCallStack(signature); 1734 ComputeCallStack cse = new ComputeCallStack(signature);