1.1 --- a/src/share/vm/opto/mathexactnode.cpp Tue Oct 15 17:47:46 2013 -0700 1.2 +++ b/src/share/vm/opto/mathexactnode.cpp Fri Oct 11 12:06:14 2013 +0200 1.3 @@ -25,9 +25,10 @@ 1.4 #include "precompiled.hpp" 1.5 #include "memory/allocation.inline.hpp" 1.6 #include "opto/addnode.hpp" 1.7 +#include "opto/cfgnode.hpp" 1.8 #include "opto/machnode.hpp" 1.9 +#include "opto/matcher.hpp" 1.10 #include "opto/mathexactnode.hpp" 1.11 -#include "opto/matcher.hpp" 1.12 #include "opto/subnode.hpp" 1.13 1.14 MathExactNode::MathExactNode(Node* ctrl, Node* n1, Node* n2) : MultiNode(3) { 1.15 @@ -36,6 +37,33 @@ 1.16 init_req(2, n2); 1.17 } 1.18 1.19 +BoolNode* MathExactNode::bool_node() const { 1.20 + Node* flags = flags_node(); 1.21 + BoolNode* boolnode = flags->unique_out()->as_Bool(); 1.22 + assert(boolnode != NULL, "must have BoolNode"); 1.23 + return boolnode; 1.24 +} 1.25 + 1.26 +IfNode* MathExactNode::if_node() const { 1.27 + BoolNode* boolnode = bool_node(); 1.28 + IfNode* ifnode = boolnode->unique_out()->as_If(); 1.29 + assert(ifnode != NULL, "must have IfNode"); 1.30 + return ifnode; 1.31 +} 1.32 + 1.33 +Node* MathExactNode::control_node() const { 1.34 + IfNode* ifnode = if_node(); 1.35 + return ifnode->in(0); 1.36 +} 1.37 + 1.38 +Node* MathExactNode::non_throwing_branch() const { 1.39 + IfNode* ifnode = if_node(); 1.40 + if (bool_node()->_test._test == BoolTest::overflow) { 1.41 + return ifnode->proj_out(0); 1.42 + } 1.43 + return ifnode->proj_out(1); 1.44 +} 1.45 + 1.46 Node* AddExactINode::match(const ProjNode* proj, const Matcher* m) { 1.47 uint ideal_reg = proj->ideal_reg(); 1.48 RegMask rm; 1.49 @@ -62,15 +90,15 @@ 1.50 } 1.51 1.52 if (flags != NULL) { 1.53 - BoolNode* bolnode = (BoolNode *) flags->unique_out(); 1.54 - switch (bolnode->_test._test) { 1.55 + BoolNode* boolnode = bool_node(); 1.56 + switch (boolnode->_test._test) { 1.57 case BoolTest::overflow: 1.58 // if the check is for overflow - never taken 1.59 - igvn->replace_node(bolnode, phase->intcon(0)); 1.60 + igvn->replace_node(boolnode, phase->intcon(0)); 1.61 break; 1.62 case BoolTest::no_overflow: 1.63 // if the check is for no overflow - always taken 1.64 - igvn->replace_node(bolnode, phase->intcon(1)); 1.65 + igvn->replace_node(boolnode, phase->intcon(1)); 1.66 break; 1.67 default: 1.68 fatal("Unexpected value of BoolTest");