comparison src/share/vm/opto/callnode.cpp @ 7636:a7114d3d712e

8005055: pass outputStream to more opto debug routines Summary: pass the output stream to node->dump() and everything reachable from there Reviewed-by: kvn Contributed-by: goetz.lindenmaier@sap.com
author kvn
date Tue, 22 Jan 2013 11:31:25 -0800
parents d092d1b31229
children 6f3fd5150b67
comparison
equal deleted inserted replaced
7619:46e60405583b 7636:a7114d3d712e
163 return 0; 163 return 0;
164 } 164 }
165 165
166 166
167 #ifndef PRODUCT 167 #ifndef PRODUCT
168 void ReturnNode::dump_req() const { 168 void ReturnNode::dump_req(outputStream *st) const {
169 // Dump the required inputs, enclosed in '(' and ')' 169 // Dump the required inputs, enclosed in '(' and ')'
170 uint i; // Exit value of loop 170 uint i; // Exit value of loop
171 for( i=0; i<req(); i++ ) { // For all required inputs 171 for (i = 0; i < req(); i++) { // For all required inputs
172 if( i == TypeFunc::Parms ) tty->print("returns"); 172 if (i == TypeFunc::Parms) st->print("returns");
173 if( in(i) ) tty->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx); 173 if (in(i)) st->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx);
174 else tty->print("_ "); 174 else st->print("_ ");
175 } 175 }
176 } 176 }
177 #endif 177 #endif
178 178
179 //============================================================================= 179 //=============================================================================
206 uint RethrowNode::match_edge(uint idx) const { 206 uint RethrowNode::match_edge(uint idx) const {
207 return 0; 207 return 0;
208 } 208 }
209 209
210 #ifndef PRODUCT 210 #ifndef PRODUCT
211 void RethrowNode::dump_req() const { 211 void RethrowNode::dump_req(outputStream *st) const {
212 // Dump the required inputs, enclosed in '(' and ')' 212 // Dump the required inputs, enclosed in '(' and ')'
213 uint i; // Exit value of loop 213 uint i; // Exit value of loop
214 for( i=0; i<req(); i++ ) { // For all required inputs 214 for (i = 0; i < req(); i++) { // For all required inputs
215 if( i == TypeFunc::Parms ) tty->print("exception"); 215 if (i == TypeFunc::Parms) st->print("exception");
216 if( in(i) ) tty->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx); 216 if (in(i)) st->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx);
217 else tty->print("_ "); 217 else st->print("_ ");
218 } 218 }
219 } 219 }
220 #endif 220 #endif
221 221
222 //============================================================================= 222 //=============================================================================
328 int sco_n = scobjs->find(spobj); 328 int sco_n = scobjs->find(spobj);
329 assert(sco_n >= 0, ""); 329 assert(sco_n >= 0, "");
330 st->print(" %s%d]=#ScObj" INT32_FORMAT, msg, i, sco_n); 330 st->print(" %s%d]=#ScObj" INT32_FORMAT, msg, i, sco_n);
331 return; 331 return;
332 } 332 }
333 if( OptoReg::is_valid(regalloc->get_reg_first(n))) { // Check for undefined 333 if (regalloc->node_regs_max_index() > 0 &&
334 OptoReg::is_valid(regalloc->get_reg_first(n))) { // Check for undefined
334 char buf[50]; 335 char buf[50];
335 regalloc->dump_register(n,buf); 336 regalloc->dump_register(n,buf);
336 st->print(" %s%d]=%s",msg,i,buf); 337 st->print(" %s%d]=%s",msg,i,buf);
337 } else { // No register, but might be constant 338 } else { // No register, but might be constant
338 const Type *t = n->bottom_type(); 339 const Type *t = n->bottom_type();
379 } 380 }
380 381
381 //------------------------------format----------------------------------------- 382 //------------------------------format-----------------------------------------
382 void JVMState::format(PhaseRegAlloc *regalloc, const Node *n, outputStream* st) const { 383 void JVMState::format(PhaseRegAlloc *regalloc, const Node *n, outputStream* st) const {
383 st->print(" #"); 384 st->print(" #");
384 if( _method ) { 385 if (_method) {
385 _method->print_short_name(st); 386 _method->print_short_name(st);
386 st->print(" @ bci:%d ",_bci); 387 st->print(" @ bci:%d ",_bci);
387 } else { 388 } else {
388 st->print_cr(" runtime stub "); 389 st->print_cr(" runtime stub ");
389 return; 390 return;
391 if (n->is_MachSafePoint()) { 392 if (n->is_MachSafePoint()) {
392 GrowableArray<SafePointScalarObjectNode*> scobjs; 393 GrowableArray<SafePointScalarObjectNode*> scobjs;
393 MachSafePointNode *mcall = n->as_MachSafePoint(); 394 MachSafePointNode *mcall = n->as_MachSafePoint();
394 uint i; 395 uint i;
395 // Print locals 396 // Print locals
396 for( i = 0; i < (uint)loc_size(); i++ ) 397 for (i = 0; i < (uint)loc_size(); i++)
397 format_helper( regalloc, st, mcall->local(this, i), "L[", i, &scobjs ); 398 format_helper(regalloc, st, mcall->local(this, i), "L[", i, &scobjs);
398 // Print stack 399 // Print stack
399 for (i = 0; i < (uint)stk_size(); i++) { 400 for (i = 0; i < (uint)stk_size(); i++) {
400 if ((uint)(_stkoff + i) >= mcall->len()) 401 if ((uint)(_stkoff + i) >= mcall->len())
401 st->print(" oob "); 402 st->print(" oob ");
402 else 403 else
403 format_helper( regalloc, st, mcall->stack(this, i), "STK[", i, &scobjs ); 404 format_helper(regalloc, st, mcall->stack(this, i), "STK[", i, &scobjs);
404 } 405 }
405 for (i = 0; (int)i < nof_monitors(); i++) { 406 for (i = 0; (int)i < nof_monitors(); i++) {
406 Node *box = mcall->monitor_box(this, i); 407 Node *box = mcall->monitor_box(this, i);
407 Node *obj = mcall->monitor_obj(this, i); 408 Node *obj = mcall->monitor_obj(this, i);
408 if ( OptoReg::is_valid(regalloc->get_reg_first(box)) ) { 409 if (regalloc->node_regs_max_index() > 0 &&
410 OptoReg::is_valid(regalloc->get_reg_first(box))) {
409 box = BoxLockNode::box_node(box); 411 box = BoxLockNode::box_node(box);
410 format_helper( regalloc, st, box, "MON-BOX[", i, &scobjs ); 412 format_helper(regalloc, st, box, "MON-BOX[", i, &scobjs);
411 } else { 413 } else {
412 OptoReg::Name box_reg = BoxLockNode::reg(box); 414 OptoReg::Name box_reg = BoxLockNode::reg(box);
413 st->print(" MON-BOX%d=%s+%d", 415 st->print(" MON-BOX%d=%s+%d",
414 i, 416 i,
415 OptoReg::regname(OptoReg::c_frame_pointer), 417 OptoReg::regname(OptoReg::c_frame_pointer),
418 const char* obj_msg = "MON-OBJ["; 420 const char* obj_msg = "MON-OBJ[";
419 if (EliminateLocks) { 421 if (EliminateLocks) {
420 if (BoxLockNode::box_node(box)->is_eliminated()) 422 if (BoxLockNode::box_node(box)->is_eliminated())
421 obj_msg = "MON-OBJ(LOCK ELIMINATED)["; 423 obj_msg = "MON-OBJ(LOCK ELIMINATED)[";
422 } 424 }
423 format_helper( regalloc, st, obj, obj_msg, i, &scobjs ); 425 format_helper(regalloc, st, obj, obj_msg, i, &scobjs);
424 } 426 }
425 427
426 for (i = 0; i < (uint)scobjs.length(); i++) { 428 for (i = 0; i < (uint)scobjs.length(); i++) {
427 // Scalar replaced objects. 429 // Scalar replaced objects.
428 st->print_cr(""); 430 st->print_cr("");
461 ciField* cifield; 463 ciField* cifield;
462 if (iklass != NULL) { 464 if (iklass != NULL) {
463 st->print(" ["); 465 st->print(" [");
464 cifield = iklass->nonstatic_field_at(0); 466 cifield = iklass->nonstatic_field_at(0);
465 cifield->print_name_on(st); 467 cifield->print_name_on(st);
466 format_helper( regalloc, st, fld_node, ":", 0, &scobjs ); 468 format_helper(regalloc, st, fld_node, ":", 0, &scobjs);
467 } else { 469 } else {
468 format_helper( regalloc, st, fld_node, "[", 0, &scobjs ); 470 format_helper(regalloc, st, fld_node, "[", 0, &scobjs);
469 } 471 }
470 for (uint j = 1; j < nf; j++) { 472 for (uint j = 1; j < nf; j++) {
471 fld_node = mcall->in(first_ind+j); 473 fld_node = mcall->in(first_ind+j);
472 if (iklass != NULL) { 474 if (iklass != NULL) {
473 st->print(", ["); 475 st->print(", [");
474 cifield = iklass->nonstatic_field_at(j); 476 cifield = iklass->nonstatic_field_at(j);
475 cifield->print_name_on(st); 477 cifield->print_name_on(st);
476 format_helper( regalloc, st, fld_node, ":", j, &scobjs ); 478 format_helper(regalloc, st, fld_node, ":", j, &scobjs);
477 } else { 479 } else {
478 format_helper( regalloc, st, fld_node, ", [", j, &scobjs ); 480 format_helper(regalloc, st, fld_node, ", [", j, &scobjs);
479 } 481 }
480 } 482 }
481 } 483 }
482 st->print(" }"); 484 st->print(" }");
483 } 485 }
484 } 486 }
485 st->print_cr(""); 487 st->print_cr("");
486 if (caller() != NULL) caller()->format(regalloc, n, st); 488 if (caller() != NULL) caller()->format(regalloc, n, st);
487 } 489 }
488 490
489 491
490 void JVMState::dump_spec(outputStream *st) const { 492 void JVMState::dump_spec(outputStream *st) const {
491 if (_method != NULL) { 493 if (_method != NULL) {
584 586
585 //============================================================================= 587 //=============================================================================
586 uint CallNode::cmp( const Node &n ) const 588 uint CallNode::cmp( const Node &n ) const
587 { return _tf == ((CallNode&)n)._tf && _jvms == ((CallNode&)n)._jvms; } 589 { return _tf == ((CallNode&)n)._tf && _jvms == ((CallNode&)n)._jvms; }
588 #ifndef PRODUCT 590 #ifndef PRODUCT
589 void CallNode::dump_req() const { 591 void CallNode::dump_req(outputStream *st) const {
590 // Dump the required inputs, enclosed in '(' and ')' 592 // Dump the required inputs, enclosed in '(' and ')'
591 uint i; // Exit value of loop 593 uint i; // Exit value of loop
592 for( i=0; i<req(); i++ ) { // For all required inputs 594 for (i = 0; i < req(); i++) { // For all required inputs
593 if( i == TypeFunc::Parms ) tty->print("("); 595 if (i == TypeFunc::Parms) st->print("(");
594 if( in(i) ) tty->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx); 596 if (in(i)) st->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx);
595 else tty->print("_ "); 597 else st->print("_ ");
596 } 598 }
597 tty->print(")"); 599 st->print(")");
598 } 600 }
599 601
600 void CallNode::dump_spec(outputStream *st) const { 602 void CallNode::dump_spec(outputStream *st) const {
601 st->print(" "); 603 st->print(" ");
602 tf()->dump_on(st); 604 tf()->dump_on(st);