hotspot/src/share/vm/opto/idealGraphPrinter.cpp
author thartmann
Fri, 20 Nov 2015 10:09:42 +0100
changeset 34204 5ad1ba3afecc
parent 33451 0712796e4039
child 37248 11a660dbbb8e
permissions -rw-r--r--
8140390: Char stores/loads accessing byte arrays must be marked as unmatched Summary: Mark unmatched char stores/loads emitted by CompactStrings. Reviewed-by: roland, vlivanov, jrose
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
30591
b32fcc177417 8075492: adopt recent IGV
mhaupt
parents: 27147
diff changeset
     2
 * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5403
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5403
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5403
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#include "opto/chaitin.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#include "opto/idealGraphPrinter.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "opto/machnode.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "opto/parse.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "runtime/threadCritical.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
// Constants
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
// Keep consistent with Java constants
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
const char *IdealGraphPrinter::INDENT = "  ";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
const char *IdealGraphPrinter::TOP_ELEMENT = "graphDocument";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
const char *IdealGraphPrinter::GROUP_ELEMENT = "group";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
const char *IdealGraphPrinter::GRAPH_ELEMENT = "graph";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
const char *IdealGraphPrinter::PROPERTIES_ELEMENT = "properties";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
const char *IdealGraphPrinter::EDGES_ELEMENT = "edges";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
const char *IdealGraphPrinter::PROPERTY_ELEMENT = "p";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
const char *IdealGraphPrinter::EDGE_ELEMENT = "edge";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
const char *IdealGraphPrinter::NODE_ELEMENT = "node";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
const char *IdealGraphPrinter::NODES_ELEMENT = "nodes";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
const char *IdealGraphPrinter::REMOVE_EDGE_ELEMENT = "removeEdge";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
const char *IdealGraphPrinter::REMOVE_NODE_ELEMENT = "removeNode";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
const char *IdealGraphPrinter::METHOD_NAME_PROPERTY = "name";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
const char *IdealGraphPrinter::METHOD_IS_PUBLIC_PROPERTY = "public";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
const char *IdealGraphPrinter::METHOD_IS_STATIC_PROPERTY = "static";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
const char *IdealGraphPrinter::TRUE_VALUE = "true";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
const char *IdealGraphPrinter::NODE_NAME_PROPERTY = "name";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
const char *IdealGraphPrinter::EDGE_NAME_PROPERTY = "name";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
const char *IdealGraphPrinter::NODE_ID_PROPERTY = "id";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
const char *IdealGraphPrinter::FROM_PROPERTY = "from";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
const char *IdealGraphPrinter::TO_PROPERTY = "to";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
const char *IdealGraphPrinter::PROPERTY_NAME_PROPERTY = "name";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
const char *IdealGraphPrinter::GRAPH_NAME_PROPERTY = "name";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
const char *IdealGraphPrinter::INDEX_PROPERTY = "index";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
const char *IdealGraphPrinter::METHOD_ELEMENT = "method";
30591
b32fcc177417 8075492: adopt recent IGV
mhaupt
parents: 27147
diff changeset
    61
const char *IdealGraphPrinter::INLINE_ELEMENT = "inlined";
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
const char *IdealGraphPrinter::BYTECODES_ELEMENT = "bytecodes";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
const char *IdealGraphPrinter::METHOD_BCI_PROPERTY = "bci";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
const char *IdealGraphPrinter::METHOD_SHORT_NAME_PROPERTY = "shortName";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
const char *IdealGraphPrinter::CONTROL_FLOW_ELEMENT = "controlFlow";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
const char *IdealGraphPrinter::BLOCK_NAME_PROPERTY = "name";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
const char *IdealGraphPrinter::BLOCK_DOMINATOR_PROPERTY = "dom";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
const char *IdealGraphPrinter::BLOCK_ELEMENT = "block";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
const char *IdealGraphPrinter::SUCCESSORS_ELEMENT = "successors";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
const char *IdealGraphPrinter::SUCCESSOR_ELEMENT = "successor";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
const char *IdealGraphPrinter::ASSEMBLY_ELEMENT = "assembly";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
int IdealGraphPrinter::_file_count = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
IdealGraphPrinter *IdealGraphPrinter::printer() {
27147
ed83dc5777e6 8060215: per-method PrintIdealGraphLevel
zmajo
parents: 24424
diff changeset
    76
  if (!PrintIdealGraph) {
ed83dc5777e6 8060215: per-method PrintIdealGraphLevel
zmajo
parents: 24424
diff changeset
    77
    return NULL;
ed83dc5777e6 8060215: per-method PrintIdealGraphLevel
zmajo
parents: 24424
diff changeset
    78
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  JavaThread *thread = JavaThread::current();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  if (!thread->is_Compiler_thread()) return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  CompilerThread *compiler_thread = (CompilerThread *)thread;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  if (compiler_thread->ideal_graph_printer() == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
    IdealGraphPrinter *printer = new IdealGraphPrinter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
    compiler_thread->set_ideal_graph_printer(printer);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  return compiler_thread->ideal_graph_printer();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
void IdealGraphPrinter::clean_up() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  JavaThread *p;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  for (p = Threads::first(); p; p = p->next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
    if (p->is_Compiler_thread()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
      CompilerThread *c = (CompilerThread *)p;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
      IdealGraphPrinter *printer = c->ideal_graph_printer();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
      if (printer) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
        delete printer;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
      c->set_ideal_graph_printer(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
// Constructor, either file or network output
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
IdealGraphPrinter::IdealGraphPrinter() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   109
  // By default dump both ins and outs since dead or unreachable code
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   110
  // needs to appear in the graph.  There are also some special cases
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   111
  // in the mach where kill projections have no users but should
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   112
  // appear in the dump.
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   113
  _traverse_outs = true;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  _should_send_method = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  _output = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  buffer[0] = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  _depth = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  _current_method = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  assert(!_current_method, "current method must be initialized to NULL");
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   120
  _stream = NULL;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  if (PrintIdealGraphFile != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    ThreadCritical tc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
    // User wants all output to go to files
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    if (_file_count != 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
      ResourceMark rm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
      stringStream st;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
      const char* dot = strrchr(PrintIdealGraphFile, '.');
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
      if (dot) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
        st.write(PrintIdealGraphFile, dot - PrintIdealGraphFile);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
        st.print("%d%s", _file_count, dot);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
      } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
        st.print("%s%d", PrintIdealGraphFile, _file_count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
      }
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 11196
diff changeset
   135
      fileStream *stream = new (ResourceObj::C_HEAP, mtCompiler) fileStream(st.as_string());
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   136
      _output = stream;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
    } else {
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 11196
diff changeset
   138
      fileStream *stream = new (ResourceObj::C_HEAP, mtCompiler) fileStream(PrintIdealGraphFile);
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   139
      _output = stream;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
    _file_count++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  } else {
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 11196
diff changeset
   143
    _stream = new (ResourceObj::C_HEAP, mtCompiler) networkStream();
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   144
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
    // Try to connect to visualizer
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
    if (_stream->connect(PrintIdealGraphAddress, PrintIdealGraphPort)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
      char c = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
      _stream->read(&c, 1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
      if (c != 'y') {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
        tty->print_cr("Client available, but does not want to receive data!");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
        _stream->close();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
        delete _stream;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
        _stream = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
        return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
      _output = _stream;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
      // It would be nice if we could shut down cleanly but it should
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
      // be an error if we can't connect to the visualizer.
33105
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 30591
diff changeset
   160
      fatal("Couldn't connect to visualizer at %s:" INTX_FORMAT,
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 30591
diff changeset
   161
            PrintIdealGraphAddress, PrintIdealGraphPort);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 11196
diff changeset
   165
  _xml = new (ResourceObj::C_HEAP, mtCompiler) xmlStream(_output);
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   166
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   167
  head(TOP_ELEMENT);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
// Destructor, close file or network stream
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
IdealGraphPrinter::~IdealGraphPrinter() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   173
  tail(TOP_ELEMENT);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   174
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   175
  // tty->print_cr("Walk time: %d", (int)_walk_time.milliseconds());
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   176
  // tty->print_cr("Output time: %d", (int)_output_time.milliseconds());
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   177
  // tty->print_cr("Build blocks time: %d", (int)_build_blocks_time.milliseconds());
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   178
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   179
  if(_xml) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   180
    delete _xml;
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   181
    _xml = NULL;
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   182
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  if (_stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
    delete _stream;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
    if (_stream == _output) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
      _output = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
    _stream = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  if (_output) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
    delete _output;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
    _output = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   198
void IdealGraphPrinter::begin_elem(const char *s) {
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 22854
diff changeset
   199
  _xml->begin_elem("%s", s);
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   200
}
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   201
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   202
void IdealGraphPrinter::end_elem() {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   203
  _xml->end_elem();
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   204
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   206
void IdealGraphPrinter::begin_head(const char *s) {
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 22854
diff changeset
   207
  _xml->begin_head("%s", s);
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   208
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   210
void IdealGraphPrinter::end_head() {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   211
  _xml->end_head();
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   212
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   214
void IdealGraphPrinter::print_attr(const char *name, intptr_t val) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   215
  stringStream stream;
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   216
  stream.print(INTX_FORMAT, val);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   217
  print_attr(name, stream.as_string());
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   218
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   220
void IdealGraphPrinter::print_attr(const char *name, const char *val) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   221
  _xml->print(" %s='", name);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   222
  text(val);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   223
  _xml->print("'");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   224
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   226
void IdealGraphPrinter::head(const char *name) {
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 22854
diff changeset
   227
  _xml->head("%s", name);
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   228
}
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   229
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   230
void IdealGraphPrinter::tail(const char *name) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   231
  _xml->tail(name);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   232
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   234
void IdealGraphPrinter::text(const char *s) {
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 22854
diff changeset
   235
  _xml->text("%s", s);
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   236
}
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   237
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   238
void IdealGraphPrinter::print_prop(const char *name, int val) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   239
  stringStream stream;
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   240
  stream.print("%d", val);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   241
  print_prop(name, stream.as_string());
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   242
}
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   243
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   244
void IdealGraphPrinter::print_prop(const char *name, const char *val) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   245
  begin_head(PROPERTY_ELEMENT);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   246
  print_attr(PROPERTY_NAME_PROPERTY, name);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   247
  end_head();
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   248
  text(val);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   249
  tail(PROPERTY_ELEMENT);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
void IdealGraphPrinter::print_method(ciMethod *method, int bci, InlineTree *tree) {
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   253
  begin_head(METHOD_ELEMENT);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  stringStream str;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  method->print_name(&str);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
  stringStream shortStr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
  method->print_short_name(&shortStr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   261
  print_attr(METHOD_NAME_PROPERTY, str.as_string());
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   262
  print_attr(METHOD_SHORT_NAME_PROPERTY, shortStr.as_string());
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   263
  print_attr(METHOD_BCI_PROPERTY, bci);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   265
  end_head();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   267
  head(BYTECODES_ELEMENT);
30591
b32fcc177417 8075492: adopt recent IGV
mhaupt
parents: 27147
diff changeset
   268
  _xml->print_cr("<![CDATA[");
b32fcc177417 8075492: adopt recent IGV
mhaupt
parents: 27147
diff changeset
   269
  method->print_codes_on(_xml);
b32fcc177417 8075492: adopt recent IGV
mhaupt
parents: 27147
diff changeset
   270
  _xml->print_cr("]]>");
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   271
  tail(BYTECODES_ELEMENT);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
30591
b32fcc177417 8075492: adopt recent IGV
mhaupt
parents: 27147
diff changeset
   273
  if (tree != NULL && tree->subtrees().length() > 0) {
b32fcc177417 8075492: adopt recent IGV
mhaupt
parents: 27147
diff changeset
   274
    head(INLINE_ELEMENT);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
    GrowableArray<InlineTree *> subtrees = tree->subtrees();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
    for (int i = 0; i < subtrees.length(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
      print_inline_tree(subtrees.at(i));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
    }
30591
b32fcc177417 8075492: adopt recent IGV
mhaupt
parents: 27147
diff changeset
   279
    tail(INLINE_ELEMENT);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   282
  tail(METHOD_ELEMENT);
30591
b32fcc177417 8075492: adopt recent IGV
mhaupt
parents: 27147
diff changeset
   283
  _xml->flush();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
void IdealGraphPrinter::print_inline_tree(InlineTree *tree) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  if (tree == NULL) return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
  ciMethod *method = tree->method();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  print_method(tree->method(), tree->caller_bci(), tree);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33105
diff changeset
   295
void IdealGraphPrinter::print_inlining() {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
  // Print inline tree
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
  if (_should_send_method) {
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33105
diff changeset
   299
    InlineTree *inlineTree = C->ilt();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
    if (inlineTree != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
      print_inline_tree(inlineTree);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
      // print this method only
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
// Has to be called whenever a method is compiled
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33105
diff changeset
   309
void IdealGraphPrinter::begin_method() {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33105
diff changeset
   311
  ciMethod *method = C->method();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
  assert(_output, "output stream must exist!");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
  assert(method, "null methods are not allowed!");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
  assert(!_current_method, "current method must be null!");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   316
  head(GROUP_ELEMENT);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   318
  head(PROPERTIES_ELEMENT);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
  // Print properties
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
  // Add method name
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
  stringStream strStream;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
  method->print_name(&strStream);
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   324
  print_prop(METHOD_NAME_PROPERTY, strStream.as_string());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
  if (method->flags().is_public()) {
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   327
    print_prop(METHOD_IS_PUBLIC_PROPERTY, TRUE_VALUE);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
  if (method->flags().is_static()) {
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   331
    print_prop(METHOD_IS_STATIC_PROPERTY, TRUE_VALUE);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   334
  tail(PROPERTIES_ELEMENT);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
30591
b32fcc177417 8075492: adopt recent IGV
mhaupt
parents: 27147
diff changeset
   336
  _should_send_method = true;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
  this->_current_method = method;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   339
  _xml->flush();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
// Has to be called whenever a method has finished compilation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
void IdealGraphPrinter::end_method() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
  nmethod* method = (nmethod*)this->_current_method->code();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   347
  tail(GROUP_ELEMENT);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
  _current_method = NULL;
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   349
  _xml->flush();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
// Print indent
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
void IdealGraphPrinter::print_indent() {
30591
b32fcc177417 8075492: adopt recent IGV
mhaupt
parents: 27147
diff changeset
   354
  tty->print_cr("printing indent %d", _depth);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
  for (int i = 0; i < _depth; i++) {
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 22854
diff changeset
   356
    _xml->print("%s", INDENT);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
bool IdealGraphPrinter::traverse_outs() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
  return _traverse_outs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
void IdealGraphPrinter::set_traverse_outs(bool b) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
  _traverse_outs = b;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
10514
e229a19078cf 7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents: 10266
diff changeset
   368
void IdealGraphPrinter::visit_node(Node *n, bool edges, VectorSet* temp_set) {
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   369
10514
e229a19078cf 7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents: 10266
diff changeset
   370
  if (edges) {
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   371
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   372
    // Output edge
30591
b32fcc177417 8075492: adopt recent IGV
mhaupt
parents: 27147
diff changeset
   373
    node_idx_t dest_id = n->_idx;
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   374
    for ( uint i = 0; i < n->len(); i++ ) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   375
      if ( n->in(i) ) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   376
        Node *source = n->in(i);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   377
        begin_elem(EDGE_ELEMENT);
30591
b32fcc177417 8075492: adopt recent IGV
mhaupt
parents: 27147
diff changeset
   378
        print_attr(FROM_PROPERTY, source->_idx);
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   379
        print_attr(TO_PROPERTY, dest_id);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   380
        print_attr(INDEX_PROPERTY, i);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   381
        end_elem();
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   382
      }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   383
    }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   384
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   385
  } else {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   386
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   387
    // Output node
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   388
    begin_head(NODE_ELEMENT);
30591
b32fcc177417 8075492: adopt recent IGV
mhaupt
parents: 27147
diff changeset
   389
    print_attr(NODE_ID_PROPERTY, n->_idx);
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   390
    end_head();
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   391
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   392
    head(PROPERTIES_ELEMENT);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   393
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   394
    Node *node = n;
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   395
#ifndef PRODUCT
22854
2787e48d6df9 8029025: PPC64 (part 203): opto: Move static _in_dump_cnt to Compile object.
goetz
parents: 20716
diff changeset
   396
    Compile::current()->_in_dump_cnt++;
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   397
    print_prop(NODE_NAME_PROPERTY, (const char *)node->Name());
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   398
    const Type *t = node->bottom_type();
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13393
diff changeset
   399
    print_prop("type", t->msg());
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   400
    print_prop("idx", node->_idx);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   401
#ifdef ASSERT
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   402
    print_prop("debug_idx", node->_debug_idx);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   403
#endif
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   404
19279
4be3c2e6663c 8022284: Hide internal data structure in PhaseCFG
adlertz
parents: 17013
diff changeset
   405
    if (C->cfg() != NULL) {
4be3c2e6663c 8022284: Hide internal data structure in PhaseCFG
adlertz
parents: 17013
diff changeset
   406
      Block* block = C->cfg()->get_block_for_node(node);
4be3c2e6663c 8022284: Hide internal data structure in PhaseCFG
adlertz
parents: 17013
diff changeset
   407
      if (block == NULL) {
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   408
        print_prop("block", C->cfg()->get_block(0)->_pre_order);
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   409
      } else {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   410
        print_prop("block", block->_pre_order);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   411
      }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   412
    }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   413
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   414
    const jushort flags = node->flags();
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   415
    if (flags & Node::Flag_is_Copy) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   416
      print_prop("is_copy", "true");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   417
    }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   418
    if (flags & Node::Flag_rematerialize) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   419
      print_prop("rematerialize", "true");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   420
    }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   421
    if (flags & Node::Flag_needs_anti_dependence_check) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   422
      print_prop("needs_anti_dependence_check", "true");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   423
    }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   424
    if (flags & Node::Flag_is_macro) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   425
      print_prop("is_macro", "true");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   426
    }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   427
    if (flags & Node::Flag_is_Con) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   428
      print_prop("is_con", "true");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   429
    }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   430
    if (flags & Node::Flag_is_cisc_alternate) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   431
      print_prop("is_cisc_alternate", "true");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   432
    }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   433
    if (flags & Node::Flag_is_dead_loop_safe) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   434
      print_prop("is_dead_loop_safe", "true");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   435
    }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   436
    if (flags & Node::Flag_may_be_short_branch) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   437
      print_prop("may_be_short_branch", "true");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   438
    }
11196
a310a659c580 7077312: Provide a CALL effect for instruct declaration in the ad file
roland
parents: 10514
diff changeset
   439
    if (flags & Node::Flag_has_call) {
a310a659c580 7077312: Provide a CALL effect for instruct declaration in the ad file
roland
parents: 10514
diff changeset
   440
      print_prop("has_call", "true");
a310a659c580 7077312: Provide a CALL effect for instruct declaration in the ad file
roland
parents: 10514
diff changeset
   441
    }
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   442
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   443
    if (C->matcher() != NULL) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   444
      if (C->matcher()->is_shared(node)) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   445
        print_prop("is_shared", "true");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   446
      } else {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   447
        print_prop("is_shared", "false");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   448
      }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   449
      if (C->matcher()->is_dontcare(node)) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   450
        print_prop("is_dontcare", "true");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   451
      } else {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   452
        print_prop("is_dontcare", "false");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   453
      }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   454
958
4c4709e8b7ee 6712835: Server compiler fails with assertion (loop_count < K,"infinite loop in PhaseIterGVN::transform")
never
parents: 768
diff changeset
   455
#ifdef ASSERT
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   456
      Node* old = C->matcher()->find_old_node(node);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   457
      if (old != NULL) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   458
        print_prop("old_node_idx", old->_idx);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   459
      }
958
4c4709e8b7ee 6712835: Server compiler fails with assertion (loop_count < K,"infinite loop in PhaseIterGVN::transform")
never
parents: 768
diff changeset
   460
#endif
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   461
    }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   462
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   463
    if (node->is_Proj()) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   464
      print_prop("con", (int)node->as_Proj()->_con);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   465
    }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   466
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   467
    if (node->is_Mach()) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   468
      print_prop("idealOpcode", (const char *)NodeClassNames[node->as_Mach()->ideal_Opcode()]);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   469
    }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   470
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   471
    buffer[0] = 0;
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   472
    stringStream s2(buffer, sizeof(buffer) - 1);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   473
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   474
    node->dump_spec(&s2);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   475
    if (t != NULL && (t->isa_instptr() || t->isa_klassptr())) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   476
      const TypeInstPtr  *toop = t->isa_instptr();
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   477
      const TypeKlassPtr *tkls = t->isa_klassptr();
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   478
      ciKlass*           klass = toop ? toop->klass() : (tkls ? tkls->klass() : NULL );
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   479
      if( klass && klass->is_loaded() && klass->is_interface() ) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   480
        s2.print("  Interface:");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   481
      } else if( toop ) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   482
        s2.print("  Oop:");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   483
      } else if( tkls ) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   484
        s2.print("  Klass:");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   485
      }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   486
      t->dump_on(&s2);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   487
    } else if( t == Type::MEMORY ) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   488
      s2.print("  Memory:");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   489
      MemNode::dump_adr_type(node, node->adr_type(), &s2);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   490
    }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   491
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   492
    assert(s2.size() < sizeof(buffer), "size in range");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   493
    print_prop("dump_spec", buffer);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   494
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   495
    if (node->is_block_proj()) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   496
      print_prop("is_block_proj", "true");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   497
    }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   498
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   499
    if (node->is_block_start()) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   500
      print_prop("is_block_start", "true");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   501
    }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   502
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   503
    const char *short_name = "short_name";
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   504
    if (strcmp(node->Name(), "Parm") == 0 && node->as_Proj()->_con >= TypeFunc::Parms) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   505
      int index = node->as_Proj()->_con - TypeFunc::Parms;
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   506
      if (index >= 10) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   507
        print_prop(short_name, "PA");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   508
      } else {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   509
        sprintf(buffer, "P%d", index);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   510
        print_prop(short_name, buffer);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   511
      }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   512
    } else if (strcmp(node->Name(), "IfTrue") == 0) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   513
      print_prop(short_name, "T");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   514
    } else if (strcmp(node->Name(), "IfFalse") == 0) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   515
      print_prop(short_name, "F");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   516
    } else if ((node->is_Con() && node->is_Type()) || node->is_Proj()) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   517
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   518
      if (t->base() == Type::Int && t->is_int()->is_con()) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   519
        const TypeInt *typeInt = t->is_int();
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   520
        assert(typeInt->is_con(), "must be constant");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   521
        jint value = typeInt->get_con();
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   522
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   523
        // max. 2 chars allowed
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   524
        if (value >= -9 && value <= 99) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   525
          sprintf(buffer, "%d", value);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   526
          print_prop(short_name, buffer);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   527
        } else {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   528
          print_prop(short_name, "I");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   529
        }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   530
      } else if (t == Type::TOP) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   531
        print_prop(short_name, "^");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   532
      } else if (t->base() == Type::Long && t->is_long()->is_con()) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   533
        const TypeLong *typeLong = t->is_long();
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   534
        assert(typeLong->is_con(), "must be constant");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   535
        jlong value = typeLong->get_con();
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   536
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   537
        // max. 2 chars allowed
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   538
        if (value >= -9 && value <= 99) {
15228
e92acc84ade3 7102489: RFE: cleanup jlong typedef on __APPLE__and _LLP64 systems.
hseigel
parents: 13728
diff changeset
   539
          sprintf(buffer, JLONG_FORMAT, value);
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   540
          print_prop(short_name, buffer);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   541
        } else {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   542
          print_prop(short_name, "L");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   543
        }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   544
      } else if (t->base() == Type::KlassPtr) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   545
        const TypeKlassPtr *typeKlass = t->is_klassptr();
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   546
        print_prop(short_name, "CP");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   547
      } else if (t->base() == Type::Control) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   548
        print_prop(short_name, "C");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   549
      } else if (t->base() == Type::Memory) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   550
        print_prop(short_name, "M");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   551
      } else if (t->base() == Type::Abio) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   552
        print_prop(short_name, "IO");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   553
      } else if (t->base() == Type::Return_Address) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   554
        print_prop(short_name, "RA");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   555
      } else if (t->base() == Type::AnyPtr) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   556
        print_prop(short_name, "P");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   557
      } else if (t->base() == Type::RawPtr) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   558
        print_prop(short_name, "RP");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   559
      } else if (t->base() == Type::AryPtr) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   560
        print_prop(short_name, "AP");
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   561
      }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   562
    }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   563
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   564
    JVMState* caller = NULL;
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   565
    if (node->is_SafePoint()) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   566
      caller = node->as_SafePoint()->jvms();
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   567
    } else {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   568
      Node_Notes* notes = C->node_notes_at(node->_idx);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   569
      if (notes != NULL) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   570
        caller = notes->jvms();
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   571
      }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   572
    }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   573
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   574
    if (caller != NULL) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   575
      stringStream bciStream;
8870
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   576
      ciMethod* last = NULL;
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   577
      int last_bci;
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   578
      while(caller) {
8870
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   579
        if (caller->has_method()) {
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   580
          last = caller->method();
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   581
          last_bci = caller->bci();
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   582
        }
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   583
        bciStream.print("%d ", caller->bci());
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   584
        caller = caller->caller();
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   585
      }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   586
      print_prop("bci", bciStream.as_string());
8870
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   587
      if (last != NULL && last->has_linenumber_table() && last_bci >= 0) {
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   588
        print_prop("line", last->line_number_from_bci(last_bci));
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   589
      }
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   590
    }
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   591
9946
b3d5b50e2289 7045513: JSR 292 inlining causes crashes in methodHandleWalk.cpp
never
parents: 8870
diff changeset
   592
#ifdef ASSERT
8870
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   593
    if (node->debug_orig() != NULL) {
10514
e229a19078cf 7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents: 10266
diff changeset
   594
      temp_set->Clear();
8870
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   595
      stringStream dorigStream;
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   596
      Node* dorig = node->debug_orig();
10514
e229a19078cf 7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents: 10266
diff changeset
   597
      while (dorig && temp_set->test_set(dorig->_idx)) {
8870
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   598
        dorigStream.print("%d ", dorig->_idx);
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   599
      }
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   600
      print_prop("debug_orig", dorigStream.as_string());
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   601
    }
9946
b3d5b50e2289 7045513: JSR 292 inlining causes crashes in methodHandleWalk.cpp
never
parents: 8870
diff changeset
   602
#endif
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   603
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   604
    if (_chaitin && _chaitin != (PhaseChaitin *)0xdeadbeef) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   605
      buffer[0] = 0;
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   606
      _chaitin->dump_register(node, buffer);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   607
      print_prop("reg", buffer);
20716
5093ad743df4 8009303: Tiered: incorrect results in VM tests stringconcat with -Xcomp -XX:+DeoptimizeALot on solaris-amd64
iveresov
parents: 19717
diff changeset
   608
      uint lrg_id = 0;
5093ad743df4 8009303: Tiered: incorrect results in VM tests stringconcat with -Xcomp -XX:+DeoptimizeALot on solaris-amd64
iveresov
parents: 19717
diff changeset
   609
      if (node->_idx < _chaitin->_lrg_map.size()) {
5093ad743df4 8009303: Tiered: incorrect results in VM tests stringconcat with -Xcomp -XX:+DeoptimizeALot on solaris-amd64
iveresov
parents: 19717
diff changeset
   610
        lrg_id = _chaitin->_lrg_map.live_range_id(node);
5093ad743df4 8009303: Tiered: incorrect results in VM tests stringconcat with -Xcomp -XX:+DeoptimizeALot on solaris-amd64
iveresov
parents: 19717
diff changeset
   611
      }
5093ad743df4 8009303: Tiered: incorrect results in VM tests stringconcat with -Xcomp -XX:+DeoptimizeALot on solaris-amd64
iveresov
parents: 19717
diff changeset
   612
      print_prop("lrg", lrg_id);
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   613
    }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   614
22854
2787e48d6df9 8029025: PPC64 (part 203): opto: Move static _in_dump_cnt to Compile object.
goetz
parents: 20716
diff changeset
   615
    Compile::current()->_in_dump_cnt--;
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   616
#endif
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   617
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   618
    tail(PROPERTIES_ELEMENT);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   619
    tail(NODE_ELEMENT);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   620
  }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   621
}
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   622
10514
e229a19078cf 7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents: 10266
diff changeset
   623
void IdealGraphPrinter::walk_nodes(Node *start, bool edges, VectorSet* temp_set) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   624
489c9b5090e2 Initial load
duke
parents:
diff changeset
   625
489c9b5090e2 Initial load
duke
parents:
diff changeset
   626
  VectorSet visited(Thread::current()->resource_area());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   627
  GrowableArray<Node *> nodeStack(Thread::current()->resource_area(), 0, 0, NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   628
  nodeStack.push(start);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   629
  visited.test_set(start->_idx);
8870
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   630
  if (C->cfg() != NULL) {
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   631
    // once we have a CFG there are some nodes that aren't really
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   632
    // reachable but are in the CFG so add them here.
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   633
    for (uint i = 0; i < C->cfg()->number_of_blocks(); i++) {
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   634
      Block* block = C->cfg()->get_block(i);
19717
7819ffdaf0ff 8023691: Create interface for nodes in class Block
adlertz
parents: 19330
diff changeset
   635
      for (uint s = 0; s < block->number_of_nodes(); s++) {
7819ffdaf0ff 8023691: Create interface for nodes in class Block
adlertz
parents: 19330
diff changeset
   636
        nodeStack.push(block->get_node(s));
8870
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   637
      }
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   638
    }
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   639
  }
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   640
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   641
  while(nodeStack.length() > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   642
489c9b5090e2 Initial load
duke
parents:
diff changeset
   643
    Node *n = nodeStack.pop();
10514
e229a19078cf 7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents: 10266
diff changeset
   644
    visit_node(n, edges, temp_set);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   645
489c9b5090e2 Initial load
duke
parents:
diff changeset
   646
    if (_traverse_outs) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   647
      for (DUIterator i = n->outs(); n->has_out(i); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   648
        Node* p = n->out(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   649
        if (!visited.test_set(p->_idx)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   650
          nodeStack.push(p);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   651
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   652
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   653
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   654
489c9b5090e2 Initial load
duke
parents:
diff changeset
   655
    for ( uint i = 0; i < n->len(); i++ ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   656
      if ( n->in(i) ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   657
        if (!visited.test_set(n->in(i)->_idx)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   658
          nodeStack.push(n->in(i));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   659
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   660
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   661
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   662
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   663
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   664
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33105
diff changeset
   665
void IdealGraphPrinter::print_method(const char *name, int level, bool clear_nodes) {
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33105
diff changeset
   666
  print(name, (Node *)C->root(), level, clear_nodes);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   667
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   668
489c9b5090e2 Initial load
duke
parents:
diff changeset
   669
// Print current ideal graph
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33105
diff changeset
   670
void IdealGraphPrinter::print(const char *name, Node *node, int level, bool clear_nodes) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   671
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33105
diff changeset
   672
  if (!_current_method || !_should_send_method || !should_print(level)) return;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   673
489c9b5090e2 Initial load
duke
parents:
diff changeset
   674
  // Warning, unsafe cast?
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   675
  _chaitin = (PhaseChaitin *)C->regalloc();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   676
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   677
  begin_head(GRAPH_ELEMENT);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   678
  print_attr(GRAPH_NAME_PROPERTY, (const char *)name);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   679
  end_head();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   680
10514
e229a19078cf 7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents: 10266
diff changeset
   681
  VectorSet temp_set(Thread::current()->resource_area());
e229a19078cf 7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents: 10266
diff changeset
   682
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   683
  head(NODES_ELEMENT);
10514
e229a19078cf 7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents: 10266
diff changeset
   684
  walk_nodes(node, false, &temp_set);
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   685
  tail(NODES_ELEMENT);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   686
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   687
  head(EDGES_ELEMENT);
10514
e229a19078cf 7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents: 10266
diff changeset
   688
  walk_nodes(node, true, &temp_set);
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   689
  tail(EDGES_ELEMENT);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   690
  if (C->cfg() != NULL) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   691
    head(CONTROL_FLOW_ELEMENT);
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   692
    for (uint i = 0; i < C->cfg()->number_of_blocks(); i++) {
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   693
      Block* block = C->cfg()->get_block(i);
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   694
      begin_head(BLOCK_ELEMENT);
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   695
      print_attr(BLOCK_NAME_PROPERTY, block->_pre_order);
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   696
      end_head();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   697
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   698
      head(SUCCESSORS_ELEMENT);
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   699
      for (uint s = 0; s < block->_num_succs; s++) {
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   700
        begin_elem(SUCCESSOR_ELEMENT);
19330
49d6711171e6 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 19279
diff changeset
   701
        print_attr(BLOCK_NAME_PROPERTY, block->_succs[s]->_pre_order);
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   702
        end_elem();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   703
      }
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   704
      tail(SUCCESSORS_ELEMENT);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   705
8870
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   706
      head(NODES_ELEMENT);
19717
7819ffdaf0ff 8023691: Create interface for nodes in class Block
adlertz
parents: 19330
diff changeset
   707
      for (uint s = 0; s < block->number_of_nodes(); s++) {
8870
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   708
        begin_elem(NODE_ELEMENT);
30591
b32fcc177417 8075492: adopt recent IGV
mhaupt
parents: 27147
diff changeset
   709
        print_attr(NODE_ID_PROPERTY, block->get_node(s)->_idx);
8870
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   710
        end_elem();
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   711
      }
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   712
      tail(NODES_ELEMENT);
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents: 7397
diff changeset
   713
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   714
      tail(BLOCK_ELEMENT);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   715
    }
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   716
    tail(CONTROL_FLOW_ELEMENT);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   717
  }
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   718
  tail(GRAPH_ELEMENT);
30591
b32fcc177417 8075492: adopt recent IGV
mhaupt
parents: 27147
diff changeset
   719
  _xml->flush();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   720
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   721
27147
ed83dc5777e6 8060215: per-method PrintIdealGraphLevel
zmajo
parents: 24424
diff changeset
   722
// Should method be printed?
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33105
diff changeset
   723
bool IdealGraphPrinter::should_print(int level) {
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33105
diff changeset
   724
  return C->directive()->IGVPrintLevelOption >= level;
27147
ed83dc5777e6 8060215: per-method PrintIdealGraphLevel
zmajo
parents: 24424
diff changeset
   725
}
ed83dc5777e6 8060215: per-method PrintIdealGraphLevel
zmajo
parents: 24424
diff changeset
   726
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   727
extern const char *NodeClassNames[];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   728
489c9b5090e2 Initial load
duke
parents:
diff changeset
   729
#endif