Mercurial > hg > truffle
comparison src/share/vm/opto/block.cpp @ 4115:1bd45abaa507
6890673: Eliminate allocations immediately after EA
Summary: Try to eliminate allocations and related locks immediately after escape analysis.
Reviewed-by: never
author | kvn |
---|---|
date | Wed, 16 Nov 2011 09:13:57 -0800 |
parents | f94227b6117b |
children | e626685e9f6c |
comparison
equal
deleted
inserted
replaced
4114:6729bbc1fcd6 | 4115:1bd45abaa507 |
---|---|
896 } | 896 } |
897 | 897 |
898 void PhaseCFG::verify( ) const { | 898 void PhaseCFG::verify( ) const { |
899 #ifdef ASSERT | 899 #ifdef ASSERT |
900 // Verify sane CFG | 900 // Verify sane CFG |
901 for( uint i = 0; i < _num_blocks; i++ ) { | 901 for (uint i = 0; i < _num_blocks; i++) { |
902 Block *b = _blocks[i]; | 902 Block *b = _blocks[i]; |
903 uint cnt = b->_nodes.size(); | 903 uint cnt = b->_nodes.size(); |
904 uint j; | 904 uint j; |
905 for( j = 0; j < cnt; j++ ) { | 905 for (j = 0; j < cnt; j++) { |
906 Node *n = b->_nodes[j]; | 906 Node *n = b->_nodes[j]; |
907 assert( _bbs[n->_idx] == b, "" ); | 907 assert( _bbs[n->_idx] == b, "" ); |
908 if( j >= 1 && n->is_Mach() && | 908 if (j >= 1 && n->is_Mach() && |
909 n->as_Mach()->ideal_Opcode() == Op_CreateEx ) { | 909 n->as_Mach()->ideal_Opcode() == Op_CreateEx) { |
910 assert( j == 1 || b->_nodes[j-1]->is_Phi(), | 910 assert(j == 1 || b->_nodes[j-1]->is_Phi(), |
911 "CreateEx must be first instruction in block" ); | 911 "CreateEx must be first instruction in block"); |
912 } | 912 } |
913 for( uint k = 0; k < n->req(); k++ ) { | 913 for (uint k = 0; k < n->req(); k++) { |
914 Node *def = n->in(k); | 914 Node *def = n->in(k); |
915 if( def && def != n ) { | 915 if (def && def != n) { |
916 assert( _bbs[def->_idx] || def->is_Con(), | 916 assert(_bbs[def->_idx] || def->is_Con(), |
917 "must have block; constants for debug info ok" ); | 917 "must have block; constants for debug info ok"); |
918 // Verify that instructions in the block is in correct order. | 918 // Verify that instructions in the block is in correct order. |
919 // Uses must follow their definition if they are at the same block. | 919 // Uses must follow their definition if they are at the same block. |
920 // Mostly done to check that MachSpillCopy nodes are placed correctly | 920 // Mostly done to check that MachSpillCopy nodes are placed correctly |
921 // when CreateEx node is moved in build_ifg_physical(). | 921 // when CreateEx node is moved in build_ifg_physical(). |
922 if( _bbs[def->_idx] == b && | 922 if (_bbs[def->_idx] == b && |
923 !(b->head()->is_Loop() && n->is_Phi()) && | 923 !(b->head()->is_Loop() && n->is_Phi()) && |
924 // See (+++) comment in reg_split.cpp | 924 // See (+++) comment in reg_split.cpp |
925 !(n->jvms() != NULL && n->jvms()->is_monitor_use(k)) ) { | 925 !(n->jvms() != NULL && n->jvms()->is_monitor_use(k))) { |
926 bool is_loop = false; | 926 bool is_loop = false; |
927 if (n->is_Phi()) { | 927 if (n->is_Phi()) { |
928 for( uint l = 1; l < def->req(); l++ ) { | 928 for (uint l = 1; l < def->req(); l++) { |
929 if (n == def->in(l)) { | 929 if (n == def->in(l)) { |
930 is_loop = true; | 930 is_loop = true; |
931 break; // Some kind of loop | 931 break; // Some kind of loop |
932 } | 932 } |
933 } | 933 } |
934 } | 934 } |
935 assert( is_loop || b->find_node(def) < j, "uses must follow definitions" ); | 935 assert(is_loop || b->find_node(def) < j, "uses must follow definitions"); |
936 } | |
937 if( def->is_SafePointScalarObject() ) { | |
938 assert(_bbs[def->_idx] == b, "SafePointScalarObject Node should be at the same block as its SafePoint node"); | |
939 assert(_bbs[def->_idx] == _bbs[def->in(0)->_idx], "SafePointScalarObject Node should be at the same block as its control edge"); | |
940 } | 936 } |
941 } | 937 } |
942 } | 938 } |
943 } | 939 } |
944 | 940 |
945 j = b->end_idx(); | 941 j = b->end_idx(); |
946 Node *bp = (Node*)b->_nodes[b->_nodes.size()-1]->is_block_proj(); | 942 Node *bp = (Node*)b->_nodes[b->_nodes.size()-1]->is_block_proj(); |
947 assert( bp, "last instruction must be a block proj" ); | 943 assert( bp, "last instruction must be a block proj" ); |
948 assert( bp == b->_nodes[j], "wrong number of successors for this block" ); | 944 assert( bp == b->_nodes[j], "wrong number of successors for this block" ); |
949 if( bp->is_Catch() ) { | 945 if (bp->is_Catch()) { |
950 while( b->_nodes[--j]->is_MachProj() ) ; | 946 while (b->_nodes[--j]->is_MachProj()) ; |
951 assert( b->_nodes[j]->is_MachCall(), "CatchProj must follow call" ); | 947 assert(b->_nodes[j]->is_MachCall(), "CatchProj must follow call"); |
952 } | 948 } else if (bp->is_Mach() && bp->as_Mach()->ideal_Opcode() == Op_If) { |
953 else if( bp->is_Mach() && bp->as_Mach()->ideal_Opcode() == Op_If ) { | 949 assert(b->_num_succs == 2, "Conditional branch must have two targets"); |
954 assert( b->_num_succs == 2, "Conditional branch must have two targets"); | |
955 } | 950 } |
956 } | 951 } |
957 #endif | 952 #endif |
958 } | 953 } |
959 #endif | 954 #endif |