Mon, 25 May 2020 14:24:27 +0800
8244407: JVM crashes after transformation in C2 IdealLoopTree::split_fall_in
Reviewed-by: thartmann, kvn, andrew
Contributed-by: zhouyong44@huawei.com
duke@435 | 1 | /* |
minqi@5103 | 2 | * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
stefank@2314 | 25 | #ifndef SHARE_VM_OPTO_IDEALGRAPHPRINTER_HPP |
stefank@2314 | 26 | #define SHARE_VM_OPTO_IDEALGRAPHPRINTER_HPP |
stefank@2314 | 27 | |
stefank@2314 | 28 | #include "libadt/dict.hpp" |
stefank@2314 | 29 | #include "libadt/vectset.hpp" |
stefank@2314 | 30 | #include "utilities/growableArray.hpp" |
stefank@2314 | 31 | #include "utilities/ostream.hpp" |
stefank@2314 | 32 | #include "utilities/xmlstream.hpp" |
stefank@2314 | 33 | |
duke@435 | 34 | #ifndef PRODUCT |
duke@435 | 35 | |
duke@435 | 36 | class Compile; |
duke@435 | 37 | class PhaseIFG; |
duke@435 | 38 | class PhaseChaitin; |
duke@435 | 39 | class Matcher; |
duke@435 | 40 | class Node; |
duke@435 | 41 | class InlineTree; |
duke@435 | 42 | class ciMethod; |
duke@435 | 43 | |
minqi@5103 | 44 | class IdealGraphPrinter : public CHeapObj<mtCompiler> { |
minqi@5103 | 45 | private: |
duke@435 | 46 | |
duke@435 | 47 | static const char *INDENT; |
duke@435 | 48 | static const char *TOP_ELEMENT; |
duke@435 | 49 | static const char *GROUP_ELEMENT; |
duke@435 | 50 | static const char *GRAPH_ELEMENT; |
duke@435 | 51 | static const char *PROPERTIES_ELEMENT; |
duke@435 | 52 | static const char *EDGES_ELEMENT; |
duke@435 | 53 | static const char *PROPERTY_ELEMENT; |
duke@435 | 54 | static const char *EDGE_ELEMENT; |
duke@435 | 55 | static const char *NODE_ELEMENT; |
duke@435 | 56 | static const char *NODES_ELEMENT; |
duke@435 | 57 | static const char *CONTROL_FLOW_ELEMENT; |
duke@435 | 58 | static const char *REMOVE_EDGE_ELEMENT; |
duke@435 | 59 | static const char *REMOVE_NODE_ELEMENT; |
duke@435 | 60 | static const char *METHOD_NAME_PROPERTY; |
duke@435 | 61 | static const char *BLOCK_NAME_PROPERTY; |
duke@435 | 62 | static const char *BLOCK_DOMINATOR_PROPERTY; |
duke@435 | 63 | static const char *BLOCK_ELEMENT; |
duke@435 | 64 | static const char *SUCCESSORS_ELEMENT; |
duke@435 | 65 | static const char *SUCCESSOR_ELEMENT; |
duke@435 | 66 | static const char *METHOD_IS_PUBLIC_PROPERTY; |
duke@435 | 67 | static const char *METHOD_IS_STATIC_PROPERTY; |
duke@435 | 68 | static const char *TRUE_VALUE; |
duke@435 | 69 | static const char *NODE_NAME_PROPERTY; |
duke@435 | 70 | static const char *EDGE_NAME_PROPERTY; |
duke@435 | 71 | static const char *NODE_ID_PROPERTY; |
duke@435 | 72 | static const char *FROM_PROPERTY; |
duke@435 | 73 | static const char *TO_PROPERTY; |
duke@435 | 74 | static const char *PROPERTY_NAME_PROPERTY; |
duke@435 | 75 | static const char *GRAPH_NAME_PROPERTY; |
duke@435 | 76 | static const char *INDEX_PROPERTY; |
duke@435 | 77 | static const char *METHOD_ELEMENT; |
duke@435 | 78 | static const char *INLINE_ELEMENT; |
duke@435 | 79 | static const char *BYTECODES_ELEMENT; |
duke@435 | 80 | static const char *METHOD_BCI_PROPERTY; |
duke@435 | 81 | static const char *METHOD_SHORT_NAME_PROPERTY; |
duke@435 | 82 | static const char *ASSEMBLY_ELEMENT; |
duke@435 | 83 | |
never@657 | 84 | elapsedTimer _walk_time; |
never@657 | 85 | elapsedTimer _output_time; |
never@657 | 86 | elapsedTimer _build_blocks_time; |
duke@435 | 87 | |
duke@435 | 88 | static int _file_count; |
duke@435 | 89 | networkStream *_stream; |
never@657 | 90 | xmlStream *_xml; |
duke@435 | 91 | outputStream *_output; |
duke@435 | 92 | ciMethod *_current_method; |
duke@435 | 93 | int _depth; |
duke@435 | 94 | char buffer[128]; |
duke@435 | 95 | bool _should_send_method; |
duke@435 | 96 | PhaseChaitin* _chaitin; |
duke@435 | 97 | bool _traverse_outs; |
never@657 | 98 | Compile *C; |
duke@435 | 99 | |
duke@435 | 100 | static void pre_node(Node* node, void *env); |
duke@435 | 101 | static void post_node(Node* node, void *env); |
duke@435 | 102 | |
duke@435 | 103 | void print_indent(); |
duke@435 | 104 | void print_method(ciMethod *method, int bci, InlineTree *tree); |
duke@435 | 105 | void print_inline_tree(InlineTree *tree); |
never@3105 | 106 | void visit_node(Node *n, bool edges, VectorSet* temp_set); |
never@3105 | 107 | void walk_nodes(Node *start, bool edges, VectorSet* temp_set); |
never@657 | 108 | void begin_elem(const char *s); |
never@657 | 109 | void end_elem(); |
never@657 | 110 | void begin_head(const char *s); |
never@657 | 111 | void end_head(); |
never@657 | 112 | void print_attr(const char *name, const char *val); |
never@657 | 113 | void print_attr(const char *name, intptr_t val); |
never@657 | 114 | void print_prop(const char *name, const char *val); |
never@657 | 115 | void print_prop(const char *name, int val); |
never@657 | 116 | void tail(const char *name); |
never@657 | 117 | void head(const char *name); |
never@657 | 118 | void text(const char *s); |
never@657 | 119 | intptr_t get_node_id(Node *n); |
duke@435 | 120 | IdealGraphPrinter(); |
duke@435 | 121 | ~IdealGraphPrinter(); |
duke@435 | 122 | |
minqi@5103 | 123 | public: |
duke@435 | 124 | |
duke@435 | 125 | static void clean_up(); |
duke@435 | 126 | static IdealGraphPrinter *printer(); |
duke@435 | 127 | |
duke@435 | 128 | bool traverse_outs(); |
duke@435 | 129 | void set_traverse_outs(bool b); |
duke@435 | 130 | outputStream *output(); |
duke@435 | 131 | void print_inlining(Compile* compile); |
duke@435 | 132 | void begin_method(Compile* compile); |
duke@435 | 133 | void end_method(); |
duke@435 | 134 | void print_method(Compile* compile, const char *name, int level=1, bool clear_nodes = false); |
duke@435 | 135 | void print(Compile* compile, const char *name, Node *root, int level=1, bool clear_nodes = false); |
duke@435 | 136 | void print_xml(const char *name); |
duke@435 | 137 | }; |
duke@435 | 138 | |
duke@435 | 139 | #endif |
stefank@2314 | 140 | |
stefank@2314 | 141 | #endif // SHARE_VM_OPTO_IDEALGRAPHPRINTER_HPP |