diff 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
line wrap: on
line diff
--- a/src/share/vm/opto/mathexactnode.cpp	Tue Oct 15 17:47:46 2013 -0700
+++ b/src/share/vm/opto/mathexactnode.cpp	Fri Oct 11 12:06:14 2013 +0200
@@ -25,9 +25,10 @@
 #include "precompiled.hpp"
 #include "memory/allocation.inline.hpp"
 #include "opto/addnode.hpp"
+#include "opto/cfgnode.hpp"
 #include "opto/machnode.hpp"
+#include "opto/matcher.hpp"
 #include "opto/mathexactnode.hpp"
-#include "opto/matcher.hpp"
 #include "opto/subnode.hpp"
 
 MathExactNode::MathExactNode(Node* ctrl, Node* n1, Node* n2) : MultiNode(3) {
@@ -36,6 +37,33 @@
   init_req(2, n2);
 }
 
+BoolNode* MathExactNode::bool_node() const {
+  Node* flags = flags_node();
+  BoolNode* boolnode = flags->unique_out()->as_Bool();
+  assert(boolnode != NULL, "must have BoolNode");
+  return boolnode;
+}
+
+IfNode* MathExactNode::if_node() const {
+  BoolNode* boolnode = bool_node();
+  IfNode* ifnode = boolnode->unique_out()->as_If();
+  assert(ifnode != NULL, "must have IfNode");
+  return ifnode;
+}
+
+Node* MathExactNode::control_node() const {
+  IfNode* ifnode = if_node();
+  return ifnode->in(0);
+}
+
+Node* MathExactNode::non_throwing_branch() const {
+  IfNode* ifnode = if_node();
+  if (bool_node()->_test._test == BoolTest::overflow) {
+    return ifnode->proj_out(0);
+  }
+  return ifnode->proj_out(1);
+}
+
 Node* AddExactINode::match(const ProjNode* proj, const Matcher* m) {
   uint ideal_reg = proj->ideal_reg();
   RegMask rm;
@@ -62,15 +90,15 @@
     }
 
     if (flags != NULL) {
-      BoolNode* bolnode = (BoolNode *) flags->unique_out();
-      switch (bolnode->_test._test) {
+      BoolNode* boolnode = bool_node();
+      switch (boolnode->_test._test) {
         case BoolTest::overflow:
           // if the check is for overflow - never taken
-          igvn->replace_node(bolnode, phase->intcon(0));
+          igvn->replace_node(boolnode, phase->intcon(0));
           break;
         case BoolTest::no_overflow:
           // if the check is for no overflow - always taken
-          igvn->replace_node(bolnode, phase->intcon(1));
+          igvn->replace_node(boolnode, phase->intcon(1));
           break;
         default:
           fatal("Unexpected value of BoolTest");