7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 package sun.jvm.hotspot.runtime.sparc;
26
27 import java.util.*;
28
29 import sun.jvm.hotspot.asm.sparc.*;
30 import sun.jvm.hotspot.code.*;
31 import sun.jvm.hotspot.compiler.*;
32 import sun.jvm.hotspot.debugger.*;
33 import sun.jvm.hotspot.debugger.cdbg.*;
34 import sun.jvm.hotspot.oops.*;
35 import sun.jvm.hotspot.runtime.*;
36 import sun.jvm.hotspot.runtime.posix.*;
37 import sun.jvm.hotspot.types.*;
38 import sun.jvm.hotspot.utilities.*;
39
40 /** Specialization of and implementation of abstract methods of the
41 Frame class for the SPARC CPU. (FIXME: this is as quick a port as
42 possible to get things running; will have to do a better job right
43 away.) */
44
45 public class SPARCFrame extends Frame {
46 // The pc value is the raw return address, plus 8 (pcReturnOffset()).
47 // the value of sp and youngerSP that is stored in this object
48 // is always, always, always the value that would be found in the
49 // register (or window save area) while the target VM was executing.
50 // The caller of the constructor will alwasy know if has a biased or
51 // unbiased version of the stack pointer and can convert real (unbiased)
52 // value via a helper routine we supply.
53 // Whenever we return sp or youngerSP values we do not return the internal
54 // value but the real (unbiased) pointers since these are the true, usable
55 // memory addresses. The outlier case is that of the null pointer. The current
56 // mechanism makes null pointers always look null whether biased or not.
57 // This seems to cause no problems. In theory null real pointers could be biased
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 }
594 if (cb.getOopMaps() != null) {
595 OopMapSet.updateRegisterMap(this, cb, map, VM.getVM().isDebugging());
596 }
597 }
598 }
599 }
600
601 return new SPARCFrame(biasSP(sp), biasSP(youngerSP), isInterpreted);
602 }
603
604 protected boolean hasSenderPD() {
605 try {
606 // FIXME: should not happen!!!
607 if (getSP() == null) {
608 return false;
609 }
610 if ( unBiasSP(getSP().getAddressAt(SPARCRegisters.FP.spOffsetInSavedWindow())) == null ) {
611 return false;
612 }
613 return true;
614 } catch (RuntimeException e) {
615 if (DEBUG) {
|
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 package sun.jvm.hotspot.runtime.sparc;
26
27 import sun.jvm.hotspot.asm.sparc.*;
28 import sun.jvm.hotspot.code.*;
29 import sun.jvm.hotspot.compiler.*;
30 import sun.jvm.hotspot.debugger.*;
31 import sun.jvm.hotspot.debugger.cdbg.*;
32 import sun.jvm.hotspot.oops.*;
33 import sun.jvm.hotspot.runtime.*;
34 import sun.jvm.hotspot.runtime.posix.*;
35 import sun.jvm.hotspot.utilities.*;
36
37 /** Specialization of and implementation of abstract methods of the
38 Frame class for the SPARC CPU. (FIXME: this is as quick a port as
39 possible to get things running; will have to do a better job right
40 away.) */
41
42 public class SPARCFrame extends Frame {
43 // The pc value is the raw return address, plus 8 (pcReturnOffset()).
44 // the value of sp and youngerSP that is stored in this object
45 // is always, always, always the value that would be found in the
46 // register (or window save area) while the target VM was executing.
47 // The caller of the constructor will alwasy know if has a biased or
48 // unbiased version of the stack pointer and can convert real (unbiased)
49 // value via a helper routine we supply.
50 // Whenever we return sp or youngerSP values we do not return the internal
51 // value but the real (unbiased) pointers since these are the true, usable
52 // memory addresses. The outlier case is that of the null pointer. The current
53 // mechanism makes null pointers always look null whether biased or not.
54 // This seems to cause no problems. In theory null real pointers could be biased
572 // sender's _interpreter_sp_adjustment field.
573 if (VM.getVM().getInterpreter().contains(pc)) {
574 isInterpreted = true;
575 map.makeIntegerRegsUnsaved();
576 map.shiftWindow(sp, youngerSP);
577 } else {
578 // Find a CodeBlob containing this frame's pc or elide the lookup and use the
579 // supplied blob which is already known to be associated with this frame.
580 cb = VM.getVM().getCodeCache().findBlob(pc);
581 if (cb != null) {
582 // Update the location of all implicitly saved registers
583 // as the address of these registers in the register save
584 // area (for %o registers we use the address of the %i
585 // register in the next younger frame)
586 map.shiftWindow(sp, youngerSP);
587 if (map.getUpdateMap()) {
588 if (cb.callerMustGCArguments()) {
589 map.setIncludeArgumentOops(true);
590 }
591 if (cb.getOopMaps() != null) {
592 ImmutableOopMapSet.updateRegisterMap(this, cb, map, VM.getVM().isDebugging());
593 }
594 }
595 }
596 }
597
598 return new SPARCFrame(biasSP(sp), biasSP(youngerSP), isInterpreted);
599 }
600
601 protected boolean hasSenderPD() {
602 try {
603 // FIXME: should not happen!!!
604 if (getSP() == null) {
605 return false;
606 }
607 if ( unBiasSP(getSP().getAddressAt(SPARCRegisters.FP.spOffsetInSavedWindow())) == null ) {
608 return false;
609 }
610 return true;
611 } catch (RuntimeException e) {
612 if (DEBUG) {
|