1.1 --- a/src/share/vm/opto/idealGraphPrinter.hpp Tue Jun 24 10:43:29 2008 -0700 1.2 +++ b/src/share/vm/opto/idealGraphPrinter.hpp Tue Jun 24 16:00:14 2008 -0700 1.3 @@ -82,222 +82,42 @@ 1.4 static const char *METHOD_SHORT_NAME_PROPERTY; 1.5 static const char *ASSEMBLY_ELEMENT; 1.6 1.7 - class Property { 1.8 - 1.9 - private: 1.10 - 1.11 - const char *_name; 1.12 - const char *_value; 1.13 - 1.14 - public: 1.15 - 1.16 - Property(); 1.17 - Property(const Property* p); 1.18 - ~Property(); 1.19 - Property(const char *name, const char *value); 1.20 - Property(const char *name, int value); 1.21 - bool equals(Property* p); 1.22 - void print(IdealGraphPrinter *printer); 1.23 - void print_as_attribute(IdealGraphPrinter *printer); 1.24 - bool is_null(); 1.25 - void clean(); 1.26 - const char *name(); 1.27 - 1.28 - static const char* dup(const char *str) { 1.29 - char * copy = new char[strlen(str)+1]; 1.30 - strcpy(copy, str); 1.31 - return copy; 1.32 - } 1.33 - 1.34 - }; 1.35 - 1.36 - class Properties { 1.37 - 1.38 - private: 1.39 - 1.40 - GrowableArray<Property *> *list; 1.41 - 1.42 - public: 1.43 - 1.44 - Properties(); 1.45 - ~Properties(); 1.46 - void add(Property *p); 1.47 - void remove(const char *name); 1.48 - bool equals(Properties* p); 1.49 - void print(IdealGraphPrinter *printer); 1.50 - void print_as_attributes(IdealGraphPrinter *printer); 1.51 - void clean(); 1.52 - 1.53 - }; 1.54 - 1.55 - 1.56 - class Description { 1.57 - 1.58 - private: 1.59 - 1.60 - State _state; 1.61 - 1.62 - public: 1.63 - 1.64 - Description(); 1.65 - 1.66 - State state(); 1.67 - void set_state(State s); 1.68 - void print(IdealGraphPrinter *printer); 1.69 - virtual void print_changed(IdealGraphPrinter *printer) = 0; 1.70 - virtual void print_removed(IdealGraphPrinter *printer) = 0; 1.71 - 1.72 - }; 1.73 - 1.74 - class NodeDescription : public Description{ 1.75 - 1.76 - public: 1.77 - 1.78 - static int count; 1.79 - 1.80 - private: 1.81 - 1.82 - GrowableArray<NodeDescription *> _succs; 1.83 - int _block_index; 1.84 - uintptr_t _id; 1.85 - Properties _properties; 1.86 - Node* _node; 1.87 - 1.88 - public: 1.89 - 1.90 - NodeDescription(Node* node); 1.91 - ~NodeDescription(); 1.92 - Node* node(); 1.93 - 1.94 - // void set_node(Node* node); 1.95 - GrowableArray<NodeDescription *>* succs(); 1.96 - void init_succs(); 1.97 - void clear_succs(); 1.98 - void add_succ(NodeDescription *desc); 1.99 - int block_index(); 1.100 - void set_block_index(int i); 1.101 - Properties* properties(); 1.102 - virtual void print_changed(IdealGraphPrinter *printer); 1.103 - virtual void print_removed(IdealGraphPrinter *printer); 1.104 - bool equals(NodeDescription *desc); 1.105 - uint id(); 1.106 - 1.107 - }; 1.108 - 1.109 - class Block { 1.110 - 1.111 - private: 1.112 - 1.113 - NodeDescription *_start; 1.114 - NodeDescription *_proj; 1.115 - GrowableArray<int> _succs; 1.116 - GrowableArray<NodeDescription *> _nodes; 1.117 - GrowableArray<int> _dominates; 1.118 - GrowableArray<int> _children; 1.119 - int _semi; 1.120 - int _parent; 1.121 - GrowableArray<int> _pred; 1.122 - GrowableArray<int> _bucket; 1.123 - int _index; 1.124 - int _dominator; 1.125 - int _ancestor; 1.126 - int _label; 1.127 - 1.128 - public: 1.129 - 1.130 - Block(); 1.131 - Block(int index); 1.132 - 1.133 - void add_node(NodeDescription *n); 1.134 - GrowableArray<NodeDescription *>* nodes(); 1.135 - GrowableArray<int>* children(); 1.136 - void add_child(int i); 1.137 - void add_succ(int index); 1.138 - GrowableArray<int>* succs(); 1.139 - GrowableArray<int>* dominates(); 1.140 - void add_dominates(int i); 1.141 - NodeDescription *start(); 1.142 - NodeDescription *proj(); 1.143 - void set_start(NodeDescription *n); 1.144 - void set_proj(NodeDescription *n); 1.145 - 1.146 - int label(); 1.147 - void set_label(int i); 1.148 - int ancestor(); 1.149 - void set_ancestor(int i); 1.150 - int index(); 1.151 - int dominator(); 1.152 - void set_dominator(int i); 1.153 - int parent(); 1.154 - void set_parent(int i); 1.155 - int semi(); 1.156 - GrowableArray<int>* bucket(); 1.157 - void add_to_bucket(int i); 1.158 - void clear_bucket(); 1.159 - GrowableArray<int>* pred(); 1.160 - void set_semi(int i); 1.161 - void add_pred(int i); 1.162 - 1.163 - }; 1.164 - 1.165 - class EdgeDescription : public Description { 1.166 - 1.167 - private: 1.168 - 1.169 - int _from; 1.170 - int _to; 1.171 - int _index; 1.172 - public: 1.173 - 1.174 - EdgeDescription(int from, int to, int index); 1.175 - ~EdgeDescription(); 1.176 - 1.177 - virtual void print_changed(IdealGraphPrinter *printer); 1.178 - virtual void print_removed(IdealGraphPrinter *printer); 1.179 - bool equals(EdgeDescription *desc); 1.180 - int from(); 1.181 - int to(); 1.182 - }; 1.183 - 1.184 + elapsedTimer _walk_time; 1.185 + elapsedTimer _output_time; 1.186 + elapsedTimer _build_blocks_time; 1.187 1.188 static int _file_count; 1.189 networkStream *_stream; 1.190 + xmlStream *_xml; 1.191 outputStream *_output; 1.192 ciMethod *_current_method; 1.193 - GrowableArray<NodeDescription *> _nodes; 1.194 - GrowableArray<EdgeDescription *> _edges; 1.195 int _depth; 1.196 - Arena *_arena; 1.197 char buffer[128]; 1.198 bool _should_send_method; 1.199 PhaseChaitin* _chaitin; 1.200 - bool _clear_nodes; 1.201 - Matcher* _matcher; 1.202 bool _traverse_outs; 1.203 - 1.204 - void start_element_helper(const char *name, Properties *properties, bool endElement, bool print_indent = false, bool print_return = true); 1.205 - NodeDescription *create_node_description(Node* node); 1.206 + Compile *C; 1.207 1.208 static void pre_node(Node* node, void *env); 1.209 static void post_node(Node* node, void *env); 1.210 1.211 - void schedule_latest(int **common_dominator, GrowableArray<Block>* blocks); 1.212 - void build_common_dominator(int **common_dominator, int index, GrowableArray<Block>* blocks); 1.213 - void compress(int index, GrowableArray<Block>* blocks); 1.214 - int eval(int index, GrowableArray<Block>* blocks); 1.215 - void link(int index1, int index2, GrowableArray<Block>* blocks); 1.216 - void build_dominators(GrowableArray<Block>* blocks); 1.217 - void build_blocks(Node *node); 1.218 - void walk(Node *n); 1.219 - void start_element(const char *name, Properties *properties = NULL, bool print_indent = false, bool print_return = true); 1.220 - void simple_element(const char *name, Properties *properties = NULL, bool print_indent = false); 1.221 - void end_element(const char *name, bool print_indent = false, bool print_return = true); 1.222 - void print_edge(int from, int to, int index); 1.223 void print_indent(); 1.224 void print_method(ciMethod *method, int bci, InlineTree *tree); 1.225 void print_inline_tree(InlineTree *tree); 1.226 - void clear_nodes(); 1.227 - 1.228 + void visit_node(Node *n, void *param); 1.229 + void walk_nodes(Node *start, void *param); 1.230 + void begin_elem(const char *s); 1.231 + void end_elem(); 1.232 + void begin_head(const char *s); 1.233 + void end_head(); 1.234 + void print_attr(const char *name, const char *val); 1.235 + void print_attr(const char *name, intptr_t val); 1.236 + void print_prop(const char *name, const char *val); 1.237 + void print_prop(const char *name, int val); 1.238 + void tail(const char *name); 1.239 + void head(const char *name); 1.240 + void text(const char *s); 1.241 + intptr_t get_node_id(Node *n); 1.242 IdealGraphPrinter(); 1.243 ~IdealGraphPrinter(); 1.244 1.245 @@ -308,7 +128,6 @@ 1.246 1.247 bool traverse_outs(); 1.248 void set_traverse_outs(bool b); 1.249 - void print_ifg(PhaseIFG* ifg); 1.250 outputStream *output(); 1.251 void print_inlining(Compile* compile); 1.252 void begin_method(Compile* compile);