115 } |
116 } |
116 } |
117 } |
117 } |
118 } |
118 } |
119 } |
119 |
120 |
120 public X86Frame(Address raw_sp, Address raw_fp, Address pc) { |
121 private void initFrame(Address raw_sp, Address raw_fp, Address pc, Address raw_unextendedSp, Address live_bcp) { |
121 this.raw_sp = raw_sp; |
122 this.raw_sp = raw_sp; |
122 this.raw_unextendedSP = raw_sp; |
|
123 this.raw_fp = raw_fp; |
123 this.raw_fp = raw_fp; |
124 this.pc = pc; |
124 if (raw_unextendedSp == null) { |
|
125 this.raw_unextendedSP = raw_sp; |
|
126 } else { |
|
127 this.raw_unextendedSP = raw_unextendedSp; |
|
128 } |
|
129 if (pc == null) { |
|
130 this.pc = raw_sp.getAddressAt(-1 * VM.getVM().getAddressSize()); |
|
131 } else { |
|
132 this.pc = pc; |
|
133 } |
|
134 this.live_bcp = live_bcp; |
125 adjustUnextendedSP(); |
135 adjustUnextendedSP(); |
126 |
136 |
127 // Frame must be fully constructed before this call |
137 // Frame must be fully constructed before this call |
128 adjustForDeopt(); |
138 adjustForDeopt(); |
|
139 } |
|
140 |
|
141 |
|
142 public X86Frame(Address raw_sp, Address raw_fp, Address pc) { |
|
143 initFrame(raw_sp, raw_fp, pc, null, null); |
129 |
144 |
130 if (DEBUG) { |
145 if (DEBUG) { |
131 System.out.println("X86Frame(sp, fp, pc): " + this); |
146 System.out.println("X86Frame(sp, fp, pc): " + this); |
132 dumpStack(); |
147 dumpStack(); |
133 } |
148 } |
134 } |
149 } |
135 |
150 |
136 public X86Frame(Address raw_sp, Address raw_fp) { |
151 public X86Frame(Address raw_sp, Address raw_fp) { |
137 this.raw_sp = raw_sp; |
152 initFrame(raw_sp, raw_fp, null, null, null); |
138 this.raw_unextendedSP = raw_sp; |
|
139 this.raw_fp = raw_fp; |
|
140 this.pc = raw_sp.getAddressAt(-1 * VM.getVM().getAddressSize()); |
|
141 adjustUnextendedSP(); |
|
142 |
|
143 // Frame must be fully constructed before this call |
|
144 adjustForDeopt(); |
|
145 |
153 |
146 if (DEBUG) { |
154 if (DEBUG) { |
147 System.out.println("X86Frame(sp, fp): " + this); |
155 System.out.println("X86Frame(sp, fp): " + this); |
148 dumpStack(); |
156 dumpStack(); |
149 } |
157 } |
150 } |
158 } |
151 |
159 |
152 public X86Frame(Address raw_sp, Address raw_unextendedSp, Address raw_fp, Address pc) { |
160 public X86Frame(Address raw_sp, Address raw_unextendedSp, Address raw_fp, Address pc) { |
153 this.raw_sp = raw_sp; |
161 initFrame(raw_sp, raw_fp, pc, raw_unextendedSp, null); |
154 this.raw_unextendedSP = raw_unextendedSp; |
|
155 this.raw_fp = raw_fp; |
|
156 this.pc = pc; |
|
157 adjustUnextendedSP(); |
|
158 |
|
159 // Frame must be fully constructed before this call |
|
160 adjustForDeopt(); |
|
161 |
162 |
162 if (DEBUG) { |
163 if (DEBUG) { |
163 System.out.println("X86Frame(sp, unextendedSP, fp, pc): " + this); |
164 System.out.println("X86Frame(sp, unextendedSP, fp, pc): " + this); |
164 dumpStack(); |
165 dumpStack(); |
165 } |
166 } |
166 |
167 } |
|
168 |
|
169 public X86Frame(Address raw_sp, Address raw_fp, Address pc, Address raw_unextendedSp, Address live_bcp) { |
|
170 initFrame(raw_sp, raw_fp, pc, raw_unextendedSp, live_bcp); |
|
171 |
|
172 if (DEBUG) { |
|
173 System.out.println("X86Frame(sp, fp, pc, unextendedSP, live_bcp): " + this); |
|
174 dumpStack(); |
|
175 } |
167 } |
176 } |
168 |
177 |
169 public Object clone() { |
178 public Object clone() { |
170 X86Frame frame = new X86Frame(); |
179 X86Frame frame = new X86Frame(); |
171 frame.raw_sp = raw_sp; |
180 frame.raw_sp = raw_sp; |
172 frame.raw_unextendedSP = raw_unextendedSP; |
181 frame.raw_unextendedSP = raw_unextendedSP; |
173 frame.raw_fp = raw_fp; |
182 frame.raw_fp = raw_fp; |
174 frame.pc = pc; |
183 frame.pc = pc; |
175 frame.deoptimized = deoptimized; |
184 frame.deoptimized = deoptimized; |
|
185 frame.live_bcp = live_bcp; |
176 return frame; |
186 return frame; |
177 } |
187 } |
178 |
188 |
179 public boolean equals(Object arg) { |
189 public boolean equals(Object arg) { |
180 if (arg == null) { |
190 if (arg == null) { |
431 public int getInterpreterFrameBCI() { |
441 public int getInterpreterFrameBCI() { |
432 // FIXME: this is not atomic with respect to GC and is unsuitable |
442 // FIXME: this is not atomic with respect to GC and is unsuitable |
433 // for use in a non-debugging, or reflective, system. Need to |
443 // for use in a non-debugging, or reflective, system. Need to |
434 // figure out how to express this. |
444 // figure out how to express this. |
435 Address bcp = addressOfInterpreterFrameBCX().getAddressAt(0); |
445 Address bcp = addressOfInterpreterFrameBCX().getAddressAt(0); |
|
446 |
|
447 // If we are in the top level frame then the bcp may have been set for us. If so then let it |
|
448 // take priority. If we are in a top level interpreter frame, the bcp is live in R13 (on x86) |
|
449 // and not saved in the BCX stack slot. |
|
450 if (live_bcp != null) { |
|
451 bcp = live_bcp; |
|
452 } |
|
453 |
436 Address methodHandle = addressOfInterpreterFrameMethod().getAddressAt(0); |
454 Address methodHandle = addressOfInterpreterFrameMethod().getAddressAt(0); |
437 Method method = (Method)Metadata.instantiateWrapperFor(methodHandle); |
455 Method method = (Method)Metadata.instantiateWrapperFor(methodHandle); |
438 return bcpToBci(bcp, method); |
456 return bcpToBci(bcp, method); |
439 } |
457 } |
440 |
458 |