comparison src/share/vm/opto/mathexactnode.cpp @ 12888:4a2acfb16e97

8025657: compiler/intrinsics/mathexact/ConstantTest.java fails on assert in lcm.cpp on solaris x64 Reviewed-by: kvn, twisti
author rbackman
date Fri, 11 Oct 2013 12:06:14 +0200
parents c9ccd7b85f20
children 59e8ad757e19
comparison
equal deleted inserted replaced
12887:1263c7e17e1c 12888:4a2acfb16e97
23 */ 23 */
24 24
25 #include "precompiled.hpp" 25 #include "precompiled.hpp"
26 #include "memory/allocation.inline.hpp" 26 #include "memory/allocation.inline.hpp"
27 #include "opto/addnode.hpp" 27 #include "opto/addnode.hpp"
28 #include "opto/cfgnode.hpp"
28 #include "opto/machnode.hpp" 29 #include "opto/machnode.hpp"
30 #include "opto/matcher.hpp"
29 #include "opto/mathexactnode.hpp" 31 #include "opto/mathexactnode.hpp"
30 #include "opto/matcher.hpp"
31 #include "opto/subnode.hpp" 32 #include "opto/subnode.hpp"
32 33
33 MathExactNode::MathExactNode(Node* ctrl, Node* n1, Node* n2) : MultiNode(3) { 34 MathExactNode::MathExactNode(Node* ctrl, Node* n1, Node* n2) : MultiNode(3) {
34 init_req(0, ctrl); 35 init_req(0, ctrl);
35 init_req(1, n1); 36 init_req(1, n1);
36 init_req(2, n2); 37 init_req(2, n2);
38 }
39
40 BoolNode* MathExactNode::bool_node() const {
41 Node* flags = flags_node();
42 BoolNode* boolnode = flags->unique_out()->as_Bool();
43 assert(boolnode != NULL, "must have BoolNode");
44 return boolnode;
45 }
46
47 IfNode* MathExactNode::if_node() const {
48 BoolNode* boolnode = bool_node();
49 IfNode* ifnode = boolnode->unique_out()->as_If();
50 assert(ifnode != NULL, "must have IfNode");
51 return ifnode;
52 }
53
54 Node* MathExactNode::control_node() const {
55 IfNode* ifnode = if_node();
56 return ifnode->in(0);
57 }
58
59 Node* MathExactNode::non_throwing_branch() const {
60 IfNode* ifnode = if_node();
61 if (bool_node()->_test._test == BoolTest::overflow) {
62 return ifnode->proj_out(0);
63 }
64 return ifnode->proj_out(1);
37 } 65 }
38 66
39 Node* AddExactINode::match(const ProjNode* proj, const Matcher* m) { 67 Node* AddExactINode::match(const ProjNode* proj, const Matcher* m) {
40 uint ideal_reg = proj->ideal_reg(); 68 uint ideal_reg = proj->ideal_reg();
41 RegMask rm; 69 RegMask rm;
60 if (result != NULL) { 88 if (result != NULL) {
61 igvn->replace_node(result, new_result); 89 igvn->replace_node(result, new_result);
62 } 90 }
63 91
64 if (flags != NULL) { 92 if (flags != NULL) {
65 BoolNode* bolnode = (BoolNode *) flags->unique_out(); 93 BoolNode* boolnode = bool_node();
66 switch (bolnode->_test._test) { 94 switch (boolnode->_test._test) {
67 case BoolTest::overflow: 95 case BoolTest::overflow:
68 // if the check is for overflow - never taken 96 // if the check is for overflow - never taken
69 igvn->replace_node(bolnode, phase->intcon(0)); 97 igvn->replace_node(boolnode, phase->intcon(0));
70 break; 98 break;
71 case BoolTest::no_overflow: 99 case BoolTest::no_overflow:
72 // if the check is for no overflow - always taken 100 // if the check is for no overflow - always taken
73 igvn->replace_node(bolnode, phase->intcon(1)); 101 igvn->replace_node(boolnode, phase->intcon(1));
74 break; 102 break;
75 default: 103 default:
76 fatal("Unexpected value of BoolTest"); 104 fatal("Unexpected value of BoolTest");
77 break; 105 break;
78 } 106 }