Mercurial > hg > truffle
comparison src/share/vm/opto/idealGraphPrinter.cpp @ 3905:c26de9aef2ed
7071307: MethodHandle bimorphic inlining should consider the frequency
Reviewed-by: twisti, roland, kvn, iveresov
author | never |
---|---|
date | Fri, 02 Sep 2011 20:58:21 -0700 |
parents | 11211f7cb5a0 |
children | f03a3c8bd5e5 |
comparison
equal
deleted
inserted
replaced
3902:11a4af030e4b | 3905:c26de9aef2ed |
---|---|
373 | 373 |
374 intptr_t IdealGraphPrinter::get_node_id(Node *n) { | 374 intptr_t IdealGraphPrinter::get_node_id(Node *n) { |
375 return (intptr_t)(n); | 375 return (intptr_t)(n); |
376 } | 376 } |
377 | 377 |
378 void IdealGraphPrinter::visit_node(Node *n, void *param) { | 378 void IdealGraphPrinter::visit_node(Node *n, bool edges, VectorSet* temp_set) { |
379 | 379 |
380 if(param) { | 380 if (edges) { |
381 | 381 |
382 // Output edge | 382 // Output edge |
383 intptr_t dest_id = get_node_id(n); | 383 intptr_t dest_id = get_node_id(n); |
384 for ( uint i = 0; i < n->len(); i++ ) { | 384 for ( uint i = 0; i < n->len(); i++ ) { |
385 if ( n->in(i) ) { | 385 if ( n->in(i) ) { |
597 } | 597 } |
598 } | 598 } |
599 | 599 |
600 #ifdef ASSERT | 600 #ifdef ASSERT |
601 if (node->debug_orig() != NULL) { | 601 if (node->debug_orig() != NULL) { |
602 temp_set->Clear(); | |
602 stringStream dorigStream; | 603 stringStream dorigStream; |
603 Node* dorig = node->debug_orig(); | 604 Node* dorig = node->debug_orig(); |
604 if (dorig) { | 605 while (dorig && temp_set->test_set(dorig->_idx)) { |
605 dorigStream.print("%d ", dorig->_idx); | 606 dorigStream.print("%d ", dorig->_idx); |
606 Node* first = dorig; | |
607 dorig = first->debug_orig(); | |
608 while (dorig && dorig != first) { | |
609 dorigStream.print("%d ", dorig->_idx); | |
610 dorig = dorig->debug_orig(); | |
611 } | |
612 } | 607 } |
613 print_prop("debug_orig", dorigStream.as_string()); | 608 print_prop("debug_orig", dorigStream.as_string()); |
614 } | 609 } |
615 #endif | 610 #endif |
616 | 611 |
627 tail(PROPERTIES_ELEMENT); | 622 tail(PROPERTIES_ELEMENT); |
628 tail(NODE_ELEMENT); | 623 tail(NODE_ELEMENT); |
629 } | 624 } |
630 } | 625 } |
631 | 626 |
632 void IdealGraphPrinter::walk_nodes(Node *start, void *param) { | 627 void IdealGraphPrinter::walk_nodes(Node *start, bool edges, VectorSet* temp_set) { |
633 | 628 |
634 | 629 |
635 VectorSet visited(Thread::current()->resource_area()); | 630 VectorSet visited(Thread::current()->resource_area()); |
636 GrowableArray<Node *> nodeStack(Thread::current()->resource_area(), 0, 0, NULL); | 631 GrowableArray<Node *> nodeStack(Thread::current()->resource_area(), 0, 0, NULL); |
637 nodeStack.push(start); | 632 nodeStack.push(start); |
648 } | 643 } |
649 | 644 |
650 while(nodeStack.length() > 0) { | 645 while(nodeStack.length() > 0) { |
651 | 646 |
652 Node *n = nodeStack.pop(); | 647 Node *n = nodeStack.pop(); |
653 visit_node(n, param); | 648 visit_node(n, edges, temp_set); |
654 | 649 |
655 if (_traverse_outs) { | 650 if (_traverse_outs) { |
656 for (DUIterator i = n->outs(); n->has_out(i); i++) { | 651 for (DUIterator i = n->outs(); n->has_out(i); i++) { |
657 Node* p = n->out(i); | 652 Node* p = n->out(i); |
658 if (!visited.test_set(p->_idx)) { | 653 if (!visited.test_set(p->_idx)) { |
687 | 682 |
688 begin_head(GRAPH_ELEMENT); | 683 begin_head(GRAPH_ELEMENT); |
689 print_attr(GRAPH_NAME_PROPERTY, (const char *)name); | 684 print_attr(GRAPH_NAME_PROPERTY, (const char *)name); |
690 end_head(); | 685 end_head(); |
691 | 686 |
687 VectorSet temp_set(Thread::current()->resource_area()); | |
688 | |
692 head(NODES_ELEMENT); | 689 head(NODES_ELEMENT); |
693 walk_nodes(node, NULL); | 690 walk_nodes(node, false, &temp_set); |
694 tail(NODES_ELEMENT); | 691 tail(NODES_ELEMENT); |
695 | 692 |
696 head(EDGES_ELEMENT); | 693 head(EDGES_ELEMENT); |
697 walk_nodes(node, (void *)1); | 694 walk_nodes(node, true, &temp_set); |
698 tail(EDGES_ELEMENT); | 695 tail(EDGES_ELEMENT); |
699 if (C->cfg() != NULL) { | 696 if (C->cfg() != NULL) { |
700 head(CONTROL_FLOW_ELEMENT); | 697 head(CONTROL_FLOW_ELEMENT); |
701 for (uint i = 0; i < C->cfg()->_blocks.size(); i++) { | 698 for (uint i = 0; i < C->cfg()->_blocks.size(); i++) { |
702 Block *b = C->cfg()->_blocks[i]; | 699 Block *b = C->cfg()->_blocks[i]; |