1850 }
1851
1852
1853 // Switch on branch type
1854 switch( op ) {
1855 case Op_CountedLoopEnd:
1856 case Op_If: {
1857 assert (i < 2, "just checking");
1858 // Conditionals pass on only part of their frequency
1859 float prob = n->as_MachIf()->_prob;
1860 assert(prob >= 0.0 && prob <= 1.0, "out of range probability");
1861 // If succ[i] is the FALSE branch, invert path info
1862 if( get_node(i + eidx + 1)->Opcode() == Op_IfFalse ) {
1863 return 1.0f - prob; // not taken
1864 } else {
1865 return prob; // taken
1866 }
1867 }
1868
1869 case Op_Jump:
1870 // Divide the frequency between all successors evenly
1871 return 1.0f/_num_succs;
1872
1873 case Op_Catch: {
1874 const CatchProjNode *ci = get_node(i + eidx + 1)->as_CatchProj();
1875 if (ci->_con == CatchProjNode::fall_through_index) {
1876 // Fall-thru path gets the lion's share.
1877 return 1.0f - PROB_UNLIKELY_MAG(5)*_num_succs;
1878 } else {
1879 // Presume exceptional paths are equally unlikely
1880 return PROB_UNLIKELY_MAG(5);
1881 }
1882 }
1883
1884 case Op_Root:
1885 case Op_Goto:
1886 // Pass frequency straight thru to target
1887 return 1.0f;
1888
1889 case Op_NeverBranch:
1890 return 0.0f;
1891
|
1850 }
1851
1852
1853 // Switch on branch type
1854 switch( op ) {
1855 case Op_CountedLoopEnd:
1856 case Op_If: {
1857 assert (i < 2, "just checking");
1858 // Conditionals pass on only part of their frequency
1859 float prob = n->as_MachIf()->_prob;
1860 assert(prob >= 0.0 && prob <= 1.0, "out of range probability");
1861 // If succ[i] is the FALSE branch, invert path info
1862 if( get_node(i + eidx + 1)->Opcode() == Op_IfFalse ) {
1863 return 1.0f - prob; // not taken
1864 } else {
1865 return prob; // taken
1866 }
1867 }
1868
1869 case Op_Jump:
1870 return n->as_MachJump()->_probs[get_node(i + eidx + 1)->as_JumpProj()->_con];
1871
1872 case Op_Catch: {
1873 const CatchProjNode *ci = get_node(i + eidx + 1)->as_CatchProj();
1874 if (ci->_con == CatchProjNode::fall_through_index) {
1875 // Fall-thru path gets the lion's share.
1876 return 1.0f - PROB_UNLIKELY_MAG(5)*_num_succs;
1877 } else {
1878 // Presume exceptional paths are equally unlikely
1879 return PROB_UNLIKELY_MAG(5);
1880 }
1881 }
1882
1883 case Op_Root:
1884 case Op_Goto:
1885 // Pass frequency straight thru to target
1886 return 1.0f;
1887
1888 case Op_NeverBranch:
1889 return 0.0f;
1890
|