877 if( _blocks[i] == NULL ) continue;
878 _blocks[i]->dump_head(&_bbs);
879 }
880 }
881
882 void PhaseCFG::verify( ) const {
883 // Verify sane CFG
884 for( uint i = 0; i < _num_blocks; i++ ) {
885 Block *b = _blocks[i];
886 uint cnt = b->_nodes.size();
887 uint j;
888 for( j = 0; j < cnt; j++ ) {
889 Node *n = b->_nodes[j];
890 assert( _bbs[n->_idx] == b, "" );
891 if( j >= 1 && n->is_Mach() &&
892 n->as_Mach()->ideal_Opcode() == Op_CreateEx ) {
893 assert( j == 1 || b->_nodes[j-1]->is_Phi(),
894 "CreateEx must be first instruction in block" );
895 }
896 for( uint k = 0; k < n->req(); k++ ) {
897 Node *use = n->in(k);
898 if( use && use != n ) {
899 assert( _bbs[use->_idx] || use->is_Con(),
900 "must have block; constants for debug info ok" );
901 }
902 }
903 }
904
905 j = b->end_idx();
906 Node *bp = (Node*)b->_nodes[b->_nodes.size()-1]->is_block_proj();
907 assert( bp, "last instruction must be a block proj" );
908 assert( bp == b->_nodes[j], "wrong number of successors for this block" );
909 if( bp->is_Catch() ) {
910 while( b->_nodes[--j]->Opcode() == Op_MachProj ) ;
911 assert( b->_nodes[j]->is_Call(), "CatchProj must follow call" );
912 }
913 else if( bp->is_Mach() && bp->as_Mach()->ideal_Opcode() == Op_If ) {
914 assert( b->_num_succs == 2, "Conditional branch must have two targets");
915 }
916 }
917 }
918 #endif
919
920 //=============================================================================
921 //------------------------------UnionFind--------------------------------------
922 UnionFind::UnionFind( uint max ) : _cnt(max), _max(max), _indices(NEW_RESOURCE_ARRAY(uint,max)) {
|
877 if( _blocks[i] == NULL ) continue;
878 _blocks[i]->dump_head(&_bbs);
879 }
880 }
881
882 void PhaseCFG::verify( ) const {
883 // Verify sane CFG
884 for( uint i = 0; i < _num_blocks; i++ ) {
885 Block *b = _blocks[i];
886 uint cnt = b->_nodes.size();
887 uint j;
888 for( j = 0; j < cnt; j++ ) {
889 Node *n = b->_nodes[j];
890 assert( _bbs[n->_idx] == b, "" );
891 if( j >= 1 && n->is_Mach() &&
892 n->as_Mach()->ideal_Opcode() == Op_CreateEx ) {
893 assert( j == 1 || b->_nodes[j-1]->is_Phi(),
894 "CreateEx must be first instruction in block" );
895 }
896 for( uint k = 0; k < n->req(); k++ ) {
897 Node *def = n->in(k);
898 if( def && def != n ) {
899 assert( _bbs[def->_idx] || def->is_Con(),
900 "must have block; constants for debug info ok" );
901 if( _bbs[def->_idx] == b &&
902 !(b->head()->is_Loop() && n->is_Phi()) &&
903 // See (+++) comment in reg_split.cpp
904 !(n->jvms() != NULL && n->jvms()->is_monitor_use(k)) ) {
905 assert( b->find_node(def) < j, "uses must follow definitions" );
906 }
907 }
908 }
909 }
910
911 j = b->end_idx();
912 Node *bp = (Node*)b->_nodes[b->_nodes.size()-1]->is_block_proj();
913 assert( bp, "last instruction must be a block proj" );
914 assert( bp == b->_nodes[j], "wrong number of successors for this block" );
915 if( bp->is_Catch() ) {
916 while( b->_nodes[--j]->Opcode() == Op_MachProj ) ;
917 assert( b->_nodes[j]->is_Call(), "CatchProj must follow call" );
918 }
919 else if( bp->is_Mach() && bp->as_Mach()->ideal_Opcode() == Op_If ) {
920 assert( b->_num_succs == 2, "Conditional branch must have two targets");
921 }
922 }
923 }
924 #endif
925
926 //=============================================================================
927 //------------------------------UnionFind--------------------------------------
928 UnionFind::UnionFind( uint max ) : _cnt(max), _max(max), _indices(NEW_RESOURCE_ARRAY(uint,max)) {
|