1 /* |
1 /* |
2 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
597 } |
597 } |
598 } |
598 } |
599 |
599 |
600 if (caller != NULL) { |
600 if (caller != NULL) { |
601 stringStream bciStream; |
601 stringStream bciStream; |
|
602 ciMethod* last = NULL; |
|
603 int last_bci; |
602 while(caller) { |
604 while(caller) { |
|
605 if (caller->has_method()) { |
|
606 last = caller->method(); |
|
607 last_bci = caller->bci(); |
|
608 } |
603 bciStream.print("%d ", caller->bci()); |
609 bciStream.print("%d ", caller->bci()); |
604 caller = caller->caller(); |
610 caller = caller->caller(); |
605 } |
611 } |
606 print_prop("bci", bciStream.as_string()); |
612 print_prop("bci", bciStream.as_string()); |
|
613 if (last != NULL && last->has_linenumber_table() && last_bci >= 0) { |
|
614 print_prop("line", last->line_number_from_bci(last_bci)); |
|
615 } |
|
616 } |
|
617 |
|
618 if (node->debug_orig() != NULL) { |
|
619 stringStream dorigStream; |
|
620 Node* dorig = node->debug_orig(); |
|
621 if (dorig) { |
|
622 dorigStream.print("%d ", dorig->_idx); |
|
623 Node* first = dorig; |
|
624 dorig = first->debug_orig(); |
|
625 while (dorig && dorig != first) { |
|
626 dorigStream.print("%d ", dorig->_idx); |
|
627 dorig = dorig->debug_orig(); |
|
628 } |
|
629 } |
|
630 print_prop("debug_orig", dorigStream.as_string()); |
607 } |
631 } |
608 |
632 |
609 if (_chaitin && _chaitin != (PhaseChaitin *)0xdeadbeef) { |
633 if (_chaitin && _chaitin != (PhaseChaitin *)0xdeadbeef) { |
610 buffer[0] = 0; |
634 buffer[0] = 0; |
611 _chaitin->dump_register(node, buffer); |
635 _chaitin->dump_register(node, buffer); |
626 |
650 |
627 VectorSet visited(Thread::current()->resource_area()); |
651 VectorSet visited(Thread::current()->resource_area()); |
628 GrowableArray<Node *> nodeStack(Thread::current()->resource_area(), 0, 0, NULL); |
652 GrowableArray<Node *> nodeStack(Thread::current()->resource_area(), 0, 0, NULL); |
629 nodeStack.push(start); |
653 nodeStack.push(start); |
630 visited.test_set(start->_idx); |
654 visited.test_set(start->_idx); |
|
655 if (C->cfg() != NULL) { |
|
656 // once we have a CFG there are some nodes that aren't really |
|
657 // reachable but are in the CFG so add them here. |
|
658 for (uint i = 0; i < C->cfg()->_blocks.size(); i++) { |
|
659 Block *b = C->cfg()->_blocks[i]; |
|
660 for (uint s = 0; s < b->_nodes.size(); s++) { |
|
661 nodeStack.push(b->_nodes[s]); |
|
662 } |
|
663 } |
|
664 } |
|
665 |
631 while(nodeStack.length() > 0) { |
666 while(nodeStack.length() > 0) { |
632 |
667 |
633 Node *n = nodeStack.pop(); |
668 Node *n = nodeStack.pop(); |
634 visit_node(n, param); |
669 visit_node(n, param); |
635 |
670 |
684 begin_head(BLOCK_ELEMENT); |
719 begin_head(BLOCK_ELEMENT); |
685 print_attr(BLOCK_NAME_PROPERTY, b->_pre_order); |
720 print_attr(BLOCK_NAME_PROPERTY, b->_pre_order); |
686 end_head(); |
721 end_head(); |
687 |
722 |
688 head(SUCCESSORS_ELEMENT); |
723 head(SUCCESSORS_ELEMENT); |
689 for (uint s = 0; s < C->cfg()->_blocks[i]->_num_succs; s++) { |
724 for (uint s = 0; s < b->_num_succs; s++) { |
690 begin_elem(SUCCESSOR_ELEMENT); |
725 begin_elem(SUCCESSOR_ELEMENT); |
691 print_attr(BLOCK_NAME_PROPERTY, b->_succs[s]->_pre_order); |
726 print_attr(BLOCK_NAME_PROPERTY, b->_succs[s]->_pre_order); |
692 end_elem(); |
727 end_elem(); |
693 } |
728 } |
694 tail(SUCCESSORS_ELEMENT); |
729 tail(SUCCESSORS_ELEMENT); |
695 |
730 |
|
731 head(NODES_ELEMENT); |
|
732 for (uint s = 0; s < b->_nodes.size(); s++) { |
|
733 begin_elem(NODE_ELEMENT); |
|
734 print_attr(NODE_ID_PROPERTY, get_node_id(b->_nodes[s])); |
|
735 end_elem(); |
|
736 } |
|
737 tail(NODES_ELEMENT); |
|
738 |
696 tail(BLOCK_ELEMENT); |
739 tail(BLOCK_ELEMENT); |
697 } |
740 } |
698 |
|
699 tail(CONTROL_FLOW_ELEMENT); |
741 tail(CONTROL_FLOW_ELEMENT); |
700 } |
742 } |
701 tail(GRAPH_ELEMENT); |
743 tail(GRAPH_ELEMENT); |
702 output()->flush(); |
744 output()->flush(); |
703 } |
745 } |