Path: blob/master/src/hotspot/share/opto/idealGraphPrinter.cpp
40930 views
/*1* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "memory/resourceArea.hpp"26#include "opto/chaitin.hpp"27#include "opto/idealGraphPrinter.hpp"28#include "opto/machnode.hpp"29#include "opto/parse.hpp"30#include "runtime/threadCritical.hpp"31#include "runtime/threadSMR.hpp"32#include "utilities/stringUtils.hpp"3334#ifndef PRODUCT3536// Constants37// Keep consistent with Java constants38const char *IdealGraphPrinter::INDENT = " ";39const char *IdealGraphPrinter::TOP_ELEMENT = "graphDocument";40const char *IdealGraphPrinter::GROUP_ELEMENT = "group";41const char *IdealGraphPrinter::GRAPH_ELEMENT = "graph";42const char *IdealGraphPrinter::PROPERTIES_ELEMENT = "properties";43const char *IdealGraphPrinter::EDGES_ELEMENT = "edges";44const char *IdealGraphPrinter::PROPERTY_ELEMENT = "p";45const char *IdealGraphPrinter::EDGE_ELEMENT = "edge";46const char *IdealGraphPrinter::NODE_ELEMENT = "node";47const char *IdealGraphPrinter::NODES_ELEMENT = "nodes";48const char *IdealGraphPrinter::REMOVE_EDGE_ELEMENT = "removeEdge";49const char *IdealGraphPrinter::REMOVE_NODE_ELEMENT = "removeNode";50const char *IdealGraphPrinter::METHOD_NAME_PROPERTY = "name";51const char *IdealGraphPrinter::METHOD_IS_PUBLIC_PROPERTY = "public";52const char *IdealGraphPrinter::METHOD_IS_STATIC_PROPERTY = "static";53const char *IdealGraphPrinter::TRUE_VALUE = "true";54const char *IdealGraphPrinter::NODE_NAME_PROPERTY = "name";55const char *IdealGraphPrinter::EDGE_NAME_PROPERTY = "name";56const char *IdealGraphPrinter::NODE_ID_PROPERTY = "id";57const char *IdealGraphPrinter::FROM_PROPERTY = "from";58const char *IdealGraphPrinter::TO_PROPERTY = "to";59const char *IdealGraphPrinter::PROPERTY_NAME_PROPERTY = "name";60const char *IdealGraphPrinter::GRAPH_NAME_PROPERTY = "name";61const char *IdealGraphPrinter::INDEX_PROPERTY = "index";62const char *IdealGraphPrinter::METHOD_ELEMENT = "method";63const char *IdealGraphPrinter::INLINE_ELEMENT = "inlined";64const char *IdealGraphPrinter::BYTECODES_ELEMENT = "bytecodes";65const char *IdealGraphPrinter::METHOD_BCI_PROPERTY = "bci";66const char *IdealGraphPrinter::METHOD_SHORT_NAME_PROPERTY = "shortName";67const char *IdealGraphPrinter::CONTROL_FLOW_ELEMENT = "controlFlow";68const char *IdealGraphPrinter::BLOCK_NAME_PROPERTY = "name";69const char *IdealGraphPrinter::BLOCK_DOMINATOR_PROPERTY = "dom";70const char *IdealGraphPrinter::BLOCK_ELEMENT = "block";71const char *IdealGraphPrinter::SUCCESSORS_ELEMENT = "successors";72const char *IdealGraphPrinter::SUCCESSOR_ELEMENT = "successor";73const char *IdealGraphPrinter::ASSEMBLY_ELEMENT = "assembly";7475int IdealGraphPrinter::_file_count = 0;7677IdealGraphPrinter *IdealGraphPrinter::printer() {78JavaThread *thread = JavaThread::current();79if (!thread->is_Compiler_thread()) return NULL;8081CompilerThread *compiler_thread = (CompilerThread *)thread;82if (compiler_thread->ideal_graph_printer() == NULL) {83IdealGraphPrinter *printer = new IdealGraphPrinter();84compiler_thread->set_ideal_graph_printer(printer);85}8687return compiler_thread->ideal_graph_printer();88}8990void IdealGraphPrinter::clean_up() {91for (JavaThreadIteratorWithHandle jtiwh; JavaThread* p = jtiwh.next(); ) {92if (p->is_Compiler_thread()) {93CompilerThread* c = (CompilerThread*)p;94IdealGraphPrinter* printer = c->ideal_graph_printer();95if (printer) {96delete printer;97}98c->set_ideal_graph_printer(NULL);99}100}101IdealGraphPrinter* debug_file_printer = Compile::debug_file_printer();102if (debug_file_printer != NULL) {103delete debug_file_printer;104}105IdealGraphPrinter* debug_network_printer = Compile::debug_network_printer();106if (debug_network_printer != NULL) {107delete debug_network_printer;108}109}110111// Either print methods to file specified with PrintIdealGraphFile or otherwise over the network to the IGV112IdealGraphPrinter::IdealGraphPrinter() {113init(PrintIdealGraphFile, true, false);114}115116// Either print methods to the specified file 'file_name' or if NULL over the network to the IGV. If 'append'117// is set, the next phase is directly appended to the specified file 'file_name'. This is useful when doing118// replay compilation with a tool like rr that cannot alter the current program state but only the file.119IdealGraphPrinter::IdealGraphPrinter(Compile* compile, const char* file_name, bool append) {120assert(!append || (append && file_name != NULL), "can only use append flag when printing to file");121init(file_name, false, append);122C = compile;123if (append) {124// When directly appending the next graph, we only need to set _current_method and not set up a new method125_current_method = C->method();126} else {127begin_method();128}129}130131void IdealGraphPrinter::init(const char* file_name, bool use_multiple_files, bool append) {132// By default dump both ins and outs since dead or unreachable code133// needs to appear in the graph. There are also some special cases134// in the mach where kill projections have no users but should135// appear in the dump.136_traverse_outs = true;137_should_send_method = true;138_output = NULL;139buffer[0] = 0;140_depth = 0;141_current_method = NULL;142_network_stream = NULL;143144if (file_name != NULL) {145init_file_stream(file_name, use_multiple_files, append);146} else {147init_network_stream();148}149_xml = new (ResourceObj::C_HEAP, mtCompiler) xmlStream(_output);150if (!append) {151head(TOP_ELEMENT);152}153}154155// Destructor, close file or network stream156IdealGraphPrinter::~IdealGraphPrinter() {157tail(TOP_ELEMENT);158159// tty->print_cr("Walk time: %d", (int)_walk_time.milliseconds());160// tty->print_cr("Output time: %d", (int)_output_time.milliseconds());161// tty->print_cr("Build blocks time: %d", (int)_build_blocks_time.milliseconds());162163if(_xml) {164delete _xml;165_xml = NULL;166}167168if (_network_stream) {169delete _network_stream;170if (_network_stream == _output) {171_output = NULL;172}173_network_stream = NULL;174}175176if (_output) {177delete _output;178_output = NULL;179}180}181182void IdealGraphPrinter::begin_elem(const char *s) {183_xml->begin_elem("%s", s);184}185186void IdealGraphPrinter::end_elem() {187_xml->end_elem();188}189190void IdealGraphPrinter::begin_head(const char *s) {191_xml->begin_head("%s", s);192}193194void IdealGraphPrinter::end_head() {195_xml->end_head();196}197198void IdealGraphPrinter::print_attr(const char *name, intptr_t val) {199stringStream stream;200stream.print(INTX_FORMAT, val);201print_attr(name, stream.as_string());202}203204void IdealGraphPrinter::print_attr(const char *name, const char *val) {205_xml->print(" %s='", name);206text(val);207_xml->print("'");208}209210void IdealGraphPrinter::head(const char *name) {211_xml->head("%s", name);212}213214void IdealGraphPrinter::tail(const char *name) {215_xml->tail(name);216}217218void IdealGraphPrinter::text(const char *s) {219_xml->text("%s", s);220}221222void IdealGraphPrinter::print_prop(const char *name, int val) {223stringStream stream;224stream.print("%d", val);225print_prop(name, stream.as_string());226}227228void IdealGraphPrinter::print_prop(const char *name, const char *val) {229begin_head(PROPERTY_ELEMENT);230print_attr(PROPERTY_NAME_PROPERTY, name);231end_head();232text(val);233tail(PROPERTY_ELEMENT);234}235236void IdealGraphPrinter::print_method(ciMethod *method, int bci, InlineTree *tree) {237begin_head(METHOD_ELEMENT);238239stringStream str;240method->print_name(&str);241242stringStream shortStr;243method->print_short_name(&shortStr);244245print_attr(METHOD_NAME_PROPERTY, str.as_string());246print_attr(METHOD_SHORT_NAME_PROPERTY, shortStr.as_string());247print_attr(METHOD_BCI_PROPERTY, bci);248249end_head();250251head(BYTECODES_ELEMENT);252_xml->print_cr("<![CDATA[");253method->print_codes_on(_xml);254_xml->print_cr("]]>");255tail(BYTECODES_ELEMENT);256257if (tree != NULL && tree->subtrees().length() > 0) {258head(INLINE_ELEMENT);259GrowableArray<InlineTree *> subtrees = tree->subtrees();260for (int i = 0; i < subtrees.length(); i++) {261print_inline_tree(subtrees.at(i));262}263tail(INLINE_ELEMENT);264}265266tail(METHOD_ELEMENT);267_xml->flush();268}269270void IdealGraphPrinter::print_inline_tree(InlineTree *tree) {271if (tree != NULL) {272print_method(tree->method(), tree->caller_bci(), tree);273}274}275276void IdealGraphPrinter::print_inlining() {277278// Print inline tree279if (_should_send_method) {280InlineTree *inlineTree = C->ilt();281if (inlineTree != NULL) {282print_inline_tree(inlineTree);283} else {284// print this method only285}286}287}288289// Has to be called whenever a method is compiled290void IdealGraphPrinter::begin_method() {291292ciMethod *method = C->method();293assert(_output, "output stream must exist!");294assert(method, "null methods are not allowed!");295assert(!_current_method, "current method must be null!");296297head(GROUP_ELEMENT);298299head(PROPERTIES_ELEMENT);300301// Print properties302// Add method name303stringStream strStream;304method->print_name(&strStream);305print_prop(METHOD_NAME_PROPERTY, strStream.as_string());306307if (method->flags().is_public()) {308print_prop(METHOD_IS_PUBLIC_PROPERTY, TRUE_VALUE);309}310311if (method->flags().is_static()) {312print_prop(METHOD_IS_STATIC_PROPERTY, TRUE_VALUE);313}314315tail(PROPERTIES_ELEMENT);316317_should_send_method = true;318this->_current_method = method;319320_xml->flush();321}322323// Has to be called whenever a method has finished compilation324void IdealGraphPrinter::end_method() {325tail(GROUP_ELEMENT);326_current_method = NULL;327_xml->flush();328}329330bool IdealGraphPrinter::traverse_outs() {331return _traverse_outs;332}333334void IdealGraphPrinter::set_traverse_outs(bool b) {335_traverse_outs = b;336}337338void IdealGraphPrinter::visit_node(Node *n, bool edges, VectorSet* temp_set) {339340if (edges) {341342for (uint i = 0; i < n->len(); i++) {343if (n->in(i)) {344Node *source = n->in(i);345begin_elem(EDGE_ELEMENT);346print_attr(FROM_PROPERTY, source->_igv_idx);347print_attr(TO_PROPERTY, n->_igv_idx);348print_attr(INDEX_PROPERTY, i);349end_elem();350}351}352353} else {354355// Output node356begin_head(NODE_ELEMENT);357print_attr(NODE_ID_PROPERTY, n->_igv_idx);358end_head();359360head(PROPERTIES_ELEMENT);361362Node *node = n;363#ifndef PRODUCT364Compile::current()->_in_dump_cnt++;365print_prop(NODE_NAME_PROPERTY, (const char *)node->Name());366const Type *t = node->bottom_type();367print_prop("type", t->msg());368print_prop("idx", node->_idx);369#ifdef ASSERT370print_prop("debug_idx", node->_debug_idx);371#endif372373if (C->cfg() != NULL) {374Block* block = C->cfg()->get_block_for_node(node);375if (block == NULL) {376print_prop("block", C->cfg()->get_block(0)->_pre_order);377} else {378print_prop("block", block->_pre_order);379// Print estimated execution frequency, normalized within a [0,1] range.380buffer[0] = 0;381stringStream freq(buffer, sizeof(buffer) - 1);382// Higher precision has no practical effect in visualizations.383freq.print("%.8f", block->_freq / _max_freq);384assert(freq.size() < sizeof(buffer), "size in range");385// Enforce dots as decimal separators, as required by IGV.386StringUtils::replace_no_expand(buffer, ",", ".");387print_prop("frequency", buffer);388}389}390391switch (t->category()) {392case Type::Category::Data:393print_prop("category", "data");394break;395case Type::Category::Memory:396print_prop("category", "memory");397break;398case Type::Category::Mixed:399print_prop("category", "mixed");400break;401case Type::Category::Control:402print_prop("category", "control");403break;404case Type::Category::Other:405print_prop("category", "other");406break;407case Type::Category::Undef:408print_prop("category", "undef");409break;410}411412const jushort flags = node->flags();413if (flags & Node::Flag_is_Copy) {414print_prop("is_copy", "true");415}416if (flags & Node::Flag_rematerialize) {417print_prop("rematerialize", "true");418}419if (flags & Node::Flag_needs_anti_dependence_check) {420print_prop("needs_anti_dependence_check", "true");421}422if (flags & Node::Flag_is_macro) {423print_prop("is_macro", "true");424}425if (flags & Node::Flag_is_Con) {426print_prop("is_con", "true");427}428if (flags & Node::Flag_is_cisc_alternate) {429print_prop("is_cisc_alternate", "true");430}431if (flags & Node::Flag_is_dead_loop_safe) {432print_prop("is_dead_loop_safe", "true");433}434if (flags & Node::Flag_may_be_short_branch) {435print_prop("may_be_short_branch", "true");436}437if (flags & Node::Flag_has_call) {438print_prop("has_call", "true");439}440441if (C->matcher() != NULL) {442if (C->matcher()->is_shared(node)) {443print_prop("is_shared", "true");444} else {445print_prop("is_shared", "false");446}447if (C->matcher()->is_dontcare(node)) {448print_prop("is_dontcare", "true");449} else {450print_prop("is_dontcare", "false");451}452Node* old = C->matcher()->find_old_node(node);453if (old != NULL) {454print_prop("old_node_idx", old->_idx);455}456}457458if (node->is_Proj()) {459print_prop("con", (int)node->as_Proj()->_con);460}461462if (node->is_Mach()) {463print_prop("idealOpcode", (const char *)NodeClassNames[node->as_Mach()->ideal_Opcode()]);464}465466buffer[0] = 0;467stringStream s2(buffer, sizeof(buffer) - 1);468469node->dump_spec(&s2);470if (t != NULL && (t->isa_instptr() || t->isa_klassptr())) {471const TypeInstPtr *toop = t->isa_instptr();472const TypeKlassPtr *tkls = t->isa_klassptr();473ciKlass* klass = toop ? toop->klass() : (tkls ? tkls->klass() : NULL );474if( klass && klass->is_loaded() && klass->is_interface() ) {475s2.print(" Interface:");476} else if( toop ) {477s2.print(" Oop:");478} else if( tkls ) {479s2.print(" Klass:");480}481t->dump_on(&s2);482} else if( t == Type::MEMORY ) {483s2.print(" Memory:");484MemNode::dump_adr_type(node, node->adr_type(), &s2);485}486487assert(s2.size() < sizeof(buffer), "size in range");488print_prop("dump_spec", buffer);489490if (node->is_block_proj()) {491print_prop("is_block_proj", "true");492}493494if (node->is_block_start()) {495print_prop("is_block_start", "true");496}497498const char *short_name = "short_name";499if (strcmp(node->Name(), "Parm") == 0 && node->as_Proj()->_con >= TypeFunc::Parms) {500int index = node->as_Proj()->_con - TypeFunc::Parms;501if (index >= 10) {502print_prop(short_name, "PA");503} else {504sprintf(buffer, "P%d", index);505print_prop(short_name, buffer);506}507} else if (strcmp(node->Name(), "IfTrue") == 0) {508print_prop(short_name, "T");509} else if (strcmp(node->Name(), "IfFalse") == 0) {510print_prop(short_name, "F");511} else if ((node->is_Con() && node->is_Type()) || node->is_Proj()) {512513if (t->base() == Type::Int && t->is_int()->is_con()) {514const TypeInt *typeInt = t->is_int();515assert(typeInt->is_con(), "must be constant");516jint value = typeInt->get_con();517518// max. 2 chars allowed519if (value >= -9 && value <= 99) {520sprintf(buffer, "%d", value);521print_prop(short_name, buffer);522} else {523print_prop(short_name, "I");524}525} else if (t == Type::TOP) {526print_prop(short_name, "^");527} else if (t->base() == Type::Long && t->is_long()->is_con()) {528const TypeLong *typeLong = t->is_long();529assert(typeLong->is_con(), "must be constant");530jlong value = typeLong->get_con();531532// max. 2 chars allowed533if (value >= -9 && value <= 99) {534sprintf(buffer, JLONG_FORMAT, value);535print_prop(short_name, buffer);536} else {537print_prop(short_name, "L");538}539} else if (t->base() == Type::KlassPtr) {540const TypeKlassPtr *typeKlass = t->is_klassptr();541print_prop(short_name, "CP");542} else if (t->base() == Type::Control) {543print_prop(short_name, "C");544} else if (t->base() == Type::Memory) {545print_prop(short_name, "M");546} else if (t->base() == Type::Abio) {547print_prop(short_name, "IO");548} else if (t->base() == Type::Return_Address) {549print_prop(short_name, "RA");550} else if (t->base() == Type::AnyPtr) {551print_prop(short_name, "P");552} else if (t->base() == Type::RawPtr) {553print_prop(short_name, "RP");554} else if (t->base() == Type::AryPtr) {555print_prop(short_name, "AP");556}557}558559JVMState* caller = NULL;560if (node->is_SafePoint()) {561caller = node->as_SafePoint()->jvms();562} else {563Node_Notes* notes = C->node_notes_at(node->_idx);564if (notes != NULL) {565caller = notes->jvms();566}567}568569if (caller != NULL) {570stringStream bciStream;571ciMethod* last = NULL;572int last_bci;573while(caller) {574if (caller->has_method()) {575last = caller->method();576last_bci = caller->bci();577}578bciStream.print("%d ", caller->bci());579caller = caller->caller();580}581print_prop("bci", bciStream.as_string());582if (last != NULL && last->has_linenumber_table() && last_bci >= 0) {583print_prop("line", last->line_number_from_bci(last_bci));584}585}586587#ifdef ASSERT588if (node->debug_orig() != NULL) {589stringStream dorigStream;590node->dump_orig(&dorigStream, false);591print_prop("debug_orig", dorigStream.as_string());592}593#endif594595if (_chaitin && _chaitin != (PhaseChaitin *)((intptr_t)0xdeadbeef)) {596buffer[0] = 0;597_chaitin->dump_register(node, buffer);598print_prop("reg", buffer);599uint lrg_id = 0;600if (node->_idx < _chaitin->_lrg_map.size()) {601lrg_id = _chaitin->_lrg_map.live_range_id(node);602}603print_prop("lrg", lrg_id);604}605606Compile::current()->_in_dump_cnt--;607#endif608609tail(PROPERTIES_ELEMENT);610tail(NODE_ELEMENT);611}612}613614void IdealGraphPrinter::walk_nodes(Node *start, bool edges, VectorSet* temp_set) {615616617VectorSet visited;618GrowableArray<Node *> nodeStack(Thread::current()->resource_area(), 0, 0, NULL);619nodeStack.push(start);620visited.test_set(start->_idx);621if (C->cfg() != NULL) {622// once we have a CFG there are some nodes that aren't really623// reachable but are in the CFG so add them here.624for (uint i = 0; i < C->cfg()->number_of_blocks(); i++) {625Block* block = C->cfg()->get_block(i);626for (uint s = 0; s < block->number_of_nodes(); s++) {627nodeStack.push(block->get_node(s));628}629}630}631632while(nodeStack.length() > 0) {633634Node *n = nodeStack.pop();635visit_node(n, edges, temp_set);636637if (_traverse_outs) {638for (DUIterator i = n->outs(); n->has_out(i); i++) {639Node* p = n->out(i);640if (!visited.test_set(p->_idx)) {641nodeStack.push(p);642}643}644}645646for ( uint i = 0; i < n->len(); i++ ) {647if ( n->in(i) ) {648if (!visited.test_set(n->in(i)->_idx)) {649nodeStack.push(n->in(i));650}651}652}653}654}655656void IdealGraphPrinter::print_method(const char *name, int level) {657if (C->should_print(level)) {658print(name, (Node *) C->root());659}660}661662// Print current ideal graph663void IdealGraphPrinter::print(const char *name, Node *node) {664665if (!_current_method || !_should_send_method || node == NULL) return;666667// Warning, unsafe cast?668_chaitin = (PhaseChaitin *)C->regalloc();669670begin_head(GRAPH_ELEMENT);671print_attr(GRAPH_NAME_PROPERTY, (const char *)name);672end_head();673674VectorSet temp_set;675676head(NODES_ELEMENT);677if (C->cfg() != NULL) {678// Compute the maximum estimated frequency in the current graph.679_max_freq = 1.0e-6;680for (uint i = 0; i < C->cfg()->number_of_blocks(); i++) {681Block* block = C->cfg()->get_block(i);682if (block->_freq > _max_freq) {683_max_freq = block->_freq;684}685}686}687walk_nodes(node, false, &temp_set);688tail(NODES_ELEMENT);689690head(EDGES_ELEMENT);691walk_nodes(node, true, &temp_set);692tail(EDGES_ELEMENT);693if (C->cfg() != NULL) {694head(CONTROL_FLOW_ELEMENT);695for (uint i = 0; i < C->cfg()->number_of_blocks(); i++) {696Block* block = C->cfg()->get_block(i);697begin_head(BLOCK_ELEMENT);698print_attr(BLOCK_NAME_PROPERTY, block->_pre_order);699end_head();700701head(SUCCESSORS_ELEMENT);702for (uint s = 0; s < block->_num_succs; s++) {703begin_elem(SUCCESSOR_ELEMENT);704print_attr(BLOCK_NAME_PROPERTY, block->_succs[s]->_pre_order);705end_elem();706}707tail(SUCCESSORS_ELEMENT);708709head(NODES_ELEMENT);710for (uint s = 0; s < block->number_of_nodes(); s++) {711begin_elem(NODE_ELEMENT);712print_attr(NODE_ID_PROPERTY, block->get_node(s)->_igv_idx);713end_elem();714}715tail(NODES_ELEMENT);716717tail(BLOCK_ELEMENT);718}719tail(CONTROL_FLOW_ELEMENT);720}721tail(GRAPH_ELEMENT);722_xml->flush();723}724725void IdealGraphPrinter::init_file_stream(const char* file_name, bool use_multiple_files, bool append) {726ThreadCritical tc;727if (use_multiple_files && _file_count != 0) {728assert(!append, "append should only be used for debugging with a single file");729ResourceMark rm;730stringStream st;731const char* dot = strrchr(file_name, '.');732if (dot) {733st.write(file_name, dot - file_name);734st.print("%d%s", _file_count, dot);735} else {736st.print("%s%d", file_name, _file_count);737}738_output = new (ResourceObj::C_HEAP, mtCompiler) fileStream(st.as_string(), "w");739} else {740_output = new (ResourceObj::C_HEAP, mtCompiler) fileStream(file_name, append ? "a" : "w");741}742if (use_multiple_files) {743assert(!append, "append should only be used for debugging with a single file");744_file_count++;745}746}747748void IdealGraphPrinter::init_network_stream() {749_network_stream = new (ResourceObj::C_HEAP, mtCompiler) networkStream();750// Try to connect to visualizer751if (_network_stream->connect(PrintIdealGraphAddress, PrintIdealGraphPort)) {752char c = 0;753_network_stream->read(&c, 1);754if (c != 'y') {755tty->print_cr("Client available, but does not want to receive data!");756_network_stream->close();757delete _network_stream;758_network_stream = NULL;759return;760}761_output = _network_stream;762} else {763// It would be nice if we could shut down cleanly but it should764// be an error if we can't connect to the visualizer.765fatal("Couldn't connect to visualizer at %s:" INTX_FORMAT,766PrintIdealGraphAddress, PrintIdealGraphPort);767}768}769770void IdealGraphPrinter::update_compiled_method(ciMethod* current_method) {771assert(C != NULL, "must already be set");772if (current_method != _current_method) {773// If a different method, end the old and begin with the new one.774end_method();775_current_method = NULL;776begin_method();777}778}779780extern const char *NodeClassNames[];781782#endif783784785