comparison agent/src/share/classes/sun/jvm/hotspot/runtime/sparc/SPARCFrame.java @ 3908:7588156f5cf9

7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244) Reviewed-by: kvn
author never
date Mon, 05 Sep 2011 17:09:05 -0700
parents c18cbe5936b8
children 8187c94a9a87
comparison
equal deleted inserted replaced
3907:7b5c767f229c 3908:7588156f5cf9
234 if ( pc != null) { 234 if ( pc != null) {
235 // Look for a deopt pc and if it is deopted convert to original pc 235 // Look for a deopt pc and if it is deopted convert to original pc
236 CodeBlob cb = VM.getVM().getCodeCache().findBlob(pc); 236 CodeBlob cb = VM.getVM().getCodeCache().findBlob(pc);
237 if (cb != null && cb.isJavaMethod()) { 237 if (cb != null && cb.isJavaMethod()) {
238 NMethod nm = (NMethod) cb; 238 NMethod nm = (NMethod) cb;
239 if (pc.equals(nm.deoptBegin())) { 239 if (pc.equals(nm.deoptHandlerBegin())) {
240 // adjust pc if frame is deoptimized. 240 // adjust pc if frame is deoptimized.
241 pc = this.getUnextendedSP().getAddressAt(nm.origPCOffset()); 241 pc = this.getUnextendedSP().getAddressAt(nm.origPCOffset());
242 deoptimized = true; 242 deoptimized = true;
243 } 243 }
244 } 244 }
557 Address pc = fp.getAddressAt(VM.getVM().getAddressSize() * PC_OFFSET_IN_GREGSET); 557 Address pc = fp.getAddressAt(VM.getVM().getAddressSize() * PC_OFFSET_IN_GREGSET);
558 return new SPARCFrame(raw_sp, pc); 558 return new SPARCFrame(raw_sp, pc);
559 } 559 }
560 } 560 }
561 561
562 if (!VM.getVM().isCore()) { 562 // Note: The version of this operation on any platform with callee-save
563 // Note: The version of this operation on any platform with callee-save 563 // registers must update the register map (if not null).
564 // registers must update the register map (if not null). 564 // In order to do this correctly, the various subtypes of
565 // In order to do this correctly, the various subtypes of 565 // of frame (interpreted, compiled, glue, native),
566 // of frame (interpreted, compiled, glue, native), 566 // must be distinguished. There is no need on SPARC for
567 // must be distinguished. There is no need on SPARC for 567 // such distinctions, because all callee-save registers are
568 // such distinctions, because all callee-save registers are 568 // preserved for all frames via SPARC-specific mechanisms.
569 // preserved for all frames via SPARC-specific mechanisms. 569 //
570 // 570 // *** HOWEVER, *** if and when we make any floating-point
571 // *** HOWEVER, *** if and when we make any floating-point 571 // registers callee-saved, then we will have to copy over
572 // registers callee-saved, then we will have to copy over 572 // the RegisterMap update logic from the Intel code.
573 // the RegisterMap update logic from the Intel code. 573
574 574 if (isRicochetFrame()) return senderForRicochetFrame(map);
575 575
576 // The constructor of the sender must know whether this frame is interpreted so it can set the 576 // The constructor of the sender must know whether this frame is interpreted so it can set the
577 // sender's _interpreter_sp_adjustment field. 577 // sender's _interpreter_sp_adjustment field.
578 if (VM.getVM().getInterpreter().contains(pc)) { 578 if (VM.getVM().getInterpreter().contains(pc)) {
579 isInterpreted = true; 579 isInterpreted = true;
580 map.makeIntegerRegsUnsaved(); 580 map.makeIntegerRegsUnsaved();
581 map.shiftWindow(sp, youngerSP);
582 } else {
583 // Find a CodeBlob containing this frame's pc or elide the lookup and use the
584 // supplied blob which is already known to be associated with this frame.
585 cb = VM.getVM().getCodeCache().findBlob(pc);
586 if (cb != null) {
587 // Update the location of all implicitly saved registers
588 // as the address of these registers in the register save
589 // area (for %o registers we use the address of the %i
590 // register in the next younger frame)
581 map.shiftWindow(sp, youngerSP); 591 map.shiftWindow(sp, youngerSP);
582 } else { 592 if (map.getUpdateMap()) {
583 // Find a CodeBlob containing this frame's pc or elide the lookup and use the 593 if (cb.callerMustGCArguments()) {
584 // supplied blob which is already known to be associated with this frame.
585 cb = VM.getVM().getCodeCache().findBlob(pc);
586 if (cb != null) {
587
588 if (cb.callerMustGCArguments(map.getThread())) {
589 map.setIncludeArgumentOops(true); 594 map.setIncludeArgumentOops(true);
590 } 595 }
591 596 if (cb.getOopMaps() != null) {
592 // Update the location of all implicitly saved registers 597 OopMapSet.updateRegisterMap(this, cb, map, VM.getVM().isDebugging());
593 // as the address of these registers in the register save
594 // area (for %o registers we use the address of the %i
595 // register in the next younger frame)
596 map.shiftWindow(sp, youngerSP);
597 if (map.getUpdateMap()) {
598 if (cb.getOopMaps() != null) {
599 OopMapSet.updateRegisterMap(this, cb, map, VM.getVM().isDebugging());
600 }
601 } 598 }
602 } 599 }
603 } 600 }
604 } // #ifndef CORE 601 }
605 602
606 return new SPARCFrame(biasSP(sp), biasSP(youngerSP), isInterpreted); 603 return new SPARCFrame(biasSP(sp), biasSP(youngerSP), isInterpreted);
607 } 604 }
608 605
609 protected boolean hasSenderPD() { 606 protected boolean hasSenderPD() {
946 943
947 return (a1.equals(a2)); 944 return (a1.equals(a2));
948 } 945 }
949 946
950 947
948 private Frame senderForRicochetFrame(SPARCRegisterMap map) {
949 if (DEBUG) {
950 System.out.println("senderForRicochetFrame");
951 }
952 //RicochetFrame* f = RicochetFrame::from_frame(fr);
953 // Cf. is_interpreted_frame path of frame::sender
954 Address youngerSP = getSP();
955 Address sp = getSenderSP();
956 map.makeIntegerRegsUnsaved();
957 map.shiftWindow(sp, youngerSP);
958 boolean thisFrameAdjustedStack = true; // I5_savedSP is live in this RF
959 return new SPARCFrame(sp, youngerSP, thisFrameAdjustedStack);
960 }
961
951 private Frame senderForEntryFrame(RegisterMap regMap) { 962 private Frame senderForEntryFrame(RegisterMap regMap) {
952 SPARCRegisterMap map = (SPARCRegisterMap) regMap; 963 SPARCRegisterMap map = (SPARCRegisterMap) regMap;
953 964
954 if (Assert.ASSERTS_ENABLED) { 965 if (Assert.ASSERTS_ENABLED) {
955 Assert.that(map != null, "map must be set"); 966 Assert.that(map != null, "map must be set");
963 } 974 }
964 Address lastJavaSP = jcw.getLastJavaSP(); 975 Address lastJavaSP = jcw.getLastJavaSP();
965 Address lastJavaPC = jcw.getLastJavaPC(); 976 Address lastJavaPC = jcw.getLastJavaPC();
966 map.clear(); 977 map.clear();
967 978
968 if (!VM.getVM().isCore()) { 979 map.makeIntegerRegsUnsaved();
969 map.makeIntegerRegsUnsaved(); 980 map.shiftWindow(lastJavaSP, null);
970 map.shiftWindow(lastJavaSP, null);
971 }
972 981
973 if (Assert.ASSERTS_ENABLED) { 982 if (Assert.ASSERTS_ENABLED) {
974 Assert.that(map.getIncludeArgumentOops(), "should be set by clear"); 983 Assert.that(map.getIncludeArgumentOops(), "should be set by clear");
975 } 984 }
976 985