554 int PC_OFFSET_IN_GREGSET = 1; 555 int SP_OFFSET_IN_GREGSET = 17; 556 raw_sp = fp.getAddressAt(VM.getVM().getAddressSize() * SP_OFFSET_IN_GREGSET); 557 Address pc = fp.getAddressAt(VM.getVM().getAddressSize() * PC_OFFSET_IN_GREGSET); 558 return new SPARCFrame(raw_sp, pc); 559 } 560 } 561 562 // Note: The version of this operation on any platform with callee-save 563 // registers must update the register map (if not null). 564 // In order to do this correctly, the various subtypes of 565 // of frame (interpreted, compiled, glue, native), 566 // must be distinguished. There is no need on SPARC for 567 // such distinctions, because all callee-save registers are 568 // preserved for all frames via SPARC-specific mechanisms. 569 // 570 // *** HOWEVER, *** if and when we make any floating-point 571 // registers callee-saved, then we will have to copy over 572 // the RegisterMap update logic from the Intel code. 573 574 if (isRicochetFrame()) return senderForRicochetFrame(map); 575 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. 578 if (VM.getVM().getInterpreter().contains(pc)) { 579 isInterpreted = true; 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) 591 map.shiftWindow(sp, youngerSP); 592 if (map.getUpdateMap()) { 593 if (cb.callerMustGCArguments()) { 594 map.setIncludeArgumentOops(true); 595 } 928 return getSP().addOffsetTo(SPARCRegisters.I0.spOffsetInSavedWindow()); 929 } 930 931 private Address addressOfO0() { 932 return afterSave().addressOfI0(); 933 } 934 935 private static boolean addressesEqual(Address a1, Address a2) { 936 if ((a1 == null) && (a2 == null)) { 937 return true; 938 } 939 940 if ((a1 == null) || (a2 == null)) { 941 return false; 942 } 943 944 return (a1.equals(a2)); 945 } 946 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(biasSP(sp), biasSP(youngerSP), thisFrameAdjustedStack); 960 } 961 962 private Frame senderForEntryFrame(RegisterMap regMap) { 963 SPARCRegisterMap map = (SPARCRegisterMap) regMap; 964 965 if (Assert.ASSERTS_ENABLED) { 966 Assert.that(map != null, "map must be set"); 967 } 968 // Java frame called from C; skip all C frames and return top C 969 // frame of that chunk as the sender 970 JavaCallWrapper jcw = getEntryFrameCallWrapper(); 971 if (Assert.ASSERTS_ENABLED) { 972 Assert.that(!entryFrameIsFirst(), "next Java fp must be non zero"); 973 Assert.that(jcw.getLastJavaSP().greaterThan(getSP()), "must be above this frame on stack"); 974 } 975 Address lastJavaSP = jcw.getLastJavaSP(); 976 Address lastJavaPC = jcw.getLastJavaPC(); 977 map.clear(); 978 979 map.makeIntegerRegsUnsaved(); 980 map.shiftWindow(lastJavaSP, null); 981 | 554 int PC_OFFSET_IN_GREGSET = 1; 555 int SP_OFFSET_IN_GREGSET = 17; 556 raw_sp = fp.getAddressAt(VM.getVM().getAddressSize() * SP_OFFSET_IN_GREGSET); 557 Address pc = fp.getAddressAt(VM.getVM().getAddressSize() * PC_OFFSET_IN_GREGSET); 558 return new SPARCFrame(raw_sp, pc); 559 } 560 } 561 562 // Note: The version of this operation on any platform with callee-save 563 // registers must update the register map (if not null). 564 // In order to do this correctly, the various subtypes of 565 // of frame (interpreted, compiled, glue, native), 566 // must be distinguished. There is no need on SPARC for 567 // such distinctions, because all callee-save registers are 568 // preserved for all frames via SPARC-specific mechanisms. 569 // 570 // *** HOWEVER, *** if and when we make any floating-point 571 // registers callee-saved, then we will have to copy over 572 // the RegisterMap update logic from the Intel code. 573 574 // The constructor of the sender must know whether this frame is interpreted so it can set the 575 // sender's _interpreter_sp_adjustment field. 576 if (VM.getVM().getInterpreter().contains(pc)) { 577 isInterpreted = true; 578 map.makeIntegerRegsUnsaved(); 579 map.shiftWindow(sp, youngerSP); 580 } else { 581 // Find a CodeBlob containing this frame's pc or elide the lookup and use the 582 // supplied blob which is already known to be associated with this frame. 583 cb = VM.getVM().getCodeCache().findBlob(pc); 584 if (cb != null) { 585 // Update the location of all implicitly saved registers 586 // as the address of these registers in the register save 587 // area (for %o registers we use the address of the %i 588 // register in the next younger frame) 589 map.shiftWindow(sp, youngerSP); 590 if (map.getUpdateMap()) { 591 if (cb.callerMustGCArguments()) { 592 map.setIncludeArgumentOops(true); 593 } 926 return getSP().addOffsetTo(SPARCRegisters.I0.spOffsetInSavedWindow()); 927 } 928 929 private Address addressOfO0() { 930 return afterSave().addressOfI0(); 931 } 932 933 private static boolean addressesEqual(Address a1, Address a2) { 934 if ((a1 == null) && (a2 == null)) { 935 return true; 936 } 937 938 if ((a1 == null) || (a2 == null)) { 939 return false; 940 } 941 942 return (a1.equals(a2)); 943 } 944 945 946 private Frame senderForEntryFrame(RegisterMap regMap) { 947 SPARCRegisterMap map = (SPARCRegisterMap) regMap; 948 949 if (Assert.ASSERTS_ENABLED) { 950 Assert.that(map != null, "map must be set"); 951 } 952 // Java frame called from C; skip all C frames and return top C 953 // frame of that chunk as the sender 954 JavaCallWrapper jcw = getEntryFrameCallWrapper(); 955 if (Assert.ASSERTS_ENABLED) { 956 Assert.that(!entryFrameIsFirst(), "next Java fp must be non zero"); 957 Assert.that(jcw.getLastJavaSP().greaterThan(getSP()), "must be above this frame on stack"); 958 } 959 Address lastJavaSP = jcw.getLastJavaSP(); 960 Address lastJavaPC = jcw.getLastJavaPC(); 961 map.clear(); 962 963 map.makeIntegerRegsUnsaved(); 964 map.shiftWindow(lastJavaSP, null); 965 |