hotspot/src/share/vm/opto/idealGraphPrinter.cpp
changeset 33451 0712796e4039
parent 33105 294e48b4f704
child 37248 11a660dbbb8e
equal deleted inserted replaced
33450:08222df07d0d 33451:0712796e4039
   290   ciMethod *method = tree->method();
   290   ciMethod *method = tree->method();
   291   print_method(tree->method(), tree->caller_bci(), tree);
   291   print_method(tree->method(), tree->caller_bci(), tree);
   292 
   292 
   293 }
   293 }
   294 
   294 
   295 void IdealGraphPrinter::print_inlining(Compile* compile) {
   295 void IdealGraphPrinter::print_inlining() {
   296 
   296 
   297   // Print inline tree
   297   // Print inline tree
   298   if (_should_send_method) {
   298   if (_should_send_method) {
   299     InlineTree *inlineTree = compile->ilt();
   299     InlineTree *inlineTree = C->ilt();
   300     if (inlineTree != NULL) {
   300     if (inlineTree != NULL) {
   301       print_inline_tree(inlineTree);
   301       print_inline_tree(inlineTree);
   302     } else {
   302     } else {
   303       // print this method only
   303       // print this method only
   304     }
   304     }
   305   }
   305   }
   306 }
   306 }
   307 
   307 
   308 // Has to be called whenever a method is compiled
   308 // Has to be called whenever a method is compiled
   309 void IdealGraphPrinter::begin_method(Compile* compile) {
   309 void IdealGraphPrinter::begin_method() {
   310 
   310 
   311   ciMethod *method = compile->method();
   311   ciMethod *method = C->method();
   312   assert(_output, "output stream must exist!");
   312   assert(_output, "output stream must exist!");
   313   assert(method, "null methods are not allowed!");
   313   assert(method, "null methods are not allowed!");
   314   assert(!_current_method, "current method must be null!");
   314   assert(!_current_method, "current method must be null!");
   315 
   315 
   316   head(GROUP_ELEMENT);
   316   head(GROUP_ELEMENT);
   660       }
   660       }
   661     }
   661     }
   662   }
   662   }
   663 }
   663 }
   664 
   664 
   665 void IdealGraphPrinter::print_method(Compile* compile, const char *name, int level, bool clear_nodes) {
   665 void IdealGraphPrinter::print_method(const char *name, int level, bool clear_nodes) {
   666   print(compile, name, (Node *)compile->root(), level, clear_nodes);
   666   print(name, (Node *)C->root(), level, clear_nodes);
   667 }
   667 }
   668 
   668 
   669 // Print current ideal graph
   669 // Print current ideal graph
   670 void IdealGraphPrinter::print(Compile* compile, const char *name, Node *node, int level, bool clear_nodes) {
   670 void IdealGraphPrinter::print(const char *name, Node *node, int level, bool clear_nodes) {
   671 
   671 
   672   if (!_current_method || !_should_send_method || !should_print(_current_method, level)) return;
   672   if (!_current_method || !_should_send_method || !should_print(level)) return;
   673 
       
   674   this->C = compile;
       
   675 
   673 
   676   // Warning, unsafe cast?
   674   // Warning, unsafe cast?
   677   _chaitin = (PhaseChaitin *)C->regalloc();
   675   _chaitin = (PhaseChaitin *)C->regalloc();
   678 
   676 
   679   begin_head(GRAPH_ELEMENT);
   677   begin_head(GRAPH_ELEMENT);
   720   tail(GRAPH_ELEMENT);
   718   tail(GRAPH_ELEMENT);
   721   _xml->flush();
   719   _xml->flush();
   722 }
   720 }
   723 
   721 
   724 // Should method be printed?
   722 // Should method be printed?
   725 bool IdealGraphPrinter::should_print(ciMethod* method, int level) {
   723 bool IdealGraphPrinter::should_print(int level) {
   726   intx ideal_graph_level = PrintIdealGraphLevel;
   724   return C->directive()->IGVPrintLevelOption >= level;
   727   method->has_option_value("PrintIdealGraphLevel", ideal_graph_level); // update value with per-method value (if available)
       
   728   return ideal_graph_level >= level;
       
   729 }
   725 }
   730 
   726 
   731 extern const char *NodeClassNames[];
   727 extern const char *NodeClassNames[];
   732 
   728 
   733 #endif
   729 #endif