1.1 --- a/src/share/vm/opto/node.cpp Fri Jan 18 05:33:32 2013 -0800 1.2 +++ b/src/share/vm/opto/node.cpp Tue Jan 22 11:31:25 2013 -0800 1.3 @@ -1476,35 +1476,35 @@ 1.4 } 1.5 1.6 #ifdef ASSERT 1.7 -static void dump_orig(Node* orig) { 1.8 +static void dump_orig(Node* orig, outputStream *st) { 1.9 Compile* C = Compile::current(); 1.10 - if (NotANode(orig)) orig = NULL; 1.11 - if (orig != NULL && !C->node_arena()->contains(orig)) orig = NULL; 1.12 - if (orig == NULL) return; 1.13 - tty->print(" !orig="); 1.14 + if (NotANode(orig)) orig = NULL; 1.15 + if (orig != NULL && !C->node_arena()->contains(orig)) orig = NULL; 1.16 + if (orig == NULL) return; 1.17 + st->print(" !orig="); 1.18 Node* fast = orig->debug_orig(); // tortoise & hare algorithm to detect loops 1.19 - if (NotANode(fast)) fast = NULL; 1.20 + if (NotANode(fast)) fast = NULL; 1.21 while (orig != NULL) { 1.22 bool discon = is_disconnected(orig); // if discon, print [123] else 123 1.23 - if (discon) tty->print("["); 1.24 + if (discon) st->print("["); 1.25 if (!Compile::current()->node_arena()->contains(orig)) 1.26 - tty->print("o"); 1.27 - tty->print("%d", orig->_idx); 1.28 - if (discon) tty->print("]"); 1.29 + st->print("o"); 1.30 + st->print("%d", orig->_idx); 1.31 + if (discon) st->print("]"); 1.32 orig = orig->debug_orig(); 1.33 - if (NotANode(orig)) orig = NULL; 1.34 - if (orig != NULL && !C->node_arena()->contains(orig)) orig = NULL; 1.35 - if (orig != NULL) tty->print(","); 1.36 + if (NotANode(orig)) orig = NULL; 1.37 + if (orig != NULL && !C->node_arena()->contains(orig)) orig = NULL; 1.38 + if (orig != NULL) st->print(","); 1.39 if (fast != NULL) { 1.40 // Step fast twice for each single step of orig: 1.41 fast = fast->debug_orig(); 1.42 - if (NotANode(fast)) fast = NULL; 1.43 + if (NotANode(fast)) fast = NULL; 1.44 if (fast != NULL && fast != orig) { 1.45 fast = fast->debug_orig(); 1.46 - if (NotANode(fast)) fast = NULL; 1.47 + if (NotANode(fast)) fast = NULL; 1.48 } 1.49 if (fast == orig) { 1.50 - tty->print("..."); 1.51 + st->print("..."); 1.52 break; 1.53 } 1.54 } 1.55 @@ -1531,35 +1531,34 @@ 1.56 1.57 //------------------------------dump------------------------------------------ 1.58 // Dump a Node 1.59 -void Node::dump() const { 1.60 +void Node::dump(const char* suffix, outputStream *st) const { 1.61 Compile* C = Compile::current(); 1.62 bool is_new = C->node_arena()->contains(this); 1.63 _in_dump_cnt++; 1.64 - tty->print("%c%d\t%s\t=== ", 1.65 - is_new ? ' ' : 'o', _idx, Name()); 1.66 + st->print("%c%d\t%s\t=== ", is_new ? ' ' : 'o', _idx, Name()); 1.67 1.68 // Dump the required and precedence inputs 1.69 - dump_req(); 1.70 - dump_prec(); 1.71 + dump_req(st); 1.72 + dump_prec(st); 1.73 // Dump the outputs 1.74 - dump_out(); 1.75 + dump_out(st); 1.76 1.77 if (is_disconnected(this)) { 1.78 #ifdef ASSERT 1.79 - tty->print(" [%d]",debug_idx()); 1.80 - dump_orig(debug_orig()); 1.81 + st->print(" [%d]",debug_idx()); 1.82 + dump_orig(debug_orig(), st); 1.83 #endif 1.84 - tty->cr(); 1.85 + st->cr(); 1.86 _in_dump_cnt--; 1.87 return; // don't process dead nodes 1.88 } 1.89 1.90 // Dump node-specific info 1.91 - dump_spec(tty); 1.92 + dump_spec(st); 1.93 #ifdef ASSERT 1.94 // Dump the non-reset _debug_idx 1.95 - if( Verbose && WizardMode ) { 1.96 - tty->print(" [%d]",debug_idx()); 1.97 + if (Verbose && WizardMode) { 1.98 + st->print(" [%d]",debug_idx()); 1.99 } 1.100 #endif 1.101 1.102 @@ -1569,88 +1568,88 @@ 1.103 const TypeInstPtr *toop = t->isa_instptr(); 1.104 const TypeKlassPtr *tkls = t->isa_klassptr(); 1.105 ciKlass* klass = toop ? toop->klass() : (tkls ? tkls->klass() : NULL ); 1.106 - if( klass && klass->is_loaded() && klass->is_interface() ) { 1.107 - tty->print(" Interface:"); 1.108 - } else if( toop ) { 1.109 - tty->print(" Oop:"); 1.110 - } else if( tkls ) { 1.111 - tty->print(" Klass:"); 1.112 + if (klass && klass->is_loaded() && klass->is_interface()) { 1.113 + st->print(" Interface:"); 1.114 + } else if (toop) { 1.115 + st->print(" Oop:"); 1.116 + } else if (tkls) { 1.117 + st->print(" Klass:"); 1.118 } 1.119 - t->dump(); 1.120 - } else if( t == Type::MEMORY ) { 1.121 - tty->print(" Memory:"); 1.122 - MemNode::dump_adr_type(this, adr_type(), tty); 1.123 - } else if( Verbose || WizardMode ) { 1.124 - tty->print(" Type:"); 1.125 - if( t ) { 1.126 - t->dump(); 1.127 + t->dump_on(st); 1.128 + } else if (t == Type::MEMORY) { 1.129 + st->print(" Memory:"); 1.130 + MemNode::dump_adr_type(this, adr_type(), st); 1.131 + } else if (Verbose || WizardMode) { 1.132 + st->print(" Type:"); 1.133 + if (t) { 1.134 + t->dump_on(st); 1.135 } else { 1.136 - tty->print("no type"); 1.137 + st->print("no type"); 1.138 } 1.139 } else if (t->isa_vect() && this->is_MachSpillCopy()) { 1.140 // Dump MachSpillcopy vector type. 1.141 - t->dump(); 1.142 + t->dump_on(st); 1.143 } 1.144 if (is_new) { 1.145 - debug_only(dump_orig(debug_orig())); 1.146 + debug_only(dump_orig(debug_orig(), st)); 1.147 Node_Notes* nn = C->node_notes_at(_idx); 1.148 if (nn != NULL && !nn->is_clear()) { 1.149 if (nn->jvms() != NULL) { 1.150 - tty->print(" !jvms:"); 1.151 - nn->jvms()->dump_spec(tty); 1.152 + st->print(" !jvms:"); 1.153 + nn->jvms()->dump_spec(st); 1.154 } 1.155 } 1.156 } 1.157 - tty->cr(); 1.158 + if (suffix) st->print(suffix); 1.159 _in_dump_cnt--; 1.160 } 1.161 1.162 //------------------------------dump_req-------------------------------------- 1.163 -void Node::dump_req() const { 1.164 +void Node::dump_req(outputStream *st) const { 1.165 // Dump the required input edges 1.166 for (uint i = 0; i < req(); i++) { // For all required inputs 1.167 Node* d = in(i); 1.168 if (d == NULL) { 1.169 - tty->print("_ "); 1.170 + st->print("_ "); 1.171 } else if (NotANode(d)) { 1.172 - tty->print("NotANode "); // uninitialized, sentinel, garbage, etc. 1.173 + st->print("NotANode "); // uninitialized, sentinel, garbage, etc. 1.174 } else { 1.175 - tty->print("%c%d ", Compile::current()->node_arena()->contains(d) ? ' ' : 'o', d->_idx); 1.176 + st->print("%c%d ", Compile::current()->node_arena()->contains(d) ? ' ' : 'o', d->_idx); 1.177 } 1.178 } 1.179 } 1.180 1.181 1.182 //------------------------------dump_prec------------------------------------- 1.183 -void Node::dump_prec() const { 1.184 +void Node::dump_prec(outputStream *st) const { 1.185 // Dump the precedence edges 1.186 int any_prec = 0; 1.187 for (uint i = req(); i < len(); i++) { // For all precedence inputs 1.188 Node* p = in(i); 1.189 if (p != NULL) { 1.190 - if( !any_prec++ ) tty->print(" |"); 1.191 - if (NotANode(p)) { tty->print("NotANode "); continue; } 1.192 - tty->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx); 1.193 + if (!any_prec++) st->print(" |"); 1.194 + if (NotANode(p)) { st->print("NotANode "); continue; } 1.195 + st->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx); 1.196 } 1.197 } 1.198 } 1.199 1.200 //------------------------------dump_out-------------------------------------- 1.201 -void Node::dump_out() const { 1.202 +void Node::dump_out(outputStream *st) const { 1.203 // Delimit the output edges 1.204 - tty->print(" [["); 1.205 + st->print(" [["); 1.206 // Dump the output edges 1.207 for (uint i = 0; i < _outcnt; i++) { // For all outputs 1.208 Node* u = _out[i]; 1.209 if (u == NULL) { 1.210 - tty->print("_ "); 1.211 + st->print("_ "); 1.212 } else if (NotANode(u)) { 1.213 - tty->print("NotANode "); 1.214 + st->print("NotANode "); 1.215 } else { 1.216 - tty->print("%c%d ", Compile::current()->node_arena()->contains(u) ? ' ' : 'o', u->_idx); 1.217 + st->print("%c%d ", Compile::current()->node_arena()->contains(u) ? ' ' : 'o', u->_idx); 1.218 } 1.219 } 1.220 - tty->print("]] "); 1.221 + st->print("]] "); 1.222 } 1.223 1.224 //------------------------------dump_nodes-------------------------------------