254 JVMState* JVMState::of_depth(int d) const {
255 const JVMState* jvmp = this;
256 assert(0 < d && (uint)d <= depth(), "oob");
257 for (int skip = depth() - d; skip > 0; skip--) {
258 jvmp = jvmp->caller();
259 }
260 assert(jvmp->depth() == (uint)d, "found the right one");
261 return (JVMState*)jvmp;
262 }
263
264 //-----------------------------same_calls_as-----------------------------------
265 bool JVMState::same_calls_as(const JVMState* that) const {
266 if (this == that) return true;
267 if (this->depth() != that->depth()) return false;
268 const JVMState* p = this;
269 const JVMState* q = that;
270 for (;;) {
271 if (p->_method != q->_method) return false;
272 if (p->_method == NULL) return true; // bci is irrelevant
273 if (p->_bci != q->_bci) return false;
274 if (p->_reexecute != q->_reexecute) return false;
275 p = p->caller();
276 q = q->caller();
277 if (p == q) return true;
278 assert(p != NULL && q != NULL, "depth check ensures we don't run off end");
279 }
280 }
281
282 //------------------------------debug_start------------------------------------
283 uint JVMState::debug_start() const {
284 debug_only(JVMState* jvmroot = of_depth(1));
285 assert(jvmroot->locoff() <= this->locoff(), "youngest JVMState must be last");
286 return of_depth(1)->locoff();
287 }
288
289 //-------------------------------debug_end-------------------------------------
290 uint JVMState::debug_end() const {
291 debug_only(JVMState* jvmroot = of_depth(1));
292 assert(jvmroot->endoff() <= this->endoff(), "youngest JVMState must be last");
293 return endoff();
294 }
|
254 JVMState* JVMState::of_depth(int d) const {
255 const JVMState* jvmp = this;
256 assert(0 < d && (uint)d <= depth(), "oob");
257 for (int skip = depth() - d; skip > 0; skip--) {
258 jvmp = jvmp->caller();
259 }
260 assert(jvmp->depth() == (uint)d, "found the right one");
261 return (JVMState*)jvmp;
262 }
263
264 //-----------------------------same_calls_as-----------------------------------
265 bool JVMState::same_calls_as(const JVMState* that) const {
266 if (this == that) return true;
267 if (this->depth() != that->depth()) return false;
268 const JVMState* p = this;
269 const JVMState* q = that;
270 for (;;) {
271 if (p->_method != q->_method) return false;
272 if (p->_method == NULL) return true; // bci is irrelevant
273 if (p->_bci != q->_bci) return false;
274 p = p->caller();
275 q = q->caller();
276 if (p == q) return true;
277 assert(p != NULL && q != NULL, "depth check ensures we don't run off end");
278 }
279 }
280
281 //------------------------------debug_start------------------------------------
282 uint JVMState::debug_start() const {
283 debug_only(JVMState* jvmroot = of_depth(1));
284 assert(jvmroot->locoff() <= this->locoff(), "youngest JVMState must be last");
285 return of_depth(1)->locoff();
286 }
287
288 //-------------------------------debug_end-------------------------------------
289 uint JVMState::debug_end() const {
290 debug_only(JVMState* jvmroot = of_depth(1));
291 assert(jvmroot->endoff() <= this->endoff(), "youngest JVMState must be last");
292 return endoff();
293 }
|