< prev index next >

src/hotspot/share/opto/idealGraphPrinter.cpp

Print this page
rev 54995 : 8224675: Late GC barrier insertion for ZGC
Reviewed-by:


 333   }
 334 
 335   tail(PROPERTIES_ELEMENT);
 336 
 337   _should_send_method = true;
 338   this->_current_method = method;
 339 
 340   _xml->flush();
 341 }
 342 
 343 // Has to be called whenever a method has finished compilation
 344 void IdealGraphPrinter::end_method() {
 345 
 346   nmethod* method = (nmethod*)this->_current_method->code();
 347 
 348   tail(GROUP_ELEMENT);
 349   _current_method = NULL;
 350   _xml->flush();
 351 }
 352 
 353 // Print indent
 354 void IdealGraphPrinter::print_indent() {
 355   tty->print_cr("printing indent %d", _depth);
 356   for (int i = 0; i < _depth; i++) {
 357     _xml->print("%s", INDENT);
 358   }
 359 }
 360 
 361 bool IdealGraphPrinter::traverse_outs() {
 362   return _traverse_outs;
 363 }
 364 
 365 void IdealGraphPrinter::set_traverse_outs(bool b) {
 366   _traverse_outs = b;
 367 }
 368 
 369 void IdealGraphPrinter::visit_node(Node *n, bool edges, VectorSet* temp_set) {
 370 
 371   if (edges) {
 372 
 373     // Output edge
 374     node_idx_t dest_id = n->_idx;
 375     for ( uint i = 0; i < n->len(); i++ ) {
 376       if ( n->in(i) ) {
 377         Node *source = n->in(i);
 378         begin_elem(EDGE_ELEMENT);
 379         print_attr(FROM_PROPERTY, source->_idx);
 380         print_attr(TO_PROPERTY, dest_id);


 646 
 647     if (_traverse_outs) {
 648       for (DUIterator i = n->outs(); n->has_out(i); i++) {
 649         Node* p = n->out(i);
 650         if (!visited.test_set(p->_idx)) {
 651           nodeStack.push(p);
 652         }
 653       }
 654     }
 655 
 656     for ( uint i = 0; i < n->len(); i++ ) {
 657       if ( n->in(i) ) {
 658         if (!visited.test_set(n->in(i)->_idx)) {
 659           nodeStack.push(n->in(i));
 660         }
 661       }
 662     }
 663   }
 664 }
 665 
 666 void IdealGraphPrinter::print_method(const char *name, int level, bool clear_nodes) {
 667   print(name, (Node *)C->root(), level, clear_nodes);


 668 }
 669 
 670 // Print current ideal graph
 671 void IdealGraphPrinter::print(const char *name, Node *node, int level, bool clear_nodes) {
 672 
 673   if (!_current_method || !_should_send_method || !should_print(level)) return;
 674 
 675   // Warning, unsafe cast?
 676   _chaitin = (PhaseChaitin *)C->regalloc();
 677 
 678   begin_head(GRAPH_ELEMENT);
 679   print_attr(GRAPH_NAME_PROPERTY, (const char *)name);
 680   end_head();
 681 
 682   VectorSet temp_set(Thread::current()->resource_area());
 683 
 684   head(NODES_ELEMENT);
 685   walk_nodes(node, false, &temp_set);
 686   tail(NODES_ELEMENT);
 687 
 688   head(EDGES_ELEMENT);
 689   walk_nodes(node, true, &temp_set);
 690   tail(EDGES_ELEMENT);
 691   if (C->cfg() != NULL) {
 692     head(CONTROL_FLOW_ELEMENT);
 693     for (uint i = 0; i < C->cfg()->number_of_blocks(); i++) {




 333   }
 334 
 335   tail(PROPERTIES_ELEMENT);
 336 
 337   _should_send_method = true;
 338   this->_current_method = method;
 339 
 340   _xml->flush();
 341 }
 342 
 343 // Has to be called whenever a method has finished compilation
 344 void IdealGraphPrinter::end_method() {
 345 
 346   nmethod* method = (nmethod*)this->_current_method->code();
 347 
 348   tail(GROUP_ELEMENT);
 349   _current_method = NULL;
 350   _xml->flush();
 351 }
 352 








 353 bool IdealGraphPrinter::traverse_outs() {
 354   return _traverse_outs;
 355 }
 356 
 357 void IdealGraphPrinter::set_traverse_outs(bool b) {
 358   _traverse_outs = b;
 359 }
 360 
 361 void IdealGraphPrinter::visit_node(Node *n, bool edges, VectorSet* temp_set) {
 362 
 363   if (edges) {
 364 
 365     // Output edge
 366     node_idx_t dest_id = n->_idx;
 367     for ( uint i = 0; i < n->len(); i++ ) {
 368       if ( n->in(i) ) {
 369         Node *source = n->in(i);
 370         begin_elem(EDGE_ELEMENT);
 371         print_attr(FROM_PROPERTY, source->_idx);
 372         print_attr(TO_PROPERTY, dest_id);


 638 
 639     if (_traverse_outs) {
 640       for (DUIterator i = n->outs(); n->has_out(i); i++) {
 641         Node* p = n->out(i);
 642         if (!visited.test_set(p->_idx)) {
 643           nodeStack.push(p);
 644         }
 645       }
 646     }
 647 
 648     for ( uint i = 0; i < n->len(); i++ ) {
 649       if ( n->in(i) ) {
 650         if (!visited.test_set(n->in(i)->_idx)) {
 651           nodeStack.push(n->in(i));
 652         }
 653       }
 654     }
 655   }
 656 }
 657 
 658 void IdealGraphPrinter::print_method(const char *name, int level) {
 659   if (should_print(level)) {
 660     print(name, (Node *) C->root());
 661   }
 662 }
 663 
 664 // Print current ideal graph
 665 void IdealGraphPrinter::print(const char *name, Node *node) {
 666 
 667   if (!_current_method || !_should_send_method) return;
 668 
 669   // Warning, unsafe cast?
 670   _chaitin = (PhaseChaitin *)C->regalloc();
 671 
 672   begin_head(GRAPH_ELEMENT);
 673   print_attr(GRAPH_NAME_PROPERTY, (const char *)name);
 674   end_head();
 675 
 676   VectorSet temp_set(Thread::current()->resource_area());
 677 
 678   head(NODES_ELEMENT);
 679   walk_nodes(node, false, &temp_set);
 680   tail(NODES_ELEMENT);
 681 
 682   head(EDGES_ELEMENT);
 683   walk_nodes(node, true, &temp_set);
 684   tail(EDGES_ELEMENT);
 685   if (C->cfg() != NULL) {
 686     head(CONTROL_FLOW_ELEMENT);
 687     for (uint i = 0; i < C->cfg()->number_of_blocks(); i++) {


< prev index next >