163 |
163 |
164 int success_result = completely_empty; |
164 int success_result = completely_empty; |
165 int end_idx = _nodes.size()-1; |
165 int end_idx = _nodes.size()-1; |
166 |
166 |
167 // Check for ending goto |
167 // Check for ending goto |
168 if ((end_idx > 0) && (_nodes[end_idx]->is_Goto())) { |
168 if ((end_idx > 0) && (_nodes[end_idx]->is_MachGoto())) { |
169 success_result = empty_with_goto; |
169 success_result = empty_with_goto; |
170 end_idx--; |
170 end_idx--; |
171 } |
171 } |
172 |
172 |
173 // Unreachable blocks are considered empty |
173 // Unreachable blocks are considered empty |
195 // executed infrequently. Check to see if the block ends in a Halt or |
195 // executed infrequently. Check to see if the block ends in a Halt or |
196 // a low probability call. |
196 // a low probability call. |
197 bool Block::has_uncommon_code() const { |
197 bool Block::has_uncommon_code() const { |
198 Node* en = end(); |
198 Node* en = end(); |
199 |
199 |
200 if (en->is_Goto()) |
200 if (en->is_MachGoto()) |
201 en = en->in(0); |
201 en = en->in(0); |
202 if (en->is_Catch()) |
202 if (en->is_Catch()) |
203 en = en->in(0); |
203 en = en->in(0); |
204 if (en->is_Proj() && en->in(0)->is_MachCall()) { |
204 if (en->is_MachProj() && en->in(0)->is_MachCall()) { |
205 MachCallNode* call = en->in(0)->as_MachCall(); |
205 MachCallNode* call = en->in(0)->as_MachCall(); |
206 if (call->cnt() != COUNT_UNKNOWN && call->cnt() <= PROB_UNLIKELY_MAG(4)) { |
206 if (call->cnt() != COUNT_UNKNOWN && call->cnt() <= PROB_UNLIKELY_MAG(4)) { |
207 // This is true for slow-path stubs like new_{instance,array}, |
207 // This is true for slow-path stubs like new_{instance,array}, |
208 // slow_arraycopy, complete_monitor_locking, uncommon_trap. |
208 // slow_arraycopy, complete_monitor_locking, uncommon_trap. |
209 // The magic number corresponds to the probability of an uncommon_trap, |
209 // The magic number corresponds to the probability of an uncommon_trap, |
943 j = b->end_idx(); |
943 j = b->end_idx(); |
944 Node *bp = (Node*)b->_nodes[b->_nodes.size()-1]->is_block_proj(); |
944 Node *bp = (Node*)b->_nodes[b->_nodes.size()-1]->is_block_proj(); |
945 assert( bp, "last instruction must be a block proj" ); |
945 assert( bp, "last instruction must be a block proj" ); |
946 assert( bp == b->_nodes[j], "wrong number of successors for this block" ); |
946 assert( bp == b->_nodes[j], "wrong number of successors for this block" ); |
947 if( bp->is_Catch() ) { |
947 if( bp->is_Catch() ) { |
948 while( b->_nodes[--j]->Opcode() == Op_MachProj ) ; |
948 while( b->_nodes[--j]->is_MachProj() ) ; |
949 assert( b->_nodes[j]->is_Call(), "CatchProj must follow call" ); |
949 assert( b->_nodes[j]->is_MachCall(), "CatchProj must follow call" ); |
950 } |
950 } |
951 else if( bp->is_Mach() && bp->as_Mach()->ideal_Opcode() == Op_If ) { |
951 else if( bp->is_Mach() && bp->as_Mach()->ideal_Opcode() == Op_If ) { |
952 assert( b->_num_succs == 2, "Conditional branch must have two targets"); |
952 assert( b->_num_succs == 2, "Conditional branch must have two targets"); |
953 } |
953 } |
954 } |
954 } |