hotspot/src/share/vm/opto/divnode.cpp
changeset 24923 9631f7d691dc
parent 24425 53764d2358f9
child 25913 81dbc151e91c
--- a/hotspot/src/share/vm/opto/divnode.cpp	Fri May 30 20:01:11 2014 +0000
+++ b/hotspot/src/share/vm/opto/divnode.cpp	Mon Jun 02 08:07:29 2014 +0200
@@ -106,7 +106,7 @@
     // division by +/- 1
     if (!d_pos) {
       // Just negate the value
-      q = new (phase->C) SubINode(phase->intcon(0), dividend);
+      q = new SubINode(phase->intcon(0), dividend);
     }
   } else if ( is_power_of_2(d) ) {
     // division by +/- a power of 2
@@ -143,18 +143,18 @@
       // (-2+3)>>2 becomes 0, etc.
 
       // Compute 0 or -1, based on sign bit
-      Node *sign = phase->transform(new (phase->C) RShiftINode(dividend, phase->intcon(N - 1)));
+      Node *sign = phase->transform(new RShiftINode(dividend, phase->intcon(N - 1)));
       // Mask sign bit to the low sign bits
-      Node *round = phase->transform(new (phase->C) URShiftINode(sign, phase->intcon(N - l)));
+      Node *round = phase->transform(new URShiftINode(sign, phase->intcon(N - l)));
       // Round up before shifting
-      dividend = phase->transform(new (phase->C) AddINode(dividend, round));
+      dividend = phase->transform(new AddINode(dividend, round));
     }
 
     // Shift for division
-    q = new (phase->C) RShiftINode(dividend, phase->intcon(l));
+    q = new RShiftINode(dividend, phase->intcon(l));
 
     if (!d_pos) {
-      q = new (phase->C) SubINode(phase->intcon(0), phase->transform(q));
+      q = new SubINode(phase->intcon(0), phase->transform(q));
     }
   } else {
     // Attempt the jint constant divide -> multiply transform found in
@@ -166,33 +166,33 @@
     jint shift_const;
     if (magic_int_divide_constants(d, magic_const, shift_const)) {
       Node *magic = phase->longcon(magic_const);
-      Node *dividend_long = phase->transform(new (phase->C) ConvI2LNode(dividend));
+      Node *dividend_long = phase->transform(new ConvI2LNode(dividend));
 
       // Compute the high half of the dividend x magic multiplication
-      Node *mul_hi = phase->transform(new (phase->C) MulLNode(dividend_long, magic));
+      Node *mul_hi = phase->transform(new MulLNode(dividend_long, magic));
 
       if (magic_const < 0) {
-        mul_hi = phase->transform(new (phase->C) RShiftLNode(mul_hi, phase->intcon(N)));
-        mul_hi = phase->transform(new (phase->C) ConvL2INode(mul_hi));
+        mul_hi = phase->transform(new RShiftLNode(mul_hi, phase->intcon(N)));
+        mul_hi = phase->transform(new ConvL2INode(mul_hi));
 
         // The magic multiplier is too large for a 32 bit constant. We've adjusted
         // it down by 2^32, but have to add 1 dividend back in after the multiplication.
         // This handles the "overflow" case described by Granlund and Montgomery.
-        mul_hi = phase->transform(new (phase->C) AddINode(dividend, mul_hi));
+        mul_hi = phase->transform(new AddINode(dividend, mul_hi));
 
         // Shift over the (adjusted) mulhi
         if (shift_const != 0) {
-          mul_hi = phase->transform(new (phase->C) RShiftINode(mul_hi, phase->intcon(shift_const)));
+          mul_hi = phase->transform(new RShiftINode(mul_hi, phase->intcon(shift_const)));
         }
       } else {
         // No add is required, we can merge the shifts together.
-        mul_hi = phase->transform(new (phase->C) RShiftLNode(mul_hi, phase->intcon(N + shift_const)));
-        mul_hi = phase->transform(new (phase->C) ConvL2INode(mul_hi));
+        mul_hi = phase->transform(new RShiftLNode(mul_hi, phase->intcon(N + shift_const)));
+        mul_hi = phase->transform(new ConvL2INode(mul_hi));
       }
 
       // Get a 0 or -1 from the sign of the dividend.
       Node *addend0 = mul_hi;
-      Node *addend1 = phase->transform(new (phase->C) RShiftINode(dividend, phase->intcon(N-1)));
+      Node *addend1 = phase->transform(new RShiftINode(dividend, phase->intcon(N-1)));
 
       // If the divisor is negative, swap the order of the input addends;
       // this has the effect of negating the quotient.
@@ -202,7 +202,7 @@
 
       // Adjust the final quotient by subtracting -1 (adding 1)
       // from the mul_hi.
-      q = new (phase->C) SubINode(addend0, addend1);
+      q = new SubINode(addend0, addend1);
     }
   }
 
@@ -261,7 +261,7 @@
   // no need to synthesize it in ideal nodes.
   if (Matcher::has_match_rule(Op_MulHiL)) {
     Node* v = phase->longcon(magic_const);
-    return new (phase->C) MulHiLNode(dividend, v);
+    return new MulHiLNode(dividend, v);
   }
 
   // Taken from Hacker's Delight, Fig. 8-2. Multiply high signed.
@@ -287,11 +287,11 @@
   const int N = 64;
 
   // Dummy node to keep intermediate nodes alive during construction
-  Node* hook = new (phase->C) Node(4);
+  Node* hook = new Node(4);
 
   // u0 = u & 0xFFFFFFFF;  u1 = u >> 32;
-  Node* u0 = phase->transform(new (phase->C) AndLNode(dividend, phase->longcon(0xFFFFFFFF)));
-  Node* u1 = phase->transform(new (phase->C) RShiftLNode(dividend, phase->intcon(N / 2)));
+  Node* u0 = phase->transform(new AndLNode(dividend, phase->longcon(0xFFFFFFFF)));
+  Node* u1 = phase->transform(new RShiftLNode(dividend, phase->intcon(N / 2)));
   hook->init_req(0, u0);
   hook->init_req(1, u1);
 
@@ -300,29 +300,29 @@
   Node* v1 = phase->longcon(magic_const >> (N / 2));
 
   // w0 = u0*v0;
-  Node* w0 = phase->transform(new (phase->C) MulLNode(u0, v0));
+  Node* w0 = phase->transform(new MulLNode(u0, v0));
 
   // t = u1*v0 + (w0 >> 32);
-  Node* u1v0 = phase->transform(new (phase->C) MulLNode(u1, v0));
-  Node* temp = phase->transform(new (phase->C) URShiftLNode(w0, phase->intcon(N / 2)));
-  Node* t    = phase->transform(new (phase->C) AddLNode(u1v0, temp));
+  Node* u1v0 = phase->transform(new MulLNode(u1, v0));
+  Node* temp = phase->transform(new URShiftLNode(w0, phase->intcon(N / 2)));
+  Node* t    = phase->transform(new AddLNode(u1v0, temp));
   hook->init_req(2, t);
 
   // w1 = t & 0xFFFFFFFF;
-  Node* w1 = phase->transform(new (phase->C) AndLNode(t, phase->longcon(0xFFFFFFFF)));
+  Node* w1 = phase->transform(new AndLNode(t, phase->longcon(0xFFFFFFFF)));
   hook->init_req(3, w1);
 
   // w2 = t >> 32;
-  Node* w2 = phase->transform(new (phase->C) RShiftLNode(t, phase->intcon(N / 2)));
+  Node* w2 = phase->transform(new RShiftLNode(t, phase->intcon(N / 2)));
 
   // w1 = u0*v1 + w1;
-  Node* u0v1 = phase->transform(new (phase->C) MulLNode(u0, v1));
-  w1         = phase->transform(new (phase->C) AddLNode(u0v1, w1));
+  Node* u0v1 = phase->transform(new MulLNode(u0, v1));
+  w1         = phase->transform(new AddLNode(u0v1, w1));
 
   // return u1*v1 + w2 + (w1 >> 32);
-  Node* u1v1  = phase->transform(new (phase->C) MulLNode(u1, v1));
-  Node* temp1 = phase->transform(new (phase->C) AddLNode(u1v1, w2));
-  Node* temp2 = phase->transform(new (phase->C) RShiftLNode(w1, phase->intcon(N / 2)));
+  Node* u1v1  = phase->transform(new MulLNode(u1, v1));
+  Node* temp1 = phase->transform(new AddLNode(u1v1, w2));
+  Node* temp2 = phase->transform(new RShiftLNode(w1, phase->intcon(N / 2)));
 
   // Remove the bogus extra edges used to keep things alive
   PhaseIterGVN* igvn = phase->is_IterGVN();
@@ -334,7 +334,7 @@
     }
   }
 
-  return new (phase->C) AddLNode(temp1, temp2);
+  return new AddLNode(temp1, temp2);
 }
 
 
@@ -357,7 +357,7 @@
     // division by +/- 1
     if (!d_pos) {
       // Just negate the value
-      q = new (phase->C) SubLNode(phase->longcon(0), dividend);
+      q = new SubLNode(phase->longcon(0), dividend);
     }
   } else if ( is_power_of_2_long(d) ) {
 
@@ -396,18 +396,18 @@
       // (-2+3)>>2 becomes 0, etc.
 
       // Compute 0 or -1, based on sign bit
-      Node *sign = phase->transform(new (phase->C) RShiftLNode(dividend, phase->intcon(N - 1)));
+      Node *sign = phase->transform(new RShiftLNode(dividend, phase->intcon(N - 1)));
       // Mask sign bit to the low sign bits
-      Node *round = phase->transform(new (phase->C) URShiftLNode(sign, phase->intcon(N - l)));
+      Node *round = phase->transform(new URShiftLNode(sign, phase->intcon(N - l)));
       // Round up before shifting
-      dividend = phase->transform(new (phase->C) AddLNode(dividend, round));
+      dividend = phase->transform(new AddLNode(dividend, round));
     }
 
     // Shift for division
-    q = new (phase->C) RShiftLNode(dividend, phase->intcon(l));
+    q = new RShiftLNode(dividend, phase->intcon(l));
 
     if (!d_pos) {
-      q = new (phase->C) SubLNode(phase->longcon(0), phase->transform(q));
+      q = new SubLNode(phase->longcon(0), phase->transform(q));
     }
   } else if ( !Matcher::use_asm_for_ldiv_by_con(d) ) { // Use hardware DIV instruction when
                                                        // it is faster than code generated below.
@@ -427,17 +427,17 @@
         // The magic multiplier is too large for a 64 bit constant. We've adjusted
         // it down by 2^64, but have to add 1 dividend back in after the multiplication.
         // This handles the "overflow" case described by Granlund and Montgomery.
-        mul_hi = phase->transform(new (phase->C) AddLNode(dividend, mul_hi));
+        mul_hi = phase->transform(new AddLNode(dividend, mul_hi));
       }
 
       // Shift over the (adjusted) mulhi
       if (shift_const != 0) {
-        mul_hi = phase->transform(new (phase->C) RShiftLNode(mul_hi, phase->intcon(shift_const)));
+        mul_hi = phase->transform(new RShiftLNode(mul_hi, phase->intcon(shift_const)));
       }
 
       // Get a 0 or -1 from the sign of the dividend.
       Node *addend0 = mul_hi;
-      Node *addend1 = phase->transform(new (phase->C) RShiftLNode(dividend, phase->intcon(N-1)));
+      Node *addend1 = phase->transform(new RShiftLNode(dividend, phase->intcon(N-1)));
 
       // If the divisor is negative, swap the order of the input addends;
       // this has the effect of negating the quotient.
@@ -447,7 +447,7 @@
 
       // Adjust the final quotient by subtracting -1 (adding 1)
       // from the mul_hi.
-      q = new (phase->C) SubLNode(addend0, addend1);
+      q = new SubLNode(addend0, addend1);
     }
   }
 
@@ -737,7 +737,7 @@
   assert( frexp((double)reciprocal, &exp) == 0.5, "reciprocal should be power of 2" );
 
   // return multiplication by the reciprocal
-  return (new (phase->C) MulFNode(in(1), phase->makecon(TypeF::make(reciprocal))));
+  return (new MulFNode(in(1), phase->makecon(TypeF::make(reciprocal))));
 }
 
 //=============================================================================
@@ -831,7 +831,7 @@
   assert( frexp(reciprocal, &exp) == 0.5, "reciprocal should be power of 2" );
 
   // return multiplication by the reciprocal
-  return (new (phase->C) MulDNode(in(1), phase->makecon(TypeD::make(reciprocal))));
+  return (new MulDNode(in(1), phase->makecon(TypeD::make(reciprocal))));
 }
 
 //=============================================================================
@@ -858,7 +858,7 @@
   if( !ti->is_con() ) return NULL;
   jint con = ti->get_con();
 
-  Node *hook = new (phase->C) Node(1);
+  Node *hook = new Node(1);
 
   // First, special check for modulo 2^k-1
   if( con >= 0 && con < max_jint && is_power_of_2(con+1) ) {
@@ -878,24 +878,24 @@
       hook->init_req(0, x);       // Add a use to x to prevent him from dying
       // Generate code to reduce X rapidly to nearly 2^k-1.
       for( int i = 0; i < trip_count; i++ ) {
-        Node *xl = phase->transform( new (phase->C) AndINode(x,divisor) );
-        Node *xh = phase->transform( new (phase->C) RShiftINode(x,phase->intcon(k)) ); // Must be signed
-        x = phase->transform( new (phase->C) AddINode(xh,xl) );
+        Node *xl = phase->transform( new AndINode(x,divisor) );
+        Node *xh = phase->transform( new RShiftINode(x,phase->intcon(k)) ); // Must be signed
+        x = phase->transform( new AddINode(xh,xl) );
         hook->set_req(0, x);
       }
 
       // Generate sign-fixup code.  Was original value positive?
       // int hack_res = (i >= 0) ? divisor : 1;
-      Node *cmp1 = phase->transform( new (phase->C) CmpINode( in(1), phase->intcon(0) ) );
-      Node *bol1 = phase->transform( new (phase->C) BoolNode( cmp1, BoolTest::ge ) );
-      Node *cmov1= phase->transform( new (phase->C) CMoveINode(bol1, phase->intcon(1), divisor, TypeInt::POS) );
+      Node *cmp1 = phase->transform( new CmpINode( in(1), phase->intcon(0) ) );
+      Node *bol1 = phase->transform( new BoolNode( cmp1, BoolTest::ge ) );
+      Node *cmov1= phase->transform( new CMoveINode(bol1, phase->intcon(1), divisor, TypeInt::POS) );
       // if( x >= hack_res ) x -= divisor;
-      Node *sub  = phase->transform( new (phase->C) SubINode( x, divisor ) );
-      Node *cmp2 = phase->transform( new (phase->C) CmpINode( x, cmov1 ) );
-      Node *bol2 = phase->transform( new (phase->C) BoolNode( cmp2, BoolTest::ge ) );
+      Node *sub  = phase->transform( new SubINode( x, divisor ) );
+      Node *cmp2 = phase->transform( new CmpINode( x, cmov1 ) );
+      Node *bol2 = phase->transform( new BoolNode( cmp2, BoolTest::ge ) );
       // Convention is to not transform the return value of an Ideal
       // since Ideal is expected to return a modified 'this' or a new node.
-      Node *cmov2= new (phase->C) CMoveINode(bol2, x, sub, TypeInt::INT);
+      Node *cmov2= new CMoveINode(bol2, x, sub, TypeInt::INT);
       // cmov2 is now the mod
 
       // Now remove the bogus extra edges used to keep things alive
@@ -918,7 +918,7 @@
   jint pos_con = (con >= 0) ? con : -con;
 
   // integer Mod 1 is always 0
-  if( pos_con == 1 ) return new (phase->C) ConINode(TypeInt::ZERO);
+  if( pos_con == 1 ) return new ConINode(TypeInt::ZERO);
 
   int log2_con = -1;
 
@@ -931,7 +931,7 @@
 
     // See if this can be masked, if the dividend is non-negative
     if( dti && dti->_lo >= 0 )
-      return ( new (phase->C) AndINode( in(1), phase->intcon( pos_con-1 ) ) );
+      return ( new AndINode( in(1), phase->intcon( pos_con-1 ) ) );
   }
 
   // Save in(1) so that it cannot be changed or deleted
@@ -946,12 +946,12 @@
     Node *mult = NULL;
 
     if( log2_con >= 0 )
-      mult = phase->transform( new (phase->C) LShiftINode( divide, phase->intcon( log2_con ) ) );
+      mult = phase->transform( new LShiftINode( divide, phase->intcon( log2_con ) ) );
     else
-      mult = phase->transform( new (phase->C) MulINode( divide, phase->intcon( pos_con ) ) );
+      mult = phase->transform( new MulINode( divide, phase->intcon( pos_con ) ) );
 
     // Finally, subtract the multiplied divided value from the original
-    result = new (phase->C) SubINode( in(1), mult );
+    result = new SubINode( in(1), mult );
   }
 
   // Now remove the bogus extra edges used to keep things alive
@@ -1029,7 +1029,7 @@
   if( !tl->is_con() ) return NULL;
   jlong con = tl->get_con();
 
-  Node *hook = new (phase->C) Node(1);
+  Node *hook = new Node(1);
 
   // Expand mod
   if( con >= 0 && con < max_jlong && is_power_of_2_long(con+1) ) {
@@ -1051,24 +1051,24 @@
       hook->init_req(0, x);       // Add a use to x to prevent him from dying
       // Generate code to reduce X rapidly to nearly 2^k-1.
       for( int i = 0; i < trip_count; i++ ) {
-        Node *xl = phase->transform( new (phase->C) AndLNode(x,divisor) );
-        Node *xh = phase->transform( new (phase->C) RShiftLNode(x,phase->intcon(k)) ); // Must be signed
-        x = phase->transform( new (phase->C) AddLNode(xh,xl) );
+        Node *xl = phase->transform( new AndLNode(x,divisor) );
+        Node *xh = phase->transform( new RShiftLNode(x,phase->intcon(k)) ); // Must be signed
+        x = phase->transform( new AddLNode(xh,xl) );
         hook->set_req(0, x);    // Add a use to x to prevent him from dying
       }
 
       // Generate sign-fixup code.  Was original value positive?
       // long hack_res = (i >= 0) ? divisor : CONST64(1);
-      Node *cmp1 = phase->transform( new (phase->C) CmpLNode( in(1), phase->longcon(0) ) );
-      Node *bol1 = phase->transform( new (phase->C) BoolNode( cmp1, BoolTest::ge ) );
-      Node *cmov1= phase->transform( new (phase->C) CMoveLNode(bol1, phase->longcon(1), divisor, TypeLong::LONG) );
+      Node *cmp1 = phase->transform( new CmpLNode( in(1), phase->longcon(0) ) );
+      Node *bol1 = phase->transform( new BoolNode( cmp1, BoolTest::ge ) );
+      Node *cmov1= phase->transform( new CMoveLNode(bol1, phase->longcon(1), divisor, TypeLong::LONG) );
       // if( x >= hack_res ) x -= divisor;
-      Node *sub  = phase->transform( new (phase->C) SubLNode( x, divisor ) );
-      Node *cmp2 = phase->transform( new (phase->C) CmpLNode( x, cmov1 ) );
-      Node *bol2 = phase->transform( new (phase->C) BoolNode( cmp2, BoolTest::ge ) );
+      Node *sub  = phase->transform( new SubLNode( x, divisor ) );
+      Node *cmp2 = phase->transform( new CmpLNode( x, cmov1 ) );
+      Node *bol2 = phase->transform( new BoolNode( cmp2, BoolTest::ge ) );
       // Convention is to not transform the return value of an Ideal
       // since Ideal is expected to return a modified 'this' or a new node.
-      Node *cmov2= new (phase->C) CMoveLNode(bol2, x, sub, TypeLong::LONG);
+      Node *cmov2= new CMoveLNode(bol2, x, sub, TypeLong::LONG);
       // cmov2 is now the mod
 
       // Now remove the bogus extra edges used to keep things alive
@@ -1091,7 +1091,7 @@
   jlong pos_con = (con >= 0) ? con : -con;
 
   // integer Mod 1 is always 0
-  if( pos_con == 1 ) return new (phase->C) ConLNode(TypeLong::ZERO);
+  if( pos_con == 1 ) return new ConLNode(TypeLong::ZERO);
 
   int log2_con = -1;
 
@@ -1104,7 +1104,7 @@
 
     // See if this can be masked, if the dividend is non-negative
     if( dtl && dtl->_lo >= 0 )
-      return ( new (phase->C) AndLNode( in(1), phase->longcon( pos_con-1 ) ) );
+      return ( new AndLNode( in(1), phase->longcon( pos_con-1 ) ) );
   }
 
   // Save in(1) so that it cannot be changed or deleted
@@ -1119,12 +1119,12 @@
     Node *mult = NULL;
 
     if( log2_con >= 0 )
-      mult = phase->transform( new (phase->C) LShiftLNode( divide, phase->intcon( log2_con ) ) );
+      mult = phase->transform( new LShiftLNode( divide, phase->intcon( log2_con ) ) );
     else
-      mult = phase->transform( new (phase->C) MulLNode( divide, phase->longcon( pos_con ) ) );
+      mult = phase->transform( new MulLNode( divide, phase->longcon( pos_con ) ) );
 
     // Finally, subtract the multiplied divided value from the original
-    result = new (phase->C) SubLNode( in(1), mult );
+    result = new SubLNode( in(1), mult );
   }
 
   // Now remove the bogus extra edges used to keep things alive
@@ -1279,9 +1279,9 @@
   assert(n->Opcode() == Op_DivI || n->Opcode() == Op_ModI,
          "only div or mod input pattern accepted");
 
-  DivModINode* divmod = new (C) DivModINode(n->in(0), n->in(1), n->in(2));
-  Node*        dproj  = new (C) ProjNode(divmod, DivModNode::div_proj_num);
-  Node*        mproj  = new (C) ProjNode(divmod, DivModNode::mod_proj_num);
+  DivModINode* divmod = new DivModINode(n->in(0), n->in(1), n->in(2));
+  Node*        dproj  = new ProjNode(divmod, DivModNode::div_proj_num);
+  Node*        mproj  = new ProjNode(divmod, DivModNode::mod_proj_num);
   return divmod;
 }
 
@@ -1291,9 +1291,9 @@
   assert(n->Opcode() == Op_DivL || n->Opcode() == Op_ModL,
          "only div or mod input pattern accepted");
 
-  DivModLNode* divmod = new (C) DivModLNode(n->in(0), n->in(1), n->in(2));
-  Node*        dproj  = new (C) ProjNode(divmod, DivModNode::div_proj_num);
-  Node*        mproj  = new (C) ProjNode(divmod, DivModNode::mod_proj_num);
+  DivModLNode* divmod = new DivModLNode(n->in(0), n->in(1), n->in(2));
+  Node*        dproj  = new ProjNode(divmod, DivModNode::div_proj_num);
+  Node*        mproj  = new ProjNode(divmod, DivModNode::mod_proj_num);
   return divmod;
 }
 
@@ -1308,7 +1308,7 @@
     assert(proj->_con == mod_proj_num, "must be div or mod projection");
     rm = match->modI_proj_mask();
   }
-  return new (match->C)MachProjNode(this, proj->_con, rm, ideal_reg);
+  return new MachProjNode(this, proj->_con, rm, ideal_reg);
 }
 
 
@@ -1323,5 +1323,5 @@
     assert(proj->_con == mod_proj_num, "must be div or mod projection");
     rm = match->modL_proj_mask();
   }
-  return new (match->C)MachProjNode(this, proj->_con, rm, ideal_reg);
+  return new MachProjNode(this, proj->_con, rm, ideal_reg);
 }