< prev index next >

src/share/vm/opto/domgraph.cpp

Print this page

        

*** 211,251 **** // Find the index into the b->succs[] array of the most frequent successor. uint Block_Stack::most_frequent_successor( Block *b ) { uint freq_idx = 0; int eidx = b->end_idx(); Node *n = b->get_node(eidx); ! int op = n->is_Mach() ? n->as_Mach()->ideal_Opcode() : n->Opcode(); switch( op ) { ! case Op_CountedLoopEnd: ! case Op_If: { // Split frequency amongst children float prob = n->as_MachIf()->_prob; // Is succ[0] the TRUE branch or the FALSE branch? ! if( b->get_node(eidx+1)->Opcode() == Op_IfFalse ) prob = 1.0f - prob; freq_idx = prob < PROB_FAIR; // freq=1 for succ[0] < 0.5 prob break; } ! case Op_Catch: // Split frequency amongst children for( freq_idx = 0; freq_idx < b->_num_succs; freq_idx++ ) if( b->get_node(eidx+1+freq_idx)->as_CatchProj()->_con == CatchProjNode::fall_through_index ) break; // Handle case of no fall-thru (e.g., check-cast MUST throw an exception) if( freq_idx == b->_num_succs ) freq_idx = 0; break; // Currently there is no support for finding out the most // frequent successor for jumps, so lets just make it the first one ! case Op_Jump: ! case Op_Root: ! case Op_Goto: ! case Op_NeverBranch: freq_idx = 0; // fall thru break; ! case Op_TailCall: ! case Op_TailJump: ! case Op_Return: ! case Op_Halt: ! case Op_Rethrow: break; default: ShouldNotReachHere(); } return freq_idx; --- 211,251 ---- // Find the index into the b->succs[] array of the most frequent successor. uint Block_Stack::most_frequent_successor( Block *b ) { uint freq_idx = 0; int eidx = b->end_idx(); Node *n = b->get_node(eidx); ! Opcodes op = n->is_Mach() ? n->as_Mach()->ideal_Opcode() : n->Opcode(); switch( op ) { ! case Opcodes::Op_CountedLoopEnd: ! case Opcodes::Op_If: { // Split frequency amongst children float prob = n->as_MachIf()->_prob; // Is succ[0] the TRUE branch or the FALSE branch? ! if( b->get_node(eidx+1)->Opcode() == Opcodes::Op_IfFalse ) prob = 1.0f - prob; freq_idx = prob < PROB_FAIR; // freq=1 for succ[0] < 0.5 prob break; } ! case Opcodes::Op_Catch: // Split frequency amongst children for( freq_idx = 0; freq_idx < b->_num_succs; freq_idx++ ) if( b->get_node(eidx+1+freq_idx)->as_CatchProj()->_con == CatchProjNode::fall_through_index ) break; // Handle case of no fall-thru (e.g., check-cast MUST throw an exception) if( freq_idx == b->_num_succs ) freq_idx = 0; break; // Currently there is no support for finding out the most // frequent successor for jumps, so lets just make it the first one ! case Opcodes::Op_Jump: ! case Opcodes::Op_Root: ! case Opcodes::Op_Goto: ! case Opcodes::Op_NeverBranch: freq_idx = 0; // fall thru break; ! case Opcodes::Op_TailCall: ! case Opcodes::Op_TailJump: ! case Opcodes::Op_Return: ! case Opcodes::Op_Halt: ! case Opcodes::Op_Rethrow: break; default: ShouldNotReachHere(); } return freq_idx;
< prev index next >