206 }
207 }
208 #endif
209
210 //=============================================================================
211 // Do we Match on this edge index or not? Match only target address & method
212 uint TailCallNode::match_edge(uint idx) const {
213 return TypeFunc::Parms <= idx && idx <= TypeFunc::Parms+1;
214 }
215
216 //=============================================================================
217 // Do we Match on this edge index or not? Match only target address & oop
218 uint TailJumpNode::match_edge(uint idx) const {
219 return TypeFunc::Parms <= idx && idx <= TypeFunc::Parms+1;
220 }
221
222 //=============================================================================
223 JVMState::JVMState(ciMethod* method, JVMState* caller) {
224 assert(method != NULL, "must be valid call site");
225 _method = method;
226 debug_only(_bci = -99); // random garbage value
227 debug_only(_map = (SafePointNode*)-1);
228 _caller = caller;
229 _depth = 1 + (caller == NULL ? 0 : caller->depth());
230 _locoff = TypeFunc::Parms;
231 _stkoff = _locoff + _method->max_locals();
232 _monoff = _stkoff + _method->max_stack();
233 _scloff = _monoff;
234 _endoff = _monoff;
235 _sp = 0;
236 }
237 JVMState::JVMState(int stack_size) {
238 _method = NULL;
239 _bci = InvocationEntryBci;
240 debug_only(_map = (SafePointNode*)-1);
241 _caller = NULL;
242 _depth = 1;
243 _locoff = TypeFunc::Parms;
244 _stkoff = _locoff;
245 _monoff = _stkoff + stack_size;
246 _scloff = _monoff;
247 _endoff = _monoff;
248 _sp = 0;
249 }
250
251 //--------------------------------of_depth-------------------------------------
252 JVMState* JVMState::of_depth(int d) const {
253 const JVMState* jvmp = this;
254 assert(0 < d && (uint)d <= depth(), "oob");
255 for (int skip = depth() - d; skip > 0; skip--) {
256 jvmp = jvmp->caller();
257 }
258 assert(jvmp->depth() == (uint)d, "found the right one");
259 return (JVMState*)jvmp;
260 }
261
262 //-----------------------------same_calls_as-----------------------------------
263 bool JVMState::same_calls_as(const JVMState* that) const {
264 if (this == that) return true;
265 if (this->depth() != that->depth()) return false;
266 const JVMState* p = this;
267 const JVMState* q = that;
268 for (;;) {
269 if (p->_method != q->_method) return false;
270 if (p->_method == NULL) return true; // bci is irrelevant
271 if (p->_bci != q->_bci) return false;
272 p = p->caller();
273 q = q->caller();
274 if (p == q) return true;
275 assert(p != NULL && q != NULL, "depth check ensures we don't run off end");
276 }
277 }
278
279 //------------------------------debug_start------------------------------------
280 uint JVMState::debug_start() const {
281 debug_only(JVMState* jvmroot = of_depth(1));
282 assert(jvmroot->locoff() <= this->locoff(), "youngest JVMState must be last");
283 return of_depth(1)->locoff();
284 }
285
286 //-------------------------------debug_end-------------------------------------
287 uint JVMState::debug_end() const {
288 debug_only(JVMState* jvmroot = of_depth(1));
289 assert(jvmroot->endoff() <= this->endoff(), "youngest JVMState must be last");
290 return endoff();
291 }
520 st->print(" bc: ");
521 _method->print_codes_on(bci(), bci()+1, st);
522 }
523 }
524 if (caller() != NULL) {
525 caller()->dump_on(st);
526 }
527 }
528
529 // Extra way to dump a jvms from the debugger,
530 // to avoid a bug with C++ member function calls.
531 void dump_jvms(JVMState* jvms) {
532 jvms->dump();
533 }
534 #endif
535
536 //--------------------------clone_shallow--------------------------------------
537 JVMState* JVMState::clone_shallow(Compile* C) const {
538 JVMState* n = has_method() ? new (C) JVMState(_method, _caller) : new (C) JVMState(0);
539 n->set_bci(_bci);
540 n->set_locoff(_locoff);
541 n->set_stkoff(_stkoff);
542 n->set_monoff(_monoff);
543 n->set_scloff(_scloff);
544 n->set_endoff(_endoff);
545 n->set_sp(_sp);
546 n->set_map(_map);
547 return n;
548 }
549
550 //---------------------------clone_deep----------------------------------------
551 JVMState* JVMState::clone_deep(Compile* C) const {
552 JVMState* n = clone_shallow(C);
553 for (JVMState* p = n; p->_caller != NULL; p = p->_caller) {
554 p->_caller = p->_caller->clone_shallow(C);
555 }
556 assert(n->depth() == depth(), "sanity");
557 assert(n->debug_depth() == debug_depth(), "sanity");
558 return n;
559 }
|
206 }
207 }
208 #endif
209
210 //=============================================================================
211 // Do we Match on this edge index or not? Match only target address & method
212 uint TailCallNode::match_edge(uint idx) const {
213 return TypeFunc::Parms <= idx && idx <= TypeFunc::Parms+1;
214 }
215
216 //=============================================================================
217 // Do we Match on this edge index or not? Match only target address & oop
218 uint TailJumpNode::match_edge(uint idx) const {
219 return TypeFunc::Parms <= idx && idx <= TypeFunc::Parms+1;
220 }
221
222 //=============================================================================
223 JVMState::JVMState(ciMethod* method, JVMState* caller) {
224 assert(method != NULL, "must be valid call site");
225 _method = method;
226 _restart = false;
227 debug_only(_bci = -99); // random garbage value
228 debug_only(_map = (SafePointNode*)-1);
229 _caller = caller;
230 _depth = 1 + (caller == NULL ? 0 : caller->depth());
231 _locoff = TypeFunc::Parms;
232 _stkoff = _locoff + _method->max_locals();
233 _monoff = _stkoff + _method->max_stack();
234 _scloff = _monoff;
235 _endoff = _monoff;
236 _sp = 0;
237 }
238 JVMState::JVMState(int stack_size) {
239 _method = NULL;
240 _bci = InvocationEntryBci;
241 _restart = false;
242 debug_only(_map = (SafePointNode*)-1);
243 _caller = NULL;
244 _depth = 1;
245 _locoff = TypeFunc::Parms;
246 _stkoff = _locoff;
247 _monoff = _stkoff + stack_size;
248 _scloff = _monoff;
249 _endoff = _monoff;
250 _sp = 0;
251 }
252
253 //--------------------------------of_depth-------------------------------------
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->_restart != q->_restart) 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 }
523 st->print(" bc: ");
524 _method->print_codes_on(bci(), bci()+1, st);
525 }
526 }
527 if (caller() != NULL) {
528 caller()->dump_on(st);
529 }
530 }
531
532 // Extra way to dump a jvms from the debugger,
533 // to avoid a bug with C++ member function calls.
534 void dump_jvms(JVMState* jvms) {
535 jvms->dump();
536 }
537 #endif
538
539 //--------------------------clone_shallow--------------------------------------
540 JVMState* JVMState::clone_shallow(Compile* C) const {
541 JVMState* n = has_method() ? new (C) JVMState(_method, _caller) : new (C) JVMState(0);
542 n->set_bci(_bci);
543 n->set_restart(_restart);
544 n->set_locoff(_locoff);
545 n->set_stkoff(_stkoff);
546 n->set_monoff(_monoff);
547 n->set_scloff(_scloff);
548 n->set_endoff(_endoff);
549 n->set_sp(_sp);
550 n->set_map(_map);
551 return n;
552 }
553
554 //---------------------------clone_deep----------------------------------------
555 JVMState* JVMState::clone_deep(Compile* C) const {
556 JVMState* n = clone_shallow(C);
557 for (JVMState* p = n; p->_caller != NULL; p = p->_caller) {
558 p->_caller = p->_caller->clone_shallow(C);
559 }
560 assert(n->depth() == depth(), "sanity");
561 assert(n->debug_depth() == debug_depth(), "sanity");
562 return n;
563 }
|