annotate agent/src/share/classes/sun/jvm/hotspot/runtime/ia64/IA64Frame.java @ 749:81a249214991

6829234: Refix 6822407 and 6812971 Summary: Fixes two SA issues 6822407 and 6812971 Reviewed-by: swamyv, acorn, kvn, coleenp
author poonam
date Mon, 04 May 2009 17:58:10 -0700
parents a61af66fc99e
children c18cbe5936b8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 package sun.jvm.hotspot.runtime.ia64;
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 import java.util.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
28 // import sun.jvm.hotspot.asm.ia64.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
29 import sun.jvm.hotspot.code.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
30 import sun.jvm.hotspot.compiler.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
31 import sun.jvm.hotspot.debugger.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
32 import sun.jvm.hotspot.oops.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
33 import sun.jvm.hotspot.runtime.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
34 import sun.jvm.hotspot.types.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
35 import sun.jvm.hotspot.utilities.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
36
a61af66fc99e Initial load
duke
parents:
diff changeset
37 /** Specialization of and implementation of abstract methods of the
a61af66fc99e Initial load
duke
parents:
diff changeset
38 Frame class for the ia64 family of CPUs. */
a61af66fc99e Initial load
duke
parents:
diff changeset
39
a61af66fc99e Initial load
duke
parents:
diff changeset
40 public class IA64Frame extends Frame {
a61af66fc99e Initial load
duke
parents:
diff changeset
41 private static final boolean DEBUG = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
42
a61af66fc99e Initial load
duke
parents:
diff changeset
43 // All frames
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45 // Interpreter frames
a61af66fc99e Initial load
duke
parents:
diff changeset
46
a61af66fc99e Initial load
duke
parents:
diff changeset
47 // Entry frames
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // Native frames
a61af66fc99e Initial load
duke
parents:
diff changeset
50
a61af66fc99e Initial load
duke
parents:
diff changeset
51 // an additional field beyond sp and pc:
a61af66fc99e Initial load
duke
parents:
diff changeset
52 // Address raw_fp; // frame pointer only 1.4.2
a61af66fc99e Initial load
duke
parents:
diff changeset
53
a61af66fc99e Initial load
duke
parents:
diff changeset
54 Address iframe;
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 private IA64Frame() {
a61af66fc99e Initial load
duke
parents:
diff changeset
57 }
a61af66fc99e Initial load
duke
parents:
diff changeset
58
a61af66fc99e Initial load
duke
parents:
diff changeset
59 public IA64Frame(Address raw_sp, Address iframe, Address pc) {
a61af66fc99e Initial load
duke
parents:
diff changeset
60 this.raw_sp = raw_sp;
a61af66fc99e Initial load
duke
parents:
diff changeset
61 this.iframe = iframe;
a61af66fc99e Initial load
duke
parents:
diff changeset
62 this.pc = pc;
a61af66fc99e Initial load
duke
parents:
diff changeset
63 if (DEBUG) {
a61af66fc99e Initial load
duke
parents:
diff changeset
64 System.err.println("IA64Frame(sp, iframe, pc): " + this);
a61af66fc99e Initial load
duke
parents:
diff changeset
65 dumpStack();
a61af66fc99e Initial load
duke
parents:
diff changeset
66 }
a61af66fc99e Initial load
duke
parents:
diff changeset
67 }
a61af66fc99e Initial load
duke
parents:
diff changeset
68
a61af66fc99e Initial load
duke
parents:
diff changeset
69 public Object clone() {
a61af66fc99e Initial load
duke
parents:
diff changeset
70 IA64Frame frame = new IA64Frame();
a61af66fc99e Initial load
duke
parents:
diff changeset
71 frame.raw_sp = raw_sp;
a61af66fc99e Initial load
duke
parents:
diff changeset
72 frame.iframe = iframe;
a61af66fc99e Initial load
duke
parents:
diff changeset
73 frame.pc = pc;
a61af66fc99e Initial load
duke
parents:
diff changeset
74 return frame;
a61af66fc99e Initial load
duke
parents:
diff changeset
75 }
a61af66fc99e Initial load
duke
parents:
diff changeset
76
a61af66fc99e Initial load
duke
parents:
diff changeset
77 public boolean equals(Object arg) {
a61af66fc99e Initial load
duke
parents:
diff changeset
78 if (arg == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
79 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
80 }
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 if (!(arg instanceof IA64Frame)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
83 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
84 }
a61af66fc99e Initial load
duke
parents:
diff changeset
85
a61af66fc99e Initial load
duke
parents:
diff changeset
86 IA64Frame other = (IA64Frame) arg;
a61af66fc99e Initial load
duke
parents:
diff changeset
87
a61af66fc99e Initial load
duke
parents:
diff changeset
88 return (AddressOps.equal(getSP(), other.getSP()) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
89 AddressOps.equal(getIFRAME(), other.getIFRAME()) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
90 AddressOps.equal(getPC(), other.getPC()));
a61af66fc99e Initial load
duke
parents:
diff changeset
91 }
a61af66fc99e Initial load
duke
parents:
diff changeset
92
a61af66fc99e Initial load
duke
parents:
diff changeset
93 public int hashCode() {
a61af66fc99e Initial load
duke
parents:
diff changeset
94 if (iframe == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
95 return 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
96 }
a61af66fc99e Initial load
duke
parents:
diff changeset
97
a61af66fc99e Initial load
duke
parents:
diff changeset
98 return iframe.hashCode();
a61af66fc99e Initial load
duke
parents:
diff changeset
99 }
a61af66fc99e Initial load
duke
parents:
diff changeset
100
a61af66fc99e Initial load
duke
parents:
diff changeset
101 public String toString() {
a61af66fc99e Initial load
duke
parents:
diff changeset
102 return "sp: " + (getSP() == null? "null" : getSP().toString()) +
a61af66fc99e Initial load
duke
parents:
diff changeset
103 ", iframe: " + (getIFRAME() == null? "null" : getIFRAME().toString()) +
a61af66fc99e Initial load
duke
parents:
diff changeset
104 ", pc: " + (pc == null? "null" : pc.toString());
a61af66fc99e Initial load
duke
parents:
diff changeset
105 }
a61af66fc99e Initial load
duke
parents:
diff changeset
106
a61af66fc99e Initial load
duke
parents:
diff changeset
107 // accessors for the instance variables
a61af66fc99e Initial load
duke
parents:
diff changeset
108 public Address getFP() { return null; }
a61af66fc99e Initial load
duke
parents:
diff changeset
109 public Address getIFRAME() { return iframe; }
a61af66fc99e Initial load
duke
parents:
diff changeset
110 public Address getSP() { return raw_sp; }
a61af66fc99e Initial load
duke
parents:
diff changeset
111 public Address getID() { return getFP(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 // FIXME: not implemented yet
a61af66fc99e Initial load
duke
parents:
diff changeset
114 public boolean isSignalHandlerFrameDbg() { return false; }
a61af66fc99e Initial load
duke
parents:
diff changeset
115 public int getSignalNumberDbg() { return 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
116 public String getSignalNameDbg() { return null; }
a61af66fc99e Initial load
duke
parents:
diff changeset
117
a61af66fc99e Initial load
duke
parents:
diff changeset
118 // FIXME: do sanity checks
a61af66fc99e Initial load
duke
parents:
diff changeset
119 public boolean isInterpretedFrameValid() {
a61af66fc99e Initial load
duke
parents:
diff changeset
120 return true;
a61af66fc99e Initial load
duke
parents:
diff changeset
121 }
a61af66fc99e Initial load
duke
parents:
diff changeset
122
a61af66fc99e Initial load
duke
parents:
diff changeset
123 public boolean isInterpretedFrame() { return iframe != null; }
a61af66fc99e Initial load
duke
parents:
diff changeset
124
a61af66fc99e Initial load
duke
parents:
diff changeset
125
a61af66fc99e Initial load
duke
parents:
diff changeset
126 // FIXME: not applicable in current system
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // void patch_pc(Thread* thread, address pc);
a61af66fc99e Initial load
duke
parents:
diff changeset
128
a61af66fc99e Initial load
duke
parents:
diff changeset
129 public Frame sender(RegisterMap regMap, CodeBlob cb) {
a61af66fc99e Initial load
duke
parents:
diff changeset
130
a61af66fc99e Initial load
duke
parents:
diff changeset
131 if (iframe == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
132 return null;
a61af66fc99e Initial load
duke
parents:
diff changeset
133 }
a61af66fc99e Initial load
duke
parents:
diff changeset
134
a61af66fc99e Initial load
duke
parents:
diff changeset
135 cInterpreter fr = new cInterpreter(iframe);
a61af66fc99e Initial load
duke
parents:
diff changeset
136
a61af66fc99e Initial load
duke
parents:
diff changeset
137 if (fr.prev() == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
138 Address wrapper = fr.wrapper();
a61af66fc99e Initial load
duke
parents:
diff changeset
139 if ( wrapper == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
140 return null;
a61af66fc99e Initial load
duke
parents:
diff changeset
141 }
a61af66fc99e Initial load
duke
parents:
diff changeset
142 IA64JavaCallWrapper jcw = new IA64JavaCallWrapper(wrapper);
a61af66fc99e Initial load
duke
parents:
diff changeset
143 Address iprev = jcw.getPrevIFrame();
a61af66fc99e Initial load
duke
parents:
diff changeset
144 if (iprev == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
145 return null;
a61af66fc99e Initial load
duke
parents:
diff changeset
146 }
a61af66fc99e Initial load
duke
parents:
diff changeset
147 return new IA64Frame(null, iprev, null);
a61af66fc99e Initial load
duke
parents:
diff changeset
148 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
149 return new IA64Frame(null, fr.prev(), null);
a61af66fc99e Initial load
duke
parents:
diff changeset
150 }
a61af66fc99e Initial load
duke
parents:
diff changeset
151
a61af66fc99e Initial load
duke
parents:
diff changeset
152 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
153 IA64RegisterMap map = (IA64RegisterMap) regMap;
a61af66fc99e Initial load
duke
parents:
diff changeset
154
a61af66fc99e Initial load
duke
parents:
diff changeset
155 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
156 Assert.that(map != null, "map must be set");
a61af66fc99e Initial load
duke
parents:
diff changeset
157 }
a61af66fc99e Initial load
duke
parents:
diff changeset
158
a61af66fc99e Initial load
duke
parents:
diff changeset
159 // Default is we done have to follow them. The sender_for_xxx will
a61af66fc99e Initial load
duke
parents:
diff changeset
160 // update it accordingly
a61af66fc99e Initial load
duke
parents:
diff changeset
161 map.setIncludeArgumentOops(false);
a61af66fc99e Initial load
duke
parents:
diff changeset
162
a61af66fc99e Initial load
duke
parents:
diff changeset
163 if (isEntryFrame()) return senderForEntryFrame(map);
a61af66fc99e Initial load
duke
parents:
diff changeset
164 if (isInterpretedFrame()) return senderForInterpreterFrame(map);
a61af66fc99e Initial load
duke
parents:
diff changeset
165
a61af66fc99e Initial load
duke
parents:
diff changeset
166 if (!VM.getVM().isCore()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
167 if(cb == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
168 cb = VM.getVM().getCodeCache().findBlob(getPC());
a61af66fc99e Initial load
duke
parents:
diff changeset
169 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
170 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
171 Assert.that(cb.equals(VM.getVM().getCodeCache().findBlob(getPC())), "Must be the same");
a61af66fc99e Initial load
duke
parents:
diff changeset
172 }
a61af66fc99e Initial load
duke
parents:
diff changeset
173 }
a61af66fc99e Initial load
duke
parents:
diff changeset
174
a61af66fc99e Initial load
duke
parents:
diff changeset
175 if (cb != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
176 return senderForCompiledFrame(map, cb);
a61af66fc99e Initial load
duke
parents:
diff changeset
177 }
a61af66fc99e Initial load
duke
parents:
diff changeset
178 }
a61af66fc99e Initial load
duke
parents:
diff changeset
179
a61af66fc99e Initial load
duke
parents:
diff changeset
180 // Must be native-compiled frame, i.e. the marshaling code for native
a61af66fc99e Initial load
duke
parents:
diff changeset
181 // methods that exists in the core system.
a61af66fc99e Initial load
duke
parents:
diff changeset
182 return new IA64Frame(getSenderSP(), getLink(), getSenderPC());
a61af66fc99e Initial load
duke
parents:
diff changeset
183
a61af66fc99e Initial load
duke
parents:
diff changeset
184 */
a61af66fc99e Initial load
duke
parents:
diff changeset
185 }
a61af66fc99e Initial load
duke
parents:
diff changeset
186
a61af66fc99e Initial load
duke
parents:
diff changeset
187 private Frame senderForEntryFrame(IA64RegisterMap map) {
a61af66fc99e Initial load
duke
parents:
diff changeset
188 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
189 Assert.that(map != null, "map must be set");
a61af66fc99e Initial load
duke
parents:
diff changeset
190 }
a61af66fc99e Initial load
duke
parents:
diff changeset
191 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
192 // Java frame called from C; skip all C frames and return top C
a61af66fc99e Initial load
duke
parents:
diff changeset
193 // frame of that chunk as the sender
a61af66fc99e Initial load
duke
parents:
diff changeset
194 IA64JavaCallWrapper jcw = (IA64JavaCallWrapper) getEntryFrameCallWrapper();
a61af66fc99e Initial load
duke
parents:
diff changeset
195 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
196 Assert.that(!entryFrameIsFirst(), "next Java fp must be non zero");
a61af66fc99e Initial load
duke
parents:
diff changeset
197 Assert.that(jcw.getLastJavaSP().greaterThan(getSP()), "must be above this frame on stack");
a61af66fc99e Initial load
duke
parents:
diff changeset
198 }
a61af66fc99e Initial load
duke
parents:
diff changeset
199 IA64Frame fr = new IA64Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP(), null);
a61af66fc99e Initial load
duke
parents:
diff changeset
200 map.clear();
a61af66fc99e Initial load
duke
parents:
diff changeset
201 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
202 Assert.that(map.getIncludeArgumentOops(), "should be set by clear");
a61af66fc99e Initial load
duke
parents:
diff changeset
203 }
a61af66fc99e Initial load
duke
parents:
diff changeset
204 return fr;
a61af66fc99e Initial load
duke
parents:
diff changeset
205 */
a61af66fc99e Initial load
duke
parents:
diff changeset
206 throw new RuntimeException("senderForEntryFrame NYI");
a61af66fc99e Initial load
duke
parents:
diff changeset
207 }
a61af66fc99e Initial load
duke
parents:
diff changeset
208
a61af66fc99e Initial load
duke
parents:
diff changeset
209 private Frame senderForInterpreterFrame(IA64RegisterMap map) {
a61af66fc99e Initial load
duke
parents:
diff changeset
210 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
211 Address sp = addressOfStackSlot(INTERPRETER_FRAME_SENDER_SP_OFFSET).getAddressAt(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
212 // We do not need to update the callee-save register mapping because above
a61af66fc99e Initial load
duke
parents:
diff changeset
213 // us is either another interpreter frame or a converter-frame, but never
a61af66fc99e Initial load
duke
parents:
diff changeset
214 // directly a compiled frame.
a61af66fc99e Initial load
duke
parents:
diff changeset
215 return new IA64Frame(sp, getLink(), getSenderPC());
a61af66fc99e Initial load
duke
parents:
diff changeset
216 */
a61af66fc99e Initial load
duke
parents:
diff changeset
217 throw new RuntimeException("senderForInterpreterFrame NYI");
a61af66fc99e Initial load
duke
parents:
diff changeset
218 }
a61af66fc99e Initial load
duke
parents:
diff changeset
219
a61af66fc99e Initial load
duke
parents:
diff changeset
220 private Frame senderForDeoptimizedFrame(IA64RegisterMap map, CodeBlob cb) {
a61af66fc99e Initial load
duke
parents:
diff changeset
221 // FIXME
a61af66fc99e Initial load
duke
parents:
diff changeset
222 throw new RuntimeException("Deoptimized frames not handled yet");
a61af66fc99e Initial load
duke
parents:
diff changeset
223 }
a61af66fc99e Initial load
duke
parents:
diff changeset
224
a61af66fc99e Initial load
duke
parents:
diff changeset
225 private Frame senderForCompiledFrame(IA64RegisterMap map, CodeBlob cb) {
a61af66fc99e Initial load
duke
parents:
diff changeset
226 //
a61af66fc99e Initial load
duke
parents:
diff changeset
227 // NOTE: some of this code is (unfortunately) duplicated in IA64CurrentFrameGuess
a61af66fc99e Initial load
duke
parents:
diff changeset
228 //
a61af66fc99e Initial load
duke
parents:
diff changeset
229
a61af66fc99e Initial load
duke
parents:
diff changeset
230 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
231 Assert.that(map != null, "map must be set");
a61af66fc99e Initial load
duke
parents:
diff changeset
232 }
a61af66fc99e Initial load
duke
parents:
diff changeset
233
a61af66fc99e Initial load
duke
parents:
diff changeset
234 throw new RuntimeException("senderForCompiledFrame NYI");
a61af66fc99e Initial load
duke
parents:
diff changeset
235
a61af66fc99e Initial load
duke
parents:
diff changeset
236 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
237
a61af66fc99e Initial load
duke
parents:
diff changeset
238 // frame owned by optimizing compiler
a61af66fc99e Initial load
duke
parents:
diff changeset
239 Address sender_sp = null;
a61af66fc99e Initial load
duke
parents:
diff changeset
240
a61af66fc99e Initial load
duke
parents:
diff changeset
241 if (VM.getVM().isClientCompiler()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
242 sender_sp = addressOfStackSlot(SENDER_SP_OFFSET);
a61af66fc99e Initial load
duke
parents:
diff changeset
243 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
244 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
245 Assert.that(cb.getFrameSize() >= 0, "Compiled by Compiler1: do not use");
a61af66fc99e Initial load
duke
parents:
diff changeset
246 }
a61af66fc99e Initial load
duke
parents:
diff changeset
247 sender_sp = getSP().addOffsetTo(cb.getFrameSize());
a61af66fc99e Initial load
duke
parents:
diff changeset
248 }
a61af66fc99e Initial load
duke
parents:
diff changeset
249
a61af66fc99e Initial load
duke
parents:
diff changeset
250 // On Intel the return_address is always the word on the stack
a61af66fc99e Initial load
duke
parents:
diff changeset
251 Address sender_pc = sender_sp.getAddressAt(-1 * VM.getVM().getAddressSize());
a61af66fc99e Initial load
duke
parents:
diff changeset
252
a61af66fc99e Initial load
duke
parents:
diff changeset
253 if (map.getUpdateMap() && cb.getOopMaps() != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
254 OopMapSet.updateRegisterMap(this, cb, map, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
255 }
a61af66fc99e Initial load
duke
parents:
diff changeset
256
a61af66fc99e Initial load
duke
parents:
diff changeset
257 Address saved_fp = null;
a61af66fc99e Initial load
duke
parents:
diff changeset
258 if (VM.getVM().isClientCompiler()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
259 saved_fp = getFP().getAddressAt(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
260 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
261 int llink_offset = cb.getLinkOffset();
a61af66fc99e Initial load
duke
parents:
diff changeset
262 if (llink_offset >= 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
263 // Restore base-pointer, since next frame might be an interpreter frame.
a61af66fc99e Initial load
duke
parents:
diff changeset
264 Address fp_addr = getSP().addOffsetTo(VM.getVM().getAddressSize() * llink_offset);
a61af66fc99e Initial load
duke
parents:
diff changeset
265 saved_fp = fp_addr.getAddressAt(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
266 }
a61af66fc99e Initial load
duke
parents:
diff changeset
267 }
a61af66fc99e Initial load
duke
parents:
diff changeset
268
a61af66fc99e Initial load
duke
parents:
diff changeset
269 sender_sp = null ; // sp_addr.getAddressAt(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
270
a61af66fc99e Initial load
duke
parents:
diff changeset
271 return new IA64Frame(sender_sp, saved_fp, sender_pc);
a61af66fc99e Initial load
duke
parents:
diff changeset
272
a61af66fc99e Initial load
duke
parents:
diff changeset
273 */
a61af66fc99e Initial load
duke
parents:
diff changeset
274 }
a61af66fc99e Initial load
duke
parents:
diff changeset
275
a61af66fc99e Initial load
duke
parents:
diff changeset
276 protected boolean hasSenderPD() {
a61af66fc99e Initial load
duke
parents:
diff changeset
277 // FIXME
a61af66fc99e Initial load
duke
parents:
diff changeset
278 return true;
a61af66fc99e Initial load
duke
parents:
diff changeset
279 }
a61af66fc99e Initial load
duke
parents:
diff changeset
280
a61af66fc99e Initial load
duke
parents:
diff changeset
281 public long frameSize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
282 throw new RuntimeException("frameSize NYI");
a61af66fc99e Initial load
duke
parents:
diff changeset
283 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
284 return (getSenderSP().minus(getSP()) / VM.getVM().getAddressSize());
a61af66fc99e Initial load
duke
parents:
diff changeset
285 */
a61af66fc99e Initial load
duke
parents:
diff changeset
286 }
a61af66fc99e Initial load
duke
parents:
diff changeset
287
a61af66fc99e Initial load
duke
parents:
diff changeset
288 public Address getLink() {
a61af66fc99e Initial load
duke
parents:
diff changeset
289 throw new RuntimeException("getLink NYI");
a61af66fc99e Initial load
duke
parents:
diff changeset
290 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
291 return addressOfStackSlot(LINK_OFFSET).getAddressAt(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
292 */
a61af66fc99e Initial load
duke
parents:
diff changeset
293 }
a61af66fc99e Initial load
duke
parents:
diff changeset
294
a61af66fc99e Initial load
duke
parents:
diff changeset
295 // FIXME: not implementable yet
a61af66fc99e Initial load
duke
parents:
diff changeset
296 //inline void frame::set_link(intptr_t* addr) { *(intptr_t **)addr_at(link_offset) = addr; }
a61af66fc99e Initial load
duke
parents:
diff changeset
297
a61af66fc99e Initial load
duke
parents:
diff changeset
298 public Address getUnextendedSP() { return getSP(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
299
a61af66fc99e Initial load
duke
parents:
diff changeset
300 // Return address:
a61af66fc99e Initial load
duke
parents:
diff changeset
301 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
302 public Address getSenderPCAddr() { return addressOfStackSlot(RETURN_ADDR_OFFSET); }
a61af66fc99e Initial load
duke
parents:
diff changeset
303 */
a61af66fc99e Initial load
duke
parents:
diff changeset
304
a61af66fc99e Initial load
duke
parents:
diff changeset
305 public Address getSenderPC() { return null; }
a61af66fc99e Initial load
duke
parents:
diff changeset
306
a61af66fc99e Initial load
duke
parents:
diff changeset
307 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
308 // return address of param, zero origin index.
a61af66fc99e Initial load
duke
parents:
diff changeset
309 public Address getNativeParamAddr(int idx) {
a61af66fc99e Initial load
duke
parents:
diff changeset
310 return addressOfStackSlot(NATIVE_FRAME_INITIAL_PARAM_OFFSET + idx);
a61af66fc99e Initial load
duke
parents:
diff changeset
311 }
a61af66fc99e Initial load
duke
parents:
diff changeset
312 */
a61af66fc99e Initial load
duke
parents:
diff changeset
313
a61af66fc99e Initial load
duke
parents:
diff changeset
314 public Address getSenderSP() { return null; }
a61af66fc99e Initial load
duke
parents:
diff changeset
315
a61af66fc99e Initial load
duke
parents:
diff changeset
316 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
317 public Address compiledArgumentToLocationPD(VMReg reg, RegisterMap regMap, int argSize) {
a61af66fc99e Initial load
duke
parents:
diff changeset
318 if (VM.getVM().isCore() || VM.getVM().isClientCompiler()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
319 throw new RuntimeException("Should not reach here");
a61af66fc99e Initial load
duke
parents:
diff changeset
320 }
a61af66fc99e Initial load
duke
parents:
diff changeset
321
a61af66fc99e Initial load
duke
parents:
diff changeset
322 return oopMapRegToLocation(reg, regMap);
a61af66fc99e Initial load
duke
parents:
diff changeset
323 }
a61af66fc99e Initial load
duke
parents:
diff changeset
324
a61af66fc99e Initial load
duke
parents:
diff changeset
325 */
a61af66fc99e Initial load
duke
parents:
diff changeset
326
a61af66fc99e Initial load
duke
parents:
diff changeset
327 public Address addressOfInterpreterFrameLocals() {
a61af66fc99e Initial load
duke
parents:
diff changeset
328 if (iframe == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
329 throw new RuntimeException("Not an Interpreter frame");
a61af66fc99e Initial load
duke
parents:
diff changeset
330 }
a61af66fc99e Initial load
duke
parents:
diff changeset
331 cInterpreter fr = new cInterpreter(iframe);
a61af66fc99e Initial load
duke
parents:
diff changeset
332 return fr.locals();
a61af66fc99e Initial load
duke
parents:
diff changeset
333 }
a61af66fc99e Initial load
duke
parents:
diff changeset
334
a61af66fc99e Initial load
duke
parents:
diff changeset
335 private Address addressOfInterpreterFrameBCX() {
a61af66fc99e Initial load
duke
parents:
diff changeset
336 if (iframe == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
337 throw new RuntimeException("Not an Interpreter frame");
a61af66fc99e Initial load
duke
parents:
diff changeset
338 }
a61af66fc99e Initial load
duke
parents:
diff changeset
339 cInterpreter fr = new cInterpreter(iframe);
a61af66fc99e Initial load
duke
parents:
diff changeset
340 return fr.bcpAddr();
a61af66fc99e Initial load
duke
parents:
diff changeset
341 }
a61af66fc99e Initial load
duke
parents:
diff changeset
342
a61af66fc99e Initial load
duke
parents:
diff changeset
343 public int getInterpreterFrameBCI() {
a61af66fc99e Initial load
duke
parents:
diff changeset
344 // FIXME: this is not atomic with respect to GC and is unsuitable
a61af66fc99e Initial load
duke
parents:
diff changeset
345 // for use in a non-debugging, or reflective, system. Need to
a61af66fc99e Initial load
duke
parents:
diff changeset
346 // figure out how to express this.
a61af66fc99e Initial load
duke
parents:
diff changeset
347 Address bcp = addressOfInterpreterFrameBCX().getAddressAt(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
348 OopHandle methodHandle = addressOfInterpreterFrameMethod().getOopHandleAt(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
349 Method method = (Method) VM.getVM().getObjectHeap().newOop(methodHandle);
a61af66fc99e Initial load
duke
parents:
diff changeset
350 return bcpToBci(bcp, method);
a61af66fc99e Initial load
duke
parents:
diff changeset
351 }
a61af66fc99e Initial load
duke
parents:
diff changeset
352
a61af66fc99e Initial load
duke
parents:
diff changeset
353 public Address addressOfInterpreterFrameMDX() {
a61af66fc99e Initial load
duke
parents:
diff changeset
354 return null;
a61af66fc99e Initial load
duke
parents:
diff changeset
355 }
a61af66fc99e Initial load
duke
parents:
diff changeset
356
a61af66fc99e Initial load
duke
parents:
diff changeset
357 // FIXME
a61af66fc99e Initial load
duke
parents:
diff changeset
358 //inline int frame::interpreter_frame_monitor_size() {
a61af66fc99e Initial load
duke
parents:
diff changeset
359 // return BasicObjectLock::size();
a61af66fc99e Initial load
duke
parents:
diff changeset
360 //}
a61af66fc99e Initial load
duke
parents:
diff changeset
361
a61af66fc99e Initial load
duke
parents:
diff changeset
362 // expression stack
a61af66fc99e Initial load
duke
parents:
diff changeset
363 // (the max_stack arguments are used by the GC; see class FrameClosure)
a61af66fc99e Initial load
duke
parents:
diff changeset
364
a61af66fc99e Initial load
duke
parents:
diff changeset
365 public Address addressOfInterpreterFrameExpressionStack() {
a61af66fc99e Initial load
duke
parents:
diff changeset
366 if (iframe == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
367 throw new RuntimeException("Not an Interpreter frame");
a61af66fc99e Initial load
duke
parents:
diff changeset
368 }
a61af66fc99e Initial load
duke
parents:
diff changeset
369 cInterpreter fr = new cInterpreter(iframe);
a61af66fc99e Initial load
duke
parents:
diff changeset
370 return fr.stackBase();
a61af66fc99e Initial load
duke
parents:
diff changeset
371 }
a61af66fc99e Initial load
duke
parents:
diff changeset
372
a61af66fc99e Initial load
duke
parents:
diff changeset
373 public int getInterpreterFrameExpressionStackDirection() { return -1; }
a61af66fc99e Initial load
duke
parents:
diff changeset
374
a61af66fc99e Initial load
duke
parents:
diff changeset
375 // top of expression stack
a61af66fc99e Initial load
duke
parents:
diff changeset
376 public Address addressOfInterpreterFrameTOS() {
a61af66fc99e Initial load
duke
parents:
diff changeset
377 if (iframe == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
378 throw new RuntimeException("Not an Interpreter frame");
a61af66fc99e Initial load
duke
parents:
diff changeset
379 }
a61af66fc99e Initial load
duke
parents:
diff changeset
380 cInterpreter fr = new cInterpreter(iframe);
a61af66fc99e Initial load
duke
parents:
diff changeset
381 // tos always points to first free element in c++ interpreter not tos
a61af66fc99e Initial load
duke
parents:
diff changeset
382 return fr.stackBase().addOffsetTo(VM.getVM().getAddressSize());
a61af66fc99e Initial load
duke
parents:
diff changeset
383 }
a61af66fc99e Initial load
duke
parents:
diff changeset
384
a61af66fc99e Initial load
duke
parents:
diff changeset
385 /** Expression stack from top down */
a61af66fc99e Initial load
duke
parents:
diff changeset
386 public Address addressOfInterpreterFrameTOSAt(int slot) {
a61af66fc99e Initial load
duke
parents:
diff changeset
387 return addressOfInterpreterFrameTOS().addOffsetTo(slot * VM.getVM().getAddressSize());
a61af66fc99e Initial load
duke
parents:
diff changeset
388 }
a61af66fc99e Initial load
duke
parents:
diff changeset
389
a61af66fc99e Initial load
duke
parents:
diff changeset
390 public Address getInterpreterFrameSenderSP() {
a61af66fc99e Initial load
duke
parents:
diff changeset
391 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
392 Assert.that(isInterpretedFrame(), "interpreted frame expected");
a61af66fc99e Initial load
duke
parents:
diff changeset
393 }
a61af66fc99e Initial load
duke
parents:
diff changeset
394 throw new RuntimeException("getInterpreterFrameSenderSP NYI");
a61af66fc99e Initial load
duke
parents:
diff changeset
395 }
a61af66fc99e Initial load
duke
parents:
diff changeset
396
a61af66fc99e Initial load
duke
parents:
diff changeset
397 // Monitors
a61af66fc99e Initial load
duke
parents:
diff changeset
398 public BasicObjectLock interpreterFrameMonitorBegin() {
a61af66fc99e Initial load
duke
parents:
diff changeset
399 if (iframe == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
400 throw new RuntimeException("Not an Interpreter frame");
a61af66fc99e Initial load
duke
parents:
diff changeset
401 }
a61af66fc99e Initial load
duke
parents:
diff changeset
402 cInterpreter fr = new cInterpreter(iframe);
a61af66fc99e Initial load
duke
parents:
diff changeset
403 return new BasicObjectLock(fr.monitorBase());
a61af66fc99e Initial load
duke
parents:
diff changeset
404 }
a61af66fc99e Initial load
duke
parents:
diff changeset
405
a61af66fc99e Initial load
duke
parents:
diff changeset
406 public BasicObjectLock interpreterFrameMonitorEnd() {
a61af66fc99e Initial load
duke
parents:
diff changeset
407 if (iframe == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
408 throw new RuntimeException("Not an Interpreter frame");
a61af66fc99e Initial load
duke
parents:
diff changeset
409 }
a61af66fc99e Initial load
duke
parents:
diff changeset
410 cInterpreter fr = new cInterpreter(iframe);
a61af66fc99e Initial load
duke
parents:
diff changeset
411 // Monitors end is just above stack base (2 slots per monitor)
a61af66fc99e Initial load
duke
parents:
diff changeset
412 Address result = fr.stackBase().addOffsetTo(2 * VM.getVM().getAddressSize());
a61af66fc99e Initial load
duke
parents:
diff changeset
413 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
414 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
415 // make sure the pointer points inside the frame
a61af66fc99e Initial load
duke
parents:
diff changeset
416 Assert.that(AddressOps.gt(getFP(), result), "result must < than frame pointer");
a61af66fc99e Initial load
duke
parents:
diff changeset
417 Assert.that(AddressOps.lte(getSP(), result), "result must >= than stack pointer");
a61af66fc99e Initial load
duke
parents:
diff changeset
418 }
a61af66fc99e Initial load
duke
parents:
diff changeset
419 */
a61af66fc99e Initial load
duke
parents:
diff changeset
420 return new BasicObjectLock(result);
a61af66fc99e Initial load
duke
parents:
diff changeset
421 }
a61af66fc99e Initial load
duke
parents:
diff changeset
422
a61af66fc99e Initial load
duke
parents:
diff changeset
423 public int interpreterFrameMonitorSize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
424 return BasicObjectLock.size();
a61af66fc99e Initial load
duke
parents:
diff changeset
425 }
a61af66fc99e Initial load
duke
parents:
diff changeset
426
a61af66fc99e Initial load
duke
parents:
diff changeset
427 // Method
a61af66fc99e Initial load
duke
parents:
diff changeset
428 public Address addressOfInterpreterFrameMethod() {
a61af66fc99e Initial load
duke
parents:
diff changeset
429 if (iframe == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
430 throw new RuntimeException("Not an Interpreter frame");
a61af66fc99e Initial load
duke
parents:
diff changeset
431 }
a61af66fc99e Initial load
duke
parents:
diff changeset
432 cInterpreter fr = new cInterpreter(iframe);
a61af66fc99e Initial load
duke
parents:
diff changeset
433 return fr.methodAddr();
a61af66fc99e Initial load
duke
parents:
diff changeset
434 }
a61af66fc99e Initial load
duke
parents:
diff changeset
435
a61af66fc99e Initial load
duke
parents:
diff changeset
436 // Constant pool cache
a61af66fc99e Initial load
duke
parents:
diff changeset
437 public Address addressOfInterpreterFrameCPCache() {
a61af66fc99e Initial load
duke
parents:
diff changeset
438 if (iframe == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
439 throw new RuntimeException("Not an Interpreter frame");
a61af66fc99e Initial load
duke
parents:
diff changeset
440 }
a61af66fc99e Initial load
duke
parents:
diff changeset
441 cInterpreter fr = new cInterpreter(iframe);
a61af66fc99e Initial load
duke
parents:
diff changeset
442 return fr.constantsAddr();
a61af66fc99e Initial load
duke
parents:
diff changeset
443 }
a61af66fc99e Initial load
duke
parents:
diff changeset
444
a61af66fc99e Initial load
duke
parents:
diff changeset
445 // Entry frames
a61af66fc99e Initial load
duke
parents:
diff changeset
446 public JavaCallWrapper getEntryFrameCallWrapper() {
a61af66fc99e Initial load
duke
parents:
diff changeset
447 throw new RuntimeException("getEntryFrameCallWrapper NYI");
a61af66fc99e Initial load
duke
parents:
diff changeset
448 }
a61af66fc99e Initial load
duke
parents:
diff changeset
449
a61af66fc99e Initial load
duke
parents:
diff changeset
450 protected Address addressOfSavedOopResult() {
a61af66fc99e Initial load
duke
parents:
diff changeset
451 throw new RuntimeException("public boolean isInterpretedFrame() NYI");
a61af66fc99e Initial load
duke
parents:
diff changeset
452 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
453 // offset is 2 for compiler2 and 3 for compiler1
a61af66fc99e Initial load
duke
parents:
diff changeset
454 return getSP().addOffsetTo((VM.getVM().isClientCompiler() ? 2 : 3) *
a61af66fc99e Initial load
duke
parents:
diff changeset
455 VM.getVM().getAddressSize());
a61af66fc99e Initial load
duke
parents:
diff changeset
456 */
a61af66fc99e Initial load
duke
parents:
diff changeset
457 }
a61af66fc99e Initial load
duke
parents:
diff changeset
458
a61af66fc99e Initial load
duke
parents:
diff changeset
459 protected Address addressOfSavedReceiver() {
a61af66fc99e Initial load
duke
parents:
diff changeset
460 throw new RuntimeException("getEntryFrameCallWrapper NYI");
a61af66fc99e Initial load
duke
parents:
diff changeset
461 // return getSP().addOffsetTo(-4 * VM.getVM().getAddressSize());
a61af66fc99e Initial load
duke
parents:
diff changeset
462 }
a61af66fc99e Initial load
duke
parents:
diff changeset
463
a61af66fc99e Initial load
duke
parents:
diff changeset
464 private void dumpStack() {
a61af66fc99e Initial load
duke
parents:
diff changeset
465 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
466 if (getFP() != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
467 for (Address addr = getSP().addOffsetTo(-5 * VM.getVM().getAddressSize());
a61af66fc99e Initial load
duke
parents:
diff changeset
468 AddressOps.lte(addr, getFP().addOffsetTo(5 * VM.getVM().getAddressSize()));
a61af66fc99e Initial load
duke
parents:
diff changeset
469 addr = addr.addOffsetTo(VM.getVM().getAddressSize())) {
a61af66fc99e Initial load
duke
parents:
diff changeset
470 System.out.println(addr + ": " + addr.getAddressAt(0));
a61af66fc99e Initial load
duke
parents:
diff changeset
471 }
a61af66fc99e Initial load
duke
parents:
diff changeset
472 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
473 for (Address addr = getSP().addOffsetTo(-5 * VM.getVM().getAddressSize());
a61af66fc99e Initial load
duke
parents:
diff changeset
474 AddressOps.lte(addr, getSP().addOffsetTo(20 * VM.getVM().getAddressSize()));
a61af66fc99e Initial load
duke
parents:
diff changeset
475 addr = addr.addOffsetTo(VM.getVM().getAddressSize())) {
a61af66fc99e Initial load
duke
parents:
diff changeset
476 System.out.println(addr + ": " + addr.getAddressAt(0));
a61af66fc99e Initial load
duke
parents:
diff changeset
477 }
a61af66fc99e Initial load
duke
parents:
diff changeset
478 }
a61af66fc99e Initial load
duke
parents:
diff changeset
479 */
a61af66fc99e Initial load
duke
parents:
diff changeset
480 }
a61af66fc99e Initial load
duke
parents:
diff changeset
481 }