< prev index next >

src/hotspot/share/opto/idealGraphPrinter.cpp

Print this page
rev 47862 : imported patch 10.07.open.rebase_20171110.dcubed
   1 /*
   2  * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "memory/resourceArea.hpp"
  27 #include "opto/chaitin.hpp"
  28 #include "opto/idealGraphPrinter.hpp"
  29 #include "opto/machnode.hpp"
  30 #include "opto/parse.hpp"
  31 #include "runtime/threadCritical.hpp"

  32 
  33 #ifndef PRODUCT
  34 
  35 // Constants
  36 // Keep consistent with Java constants
  37 const char *IdealGraphPrinter::INDENT = "  ";
  38 const char *IdealGraphPrinter::TOP_ELEMENT = "graphDocument";
  39 const char *IdealGraphPrinter::GROUP_ELEMENT = "group";
  40 const char *IdealGraphPrinter::GRAPH_ELEMENT = "graph";
  41 const char *IdealGraphPrinter::PROPERTIES_ELEMENT = "properties";
  42 const char *IdealGraphPrinter::EDGES_ELEMENT = "edges";
  43 const char *IdealGraphPrinter::PROPERTY_ELEMENT = "p";
  44 const char *IdealGraphPrinter::EDGE_ELEMENT = "edge";
  45 const char *IdealGraphPrinter::NODE_ELEMENT = "node";
  46 const char *IdealGraphPrinter::NODES_ELEMENT = "nodes";
  47 const char *IdealGraphPrinter::REMOVE_EDGE_ELEMENT = "removeEdge";
  48 const char *IdealGraphPrinter::REMOVE_NODE_ELEMENT = "removeNode";
  49 const char *IdealGraphPrinter::METHOD_NAME_PROPERTY = "name";
  50 const char *IdealGraphPrinter::METHOD_IS_PUBLIC_PROPERTY = "public";
  51 const char *IdealGraphPrinter::METHOD_IS_STATIC_PROPERTY = "static";


  74 int IdealGraphPrinter::_file_count = 0;
  75 
  76 IdealGraphPrinter *IdealGraphPrinter::printer() {
  77   if (!PrintIdealGraph) {
  78     return NULL;
  79   }
  80 
  81   JavaThread *thread = JavaThread::current();
  82   if (!thread->is_Compiler_thread()) return NULL;
  83 
  84   CompilerThread *compiler_thread = (CompilerThread *)thread;
  85   if (compiler_thread->ideal_graph_printer() == NULL) {
  86     IdealGraphPrinter *printer = new IdealGraphPrinter();
  87     compiler_thread->set_ideal_graph_printer(printer);
  88   }
  89 
  90   return compiler_thread->ideal_graph_printer();
  91 }
  92 
  93 void IdealGraphPrinter::clean_up() {
  94   JavaThread *p;
  95   for (p = Threads::first(); p; p = p->next()) {
  96     if (p->is_Compiler_thread()) {
  97       CompilerThread *c = (CompilerThread *)p;
  98       IdealGraphPrinter *printer = c->ideal_graph_printer();
  99       if (printer) {
 100         delete printer;
 101       }
 102       c->set_ideal_graph_printer(NULL);
 103     }
 104   }
 105 }
 106 
 107 // Constructor, either file or network output
 108 IdealGraphPrinter::IdealGraphPrinter() {
 109 
 110   // By default dump both ins and outs since dead or unreachable code
 111   // needs to appear in the graph.  There are also some special cases
 112   // in the mach where kill projections have no users but should
 113   // appear in the dump.
 114   _traverse_outs = true;
 115   _should_send_method = true;


   1 /*
   2  * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "memory/resourceArea.hpp"
  27 #include "opto/chaitin.hpp"
  28 #include "opto/idealGraphPrinter.hpp"
  29 #include "opto/machnode.hpp"
  30 #include "opto/parse.hpp"
  31 #include "runtime/threadCritical.hpp"
  32 #include "runtime/threadSMR.hpp"
  33 
  34 #ifndef PRODUCT
  35 
  36 // Constants
  37 // Keep consistent with Java constants
  38 const char *IdealGraphPrinter::INDENT = "  ";
  39 const char *IdealGraphPrinter::TOP_ELEMENT = "graphDocument";
  40 const char *IdealGraphPrinter::GROUP_ELEMENT = "group";
  41 const char *IdealGraphPrinter::GRAPH_ELEMENT = "graph";
  42 const char *IdealGraphPrinter::PROPERTIES_ELEMENT = "properties";
  43 const char *IdealGraphPrinter::EDGES_ELEMENT = "edges";
  44 const char *IdealGraphPrinter::PROPERTY_ELEMENT = "p";
  45 const char *IdealGraphPrinter::EDGE_ELEMENT = "edge";
  46 const char *IdealGraphPrinter::NODE_ELEMENT = "node";
  47 const char *IdealGraphPrinter::NODES_ELEMENT = "nodes";
  48 const char *IdealGraphPrinter::REMOVE_EDGE_ELEMENT = "removeEdge";
  49 const char *IdealGraphPrinter::REMOVE_NODE_ELEMENT = "removeNode";
  50 const char *IdealGraphPrinter::METHOD_NAME_PROPERTY = "name";
  51 const char *IdealGraphPrinter::METHOD_IS_PUBLIC_PROPERTY = "public";
  52 const char *IdealGraphPrinter::METHOD_IS_STATIC_PROPERTY = "static";


  75 int IdealGraphPrinter::_file_count = 0;
  76 
  77 IdealGraphPrinter *IdealGraphPrinter::printer() {
  78   if (!PrintIdealGraph) {
  79     return NULL;
  80   }
  81 
  82   JavaThread *thread = JavaThread::current();
  83   if (!thread->is_Compiler_thread()) return NULL;
  84 
  85   CompilerThread *compiler_thread = (CompilerThread *)thread;
  86   if (compiler_thread->ideal_graph_printer() == NULL) {
  87     IdealGraphPrinter *printer = new IdealGraphPrinter();
  88     compiler_thread->set_ideal_graph_printer(printer);
  89   }
  90 
  91   return compiler_thread->ideal_graph_printer();
  92 }
  93 
  94 void IdealGraphPrinter::clean_up() {
  95   for (JavaThreadIteratorWithHandle jtiwh; JavaThread *p = jtiwh.next(); ) {

  96     if (p->is_Compiler_thread()) {
  97       CompilerThread *c = (CompilerThread *)p;
  98       IdealGraphPrinter *printer = c->ideal_graph_printer();
  99       if (printer) {
 100         delete printer;
 101       }
 102       c->set_ideal_graph_printer(NULL);
 103     }
 104   }
 105 }
 106 
 107 // Constructor, either file or network output
 108 IdealGraphPrinter::IdealGraphPrinter() {
 109 
 110   // By default dump both ins and outs since dead or unreachable code
 111   // needs to appear in the graph.  There are also some special cases
 112   // in the mach where kill projections have no users but should
 113   // appear in the dump.
 114   _traverse_outs = true;
 115   _should_send_method = true;


< prev index next >