src/share/vm/opto/subnode.cpp

changeset 4115
e626685e9f6c
parent 4037
da91efe96a93
child 4159
8e47bac5643a
     1.1 --- a/src/share/vm/opto/subnode.cpp	Tue Sep 25 15:48:17 2012 -0700
     1.2 +++ b/src/share/vm/opto/subnode.cpp	Thu Sep 27 09:38:42 2012 -0700
     1.3 @@ -149,7 +149,7 @@
     1.4    if( t2->base() == Type::Int ){        // Might be bottom or top...
     1.5      const TypeInt *i = t2->is_int();
     1.6      if( i->is_con() )
     1.7 -      return new (phase->C, 3) AddINode(in1, phase->intcon(-i->get_con()));
     1.8 +      return new (phase->C) AddINode(in1, phase->intcon(-i->get_con()));
     1.9    }
    1.10  
    1.11    // Convert "(x+c0) - y" into (x-y) + c0"
    1.12 @@ -158,8 +158,8 @@
    1.13    if( op1 == Op_AddI && ok_to_convert(in1, in2) ) {
    1.14      const Type *tadd = phase->type( in1->in(2) );
    1.15      if( tadd->singleton() && tadd != Type::TOP ) {
    1.16 -      Node *sub2 = phase->transform( new (phase->C, 3) SubINode( in1->in(1), in2 ));
    1.17 -      return new (phase->C, 3) AddINode( sub2, in1->in(2) );
    1.18 +      Node *sub2 = phase->transform( new (phase->C) SubINode( in1->in(1), in2 ));
    1.19 +      return new (phase->C) AddINode( sub2, in1->in(2) );
    1.20      }
    1.21    }
    1.22  
    1.23 @@ -171,9 +171,9 @@
    1.24      Node* in22 = in2->in(2);
    1.25      const TypeInt* tcon = phase->type(in22)->isa_int();
    1.26      if (tcon != NULL && tcon->is_con()) {
    1.27 -      Node* sub2 = phase->transform( new (phase->C, 3) SubINode(in1, in21) );
    1.28 +      Node* sub2 = phase->transform( new (phase->C) SubINode(in1, in21) );
    1.29        Node* neg_c0 = phase->intcon(- tcon->get_con());
    1.30 -      return new (phase->C, 3) AddINode(sub2, neg_c0);
    1.31 +      return new (phase->C) AddINode(sub2, neg_c0);
    1.32      }
    1.33    }
    1.34  
    1.35 @@ -191,47 +191,47 @@
    1.36    // Convert "x - (x+y)" into "-y"
    1.37    if( op2 == Op_AddI &&
    1.38        phase->eqv( in1, in2->in(1) ) )
    1.39 -    return new (phase->C, 3) SubINode( phase->intcon(0),in2->in(2));
    1.40 +    return new (phase->C) SubINode( phase->intcon(0),in2->in(2));
    1.41    // Convert "(x-y) - x" into "-y"
    1.42    if( op1 == Op_SubI &&
    1.43        phase->eqv( in1->in(1), in2 ) )
    1.44 -    return new (phase->C, 3) SubINode( phase->intcon(0),in1->in(2));
    1.45 +    return new (phase->C) SubINode( phase->intcon(0),in1->in(2));
    1.46    // Convert "x - (y+x)" into "-y"
    1.47    if( op2 == Op_AddI &&
    1.48        phase->eqv( in1, in2->in(2) ) )
    1.49 -    return new (phase->C, 3) SubINode( phase->intcon(0),in2->in(1));
    1.50 +    return new (phase->C) SubINode( phase->intcon(0),in2->in(1));
    1.51  
    1.52    // Convert "0 - (x-y)" into "y-x"
    1.53    if( t1 == TypeInt::ZERO && op2 == Op_SubI )
    1.54 -    return new (phase->C, 3) SubINode( in2->in(2), in2->in(1) );
    1.55 +    return new (phase->C) SubINode( in2->in(2), in2->in(1) );
    1.56  
    1.57    // Convert "0 - (x+con)" into "-con-x"
    1.58    jint con;
    1.59    if( t1 == TypeInt::ZERO && op2 == Op_AddI &&
    1.60        (con = in2->in(2)->find_int_con(0)) != 0 )
    1.61 -    return new (phase->C, 3) SubINode( phase->intcon(-con), in2->in(1) );
    1.62 +    return new (phase->C) SubINode( phase->intcon(-con), in2->in(1) );
    1.63  
    1.64    // Convert "(X+A) - (X+B)" into "A - B"
    1.65    if( op1 == Op_AddI && op2 == Op_AddI && in1->in(1) == in2->in(1) )
    1.66 -    return new (phase->C, 3) SubINode( in1->in(2), in2->in(2) );
    1.67 +    return new (phase->C) SubINode( in1->in(2), in2->in(2) );
    1.68  
    1.69    // Convert "(A+X) - (B+X)" into "A - B"
    1.70    if( op1 == Op_AddI && op2 == Op_AddI && in1->in(2) == in2->in(2) )
    1.71 -    return new (phase->C, 3) SubINode( in1->in(1), in2->in(1) );
    1.72 +    return new (phase->C) SubINode( in1->in(1), in2->in(1) );
    1.73  
    1.74    // Convert "(A+X) - (X+B)" into "A - B"
    1.75    if( op1 == Op_AddI && op2 == Op_AddI && in1->in(2) == in2->in(1) )
    1.76 -    return new (phase->C, 3) SubINode( in1->in(1), in2->in(2) );
    1.77 +    return new (phase->C) SubINode( in1->in(1), in2->in(2) );
    1.78  
    1.79    // Convert "(X+A) - (B+X)" into "A - B"
    1.80    if( op1 == Op_AddI && op2 == Op_AddI && in1->in(1) == in2->in(2) )
    1.81 -    return new (phase->C, 3) SubINode( in1->in(2), in2->in(1) );
    1.82 +    return new (phase->C) SubINode( in1->in(2), in2->in(1) );
    1.83  
    1.84    // Convert "A-(B-C)" into (A+C)-B", since add is commutative and generally
    1.85    // nicer to optimize than subtract.
    1.86    if( op2 == Op_SubI && in2->outcnt() == 1) {
    1.87 -    Node *add1 = phase->transform( new (phase->C, 3) AddINode( in1, in2->in(2) ) );
    1.88 -    return new (phase->C, 3) SubINode( add1, in2->in(1) );
    1.89 +    Node *add1 = phase->transform( new (phase->C) AddINode( in1, in2->in(2) ) );
    1.90 +    return new (phase->C) SubINode( add1, in2->in(1) );
    1.91    }
    1.92  
    1.93    return NULL;
    1.94 @@ -278,7 +278,7 @@
    1.95    // Convert "x-c0" into "x+ -c0".
    1.96    if( i &&                      // Might be bottom or top...
    1.97        i->is_con() )
    1.98 -    return new (phase->C, 3) AddLNode(in1, phase->longcon(-i->get_con()));
    1.99 +    return new (phase->C) AddLNode(in1, phase->longcon(-i->get_con()));
   1.100  
   1.101    // Convert "(x+c0) - y" into (x-y) + c0"
   1.102    // Do not collapse (x+c0)-y if "+" is a loop increment or
   1.103 @@ -287,8 +287,8 @@
   1.104      Node *in11 = in1->in(1);
   1.105      const Type *tadd = phase->type( in1->in(2) );
   1.106      if( tadd->singleton() && tadd != Type::TOP ) {
   1.107 -      Node *sub2 = phase->transform( new (phase->C, 3) SubLNode( in11, in2 ));
   1.108 -      return new (phase->C, 3) AddLNode( sub2, in1->in(2) );
   1.109 +      Node *sub2 = phase->transform( new (phase->C) SubLNode( in11, in2 ));
   1.110 +      return new (phase->C) AddLNode( sub2, in1->in(2) );
   1.111      }
   1.112    }
   1.113  
   1.114 @@ -299,9 +299,9 @@
   1.115      Node* in22 = in2->in(2);
   1.116      const TypeLong* tcon = phase->type(in22)->isa_long();
   1.117      if (tcon != NULL && tcon->is_con()) {
   1.118 -      Node* sub2 = phase->transform( new (phase->C, 3) SubLNode(in1, in21) );
   1.119 +      Node* sub2 = phase->transform( new (phase->C) SubLNode(in1, in21) );
   1.120        Node* neg_c0 = phase->longcon(- tcon->get_con());
   1.121 -      return new (phase->C, 3) AddLNode(sub2, neg_c0);
   1.122 +      return new (phase->C) AddLNode(sub2, neg_c0);
   1.123      }
   1.124    }
   1.125  
   1.126 @@ -319,28 +319,28 @@
   1.127    // Convert "x - (x+y)" into "-y"
   1.128    if( op2 == Op_AddL &&
   1.129        phase->eqv( in1, in2->in(1) ) )
   1.130 -    return new (phase->C, 3) SubLNode( phase->makecon(TypeLong::ZERO), in2->in(2));
   1.131 +    return new (phase->C) SubLNode( phase->makecon(TypeLong::ZERO), in2->in(2));
   1.132    // Convert "x - (y+x)" into "-y"
   1.133    if( op2 == Op_AddL &&
   1.134        phase->eqv( in1, in2->in(2) ) )
   1.135 -    return new (phase->C, 3) SubLNode( phase->makecon(TypeLong::ZERO),in2->in(1));
   1.136 +    return new (phase->C) SubLNode( phase->makecon(TypeLong::ZERO),in2->in(1));
   1.137  
   1.138    // Convert "0 - (x-y)" into "y-x"
   1.139    if( phase->type( in1 ) == TypeLong::ZERO && op2 == Op_SubL )
   1.140 -    return new (phase->C, 3) SubLNode( in2->in(2), in2->in(1) );
   1.141 +    return new (phase->C) SubLNode( in2->in(2), in2->in(1) );
   1.142  
   1.143    // Convert "(X+A) - (X+B)" into "A - B"
   1.144    if( op1 == Op_AddL && op2 == Op_AddL && in1->in(1) == in2->in(1) )
   1.145 -    return new (phase->C, 3) SubLNode( in1->in(2), in2->in(2) );
   1.146 +    return new (phase->C) SubLNode( in1->in(2), in2->in(2) );
   1.147  
   1.148    // Convert "(A+X) - (B+X)" into "A - B"
   1.149    if( op1 == Op_AddL && op2 == Op_AddL && in1->in(2) == in2->in(2) )
   1.150 -    return new (phase->C, 3) SubLNode( in1->in(1), in2->in(1) );
   1.151 +    return new (phase->C) SubLNode( in1->in(1), in2->in(1) );
   1.152  
   1.153    // Convert "A-(B-C)" into (A+C)-B"
   1.154    if( op2 == Op_SubL && in2->outcnt() == 1) {
   1.155 -    Node *add1 = phase->transform( new (phase->C, 3) AddLNode( in1, in2->in(2) ) );
   1.156 -    return new (phase->C, 3) SubLNode( add1, in2->in(1) );
   1.157 +    Node *add1 = phase->transform( new (phase->C) AddLNode( in1, in2->in(2) ) );
   1.158 +    return new (phase->C) SubLNode( add1, in2->in(1) );
   1.159    }
   1.160  
   1.161    return NULL;
   1.162 @@ -407,7 +407,7 @@
   1.163      // Convert "x - (x+y)" into "-y"
   1.164      if( in(2)->is_Add() &&
   1.165          phase->eqv(in(1),in(2)->in(1) ) )
   1.166 -      return new (phase->C, 3) SubFNode( phase->makecon(TypeF::ZERO),in(2)->in(2));
   1.167 +      return new (phase->C) SubFNode( phase->makecon(TypeF::ZERO),in(2)->in(2));
   1.168    }
   1.169  
   1.170    // Cannot replace 0.0-X with -X because a 'fsub' bytecode computes
   1.171 @@ -450,7 +450,7 @@
   1.172      // Convert "x - (x+y)" into "-y"
   1.173      if( in(2)->is_Add() &&
   1.174          phase->eqv(in(1),in(2)->in(1) ) )
   1.175 -      return new (phase->C, 3) SubDNode( phase->makecon(TypeD::ZERO),in(2)->in(2));
   1.176 +      return new (phase->C) SubDNode( phase->makecon(TypeD::ZERO),in(2)->in(2));
   1.177    }
   1.178  
   1.179    // Cannot replace 0.0-X with -X because a 'dsub' bytecode computes
   1.180 @@ -581,11 +581,11 @@
   1.181    if (phase->type(in(2))->higher_equal(TypeInt::ZERO)) {
   1.182      switch (in(1)->Opcode()) {
   1.183      case Op_CmpL3:              // Collapse a CmpL3/CmpI into a CmpL
   1.184 -      return new (phase->C, 3) CmpLNode(in(1)->in(1),in(1)->in(2));
   1.185 +      return new (phase->C) CmpLNode(in(1)->in(1),in(1)->in(2));
   1.186      case Op_CmpF3:              // Collapse a CmpF3/CmpI into a CmpF
   1.187 -      return new (phase->C, 3) CmpFNode(in(1)->in(1),in(1)->in(2));
   1.188 +      return new (phase->C) CmpFNode(in(1)->in(1),in(1)->in(2));
   1.189      case Op_CmpD3:              // Collapse a CmpD3/CmpI into a CmpD
   1.190 -      return new (phase->C, 3) CmpDNode(in(1)->in(1),in(1)->in(2));
   1.191 +      return new (phase->C) CmpDNode(in(1)->in(1),in(1)->in(2));
   1.192      //case Op_SubI:
   1.193        // If (x - y) cannot overflow, then ((x - y) <?> 0)
   1.194        // can be turned into (x <?> y).
   1.195 @@ -1023,8 +1023,8 @@
   1.196          new_in2 = tmp;
   1.197        }
   1.198        CmpFNode *new_cmp = (Opcode() == Op_CmpD3)
   1.199 -        ? new (phase->C, 3) CmpF3Node( new_in1, new_in2 )
   1.200 -        : new (phase->C, 3) CmpFNode ( new_in1, new_in2 ) ;
   1.201 +        ? new (phase->C) CmpF3Node( new_in1, new_in2 )
   1.202 +        : new (phase->C) CmpFNode ( new_in1, new_in2 ) ;
   1.203        return new_cmp;           // Changed to CmpFNode
   1.204      }
   1.205      // Testing value required the precision of a double
   1.206 @@ -1085,7 +1085,7 @@
   1.207    ncmp->set_req(1,cmp1);
   1.208    ncmp->set_req(2,cmp2);
   1.209    ncmp = gvn->transform( ncmp );
   1.210 -  return new (gvn->C, 2) BoolNode( ncmp, test );
   1.211 +  return new (gvn->C) BoolNode( ncmp, test );
   1.212  }
   1.213  
   1.214  //-------------------------------make_predicate--------------------------------
   1.215 @@ -1106,9 +1106,9 @@
   1.216      // Else fall through.  The CMove gets in the way of the test.
   1.217      // It should be the case that make_predicate(bol->as_int_value()) == bol.
   1.218    }
   1.219 -  Node* cmp = new (C, 3) CmpINode(test_value, phase->intcon(0));
   1.220 +  Node* cmp = new (C) CmpINode(test_value, phase->intcon(0));
   1.221    cmp = phase->transform(cmp);
   1.222 -  Node* bol = new (C, 2) BoolNode(cmp, BoolTest::ne);
   1.223 +  Node* bol = new (C) BoolNode(cmp, BoolTest::ne);
   1.224    return phase->transform(bol);
   1.225  }
   1.226  
   1.227 @@ -1124,7 +1124,7 @@
   1.228  //----------------------------------negate-------------------------------------
   1.229  BoolNode* BoolNode::negate(PhaseGVN* phase) {
   1.230    Compile* C = phase->C;
   1.231 -  return new (C, 2) BoolNode(in(1), _test.negate());
   1.232 +  return new (C) BoolNode(in(1), _test.negate());
   1.233  }
   1.234  
   1.235  
   1.236 @@ -1158,7 +1158,7 @@
   1.237      // Swap inputs to the clone
   1.238      cmp->swap_edges(1, 2);
   1.239      cmp = phase->transform( cmp );
   1.240 -    return new (phase->C, 2) BoolNode( cmp, _test.commute() );
   1.241 +    return new (phase->C) BoolNode( cmp, _test.commute() );
   1.242    }
   1.243  
   1.244    // Change "bool eq/ne (cmp (xor X 1) 0)" into "bool ne/eq (cmp X 0)".
   1.245 @@ -1175,8 +1175,8 @@
   1.246        phase->type( j_xor->in(2) ) == TypeInt::ONE &&
   1.247        (_test._test == BoolTest::eq ||
   1.248         _test._test == BoolTest::ne) ) {
   1.249 -    Node *ncmp = phase->transform(new (phase->C, 3) CmpINode(j_xor->in(1),cmp2));
   1.250 -    return new (phase->C, 2) BoolNode( ncmp, _test.negate() );
   1.251 +    Node *ncmp = phase->transform(new (phase->C) CmpINode(j_xor->in(1),cmp2));
   1.252 +    return new (phase->C) BoolNode( ncmp, _test.negate() );
   1.253    }
   1.254  
   1.255    // Change "bool eq/ne (cmp (Conv2B X) 0)" into "bool eq/ne (cmp X 0)".
   1.256 @@ -1187,10 +1187,10 @@
   1.257        (_test._test == BoolTest::eq ||
   1.258         _test._test == BoolTest::ne) ) {
   1.259      Node *ncmp = phase->transform(phase->type(c2b->in(1))->isa_int()
   1.260 -       ? (Node*)new (phase->C, 3) CmpINode(c2b->in(1),cmp2)
   1.261 -       : (Node*)new (phase->C, 3) CmpPNode(c2b->in(1),phase->makecon(TypePtr::NULL_PTR))
   1.262 +       ? (Node*)new (phase->C) CmpINode(c2b->in(1),cmp2)
   1.263 +       : (Node*)new (phase->C) CmpPNode(c2b->in(1),phase->makecon(TypePtr::NULL_PTR))
   1.264      );
   1.265 -    return new (phase->C, 2) BoolNode( ncmp, _test._test );
   1.266 +    return new (phase->C) BoolNode( ncmp, _test._test );
   1.267    }
   1.268  
   1.269    // Comparing a SubI against a zero is equal to comparing the SubI
   1.270 @@ -1200,8 +1200,8 @@
   1.271          (cop == Op_CmpI) &&
   1.272          (cmp1->Opcode() == Op_SubI) &&
   1.273          ( cmp2_type == TypeInt::ZERO ) ) {
   1.274 -    Node *ncmp = phase->transform( new (phase->C, 3) CmpINode(cmp1->in(1),cmp1->in(2)));
   1.275 -    return new (phase->C, 2) BoolNode( ncmp, _test._test );
   1.276 +    Node *ncmp = phase->transform( new (phase->C) CmpINode(cmp1->in(1),cmp1->in(2)));
   1.277 +    return new (phase->C) BoolNode( ncmp, _test._test );
   1.278    }
   1.279  
   1.280    // Change (-A vs 0) into (A vs 0) by commuting the test.  Disallow in the
   1.281 @@ -1212,8 +1212,8 @@
   1.282        cmp2_type == TypeInt::ZERO &&
   1.283        phase->type( cmp1->in(1) ) == TypeInt::ZERO &&
   1.284        phase->type( cmp1->in(2) )->higher_equal(TypeInt::SYMINT) ) {
   1.285 -    Node *ncmp = phase->transform( new (phase->C, 3) CmpINode(cmp1->in(2),cmp2));
   1.286 -    return new (phase->C, 2) BoolNode( ncmp, _test.commute() );
   1.287 +    Node *ncmp = phase->transform( new (phase->C) CmpINode(cmp1->in(2),cmp2));
   1.288 +    return new (phase->C) BoolNode( ncmp, _test.commute() );
   1.289    }
   1.290  
   1.291    //  The transformation below is not valid for either signed or unsigned

mercurial