Mercurial > hg > truffle
comparison src/share/vm/opto/connode.cpp @ 6804:e626685e9f6c
7193318: C2: remove number of inputs requirement from Node's new operator
Summary: Deleted placement new operator of Node - node(size_t, Compile *, int).
Reviewed-by: kvn, twisti
Contributed-by: bharadwaj.yadavalli@oracle.com
author | kvn |
---|---|
date | Thu, 27 Sep 2012 09:38:42 -0700 |
parents | 7eca5de9e0b6 |
children | 8e47bac5643a |
comparison
equal
deleted
inserted
replaced
6803:06f52c4d0e18 | 6804:e626685e9f6c |
---|---|
43 } | 43 } |
44 | 44 |
45 //------------------------------make------------------------------------------- | 45 //------------------------------make------------------------------------------- |
46 ConNode *ConNode::make( Compile* C, const Type *t ) { | 46 ConNode *ConNode::make( Compile* C, const Type *t ) { |
47 switch( t->basic_type() ) { | 47 switch( t->basic_type() ) { |
48 case T_INT: return new (C, 1) ConINode( t->is_int() ); | 48 case T_INT: return new (C) ConINode( t->is_int() ); |
49 case T_LONG: return new (C, 1) ConLNode( t->is_long() ); | 49 case T_LONG: return new (C) ConLNode( t->is_long() ); |
50 case T_FLOAT: return new (C, 1) ConFNode( t->is_float_constant() ); | 50 case T_FLOAT: return new (C) ConFNode( t->is_float_constant() ); |
51 case T_DOUBLE: return new (C, 1) ConDNode( t->is_double_constant() ); | 51 case T_DOUBLE: return new (C) ConDNode( t->is_double_constant() ); |
52 case T_VOID: return new (C, 1) ConNode ( Type::TOP ); | 52 case T_VOID: return new (C) ConNode ( Type::TOP ); |
53 case T_OBJECT: return new (C, 1) ConPNode( t->is_ptr() ); | 53 case T_OBJECT: return new (C) ConPNode( t->is_ptr() ); |
54 case T_ARRAY: return new (C, 1) ConPNode( t->is_aryptr() ); | 54 case T_ARRAY: return new (C) ConPNode( t->is_aryptr() ); |
55 case T_ADDRESS: return new (C, 1) ConPNode( t->is_ptr() ); | 55 case T_ADDRESS: return new (C) ConPNode( t->is_ptr() ); |
56 case T_NARROWOOP: return new (C, 1) ConNNode( t->is_narrowoop() ); | 56 case T_NARROWOOP: return new (C) ConNNode( t->is_narrowoop() ); |
57 case T_METADATA: return new (C, 1) ConPNode( t->is_ptr() ); | 57 case T_METADATA: return new (C) ConPNode( t->is_ptr() ); |
58 // Expected cases: TypePtr::NULL_PTR, any is_rawptr() | 58 // Expected cases: TypePtr::NULL_PTR, any is_rawptr() |
59 // Also seen: AnyPtr(TopPTR *+top); from command line: | 59 // Also seen: AnyPtr(TopPTR *+top); from command line: |
60 // r -XX:+PrintOpto -XX:CIStart=285 -XX:+CompileTheWorld -XX:CompileTheWorldStartAt=660 | 60 // r -XX:+PrintOpto -XX:CIStart=285 -XX:+CompileTheWorld -XX:CompileTheWorldStartAt=660 |
61 // %%%% Stop using TypePtr::NULL_PTR to represent nulls: use either TypeRawPtr::NULL_PTR | 61 // %%%% Stop using TypePtr::NULL_PTR to represent nulls: use either TypeRawPtr::NULL_PTR |
62 // or else TypeOopPtr::NULL_PTR. Then set Type::_basic_type[AnyPtr] = T_ILLEGAL | 62 // or else TypeOopPtr::NULL_PTR. Then set Type::_basic_type[AnyPtr] = T_ILLEGAL |
193 //------------------------------make------------------------------------------- | 193 //------------------------------make------------------------------------------- |
194 // Make a correctly-flavored CMove. Since _type is directly determined | 194 // Make a correctly-flavored CMove. Since _type is directly determined |
195 // from the inputs we do not need to specify it here. | 195 // from the inputs we do not need to specify it here. |
196 CMoveNode *CMoveNode::make( Compile *C, Node *c, Node *bol, Node *left, Node *right, const Type *t ) { | 196 CMoveNode *CMoveNode::make( Compile *C, Node *c, Node *bol, Node *left, Node *right, const Type *t ) { |
197 switch( t->basic_type() ) { | 197 switch( t->basic_type() ) { |
198 case T_INT: return new (C, 4) CMoveINode( bol, left, right, t->is_int() ); | 198 case T_INT: return new (C) CMoveINode( bol, left, right, t->is_int() ); |
199 case T_FLOAT: return new (C, 4) CMoveFNode( bol, left, right, t ); | 199 case T_FLOAT: return new (C) CMoveFNode( bol, left, right, t ); |
200 case T_DOUBLE: return new (C, 4) CMoveDNode( bol, left, right, t ); | 200 case T_DOUBLE: return new (C) CMoveDNode( bol, left, right, t ); |
201 case T_LONG: return new (C, 4) CMoveLNode( bol, left, right, t->is_long() ); | 201 case T_LONG: return new (C) CMoveLNode( bol, left, right, t->is_long() ); |
202 case T_OBJECT: return new (C, 4) CMovePNode( c, bol, left, right, t->is_oopptr() ); | 202 case T_OBJECT: return new (C) CMovePNode( c, bol, left, right, t->is_oopptr() ); |
203 case T_ADDRESS: return new (C, 4) CMovePNode( c, bol, left, right, t->is_ptr() ); | 203 case T_ADDRESS: return new (C) CMovePNode( c, bol, left, right, t->is_ptr() ); |
204 case T_NARROWOOP: return new (C, 4) CMoveNNode( c, bol, left, right, t ); | 204 case T_NARROWOOP: return new (C) CMoveNNode( c, bol, left, right, t ); |
205 default: | 205 default: |
206 ShouldNotReachHere(); | 206 ShouldNotReachHere(); |
207 return NULL; | 207 return NULL; |
208 } | 208 } |
209 } | 209 } |
266 // Convert to a bool (flipped) | 266 // Convert to a bool (flipped) |
267 // Build int->bool conversion | 267 // Build int->bool conversion |
268 #ifndef PRODUCT | 268 #ifndef PRODUCT |
269 if( PrintOpto ) tty->print_cr("CMOV to I2B"); | 269 if( PrintOpto ) tty->print_cr("CMOV to I2B"); |
270 #endif | 270 #endif |
271 Node *n = new (phase->C, 2) Conv2BNode( cmp->in(1) ); | 271 Node *n = new (phase->C) Conv2BNode( cmp->in(1) ); |
272 if( flip ) | 272 if( flip ) |
273 n = new (phase->C, 3) XorINode( phase->transform(n), phase->intcon(1) ); | 273 n = new (phase->C) XorINode( phase->transform(n), phase->intcon(1) ); |
274 | 274 |
275 return n; | 275 return n; |
276 } | 276 } |
277 | 277 |
278 //============================================================================= | 278 //============================================================================= |
322 // Allow only SubF(0,X) and fail out for all others; NegF is not OK | 322 // Allow only SubF(0,X) and fail out for all others; NegF is not OK |
323 if( sub->Opcode() != Op_SubF || | 323 if( sub->Opcode() != Op_SubF || |
324 sub->in(2) != X || | 324 sub->in(2) != X || |
325 phase->type(sub->in(1)) != TypeF::ZERO ) return NULL; | 325 phase->type(sub->in(1)) != TypeF::ZERO ) return NULL; |
326 | 326 |
327 Node *abs = new (phase->C, 2) AbsFNode( X ); | 327 Node *abs = new (phase->C) AbsFNode( X ); |
328 if( flip ) | 328 if( flip ) |
329 abs = new (phase->C, 3) SubFNode(sub->in(1), phase->transform(abs)); | 329 abs = new (phase->C) SubFNode(sub->in(1), phase->transform(abs)); |
330 | 330 |
331 return abs; | 331 return abs; |
332 } | 332 } |
333 | 333 |
334 //============================================================================= | 334 //============================================================================= |
378 // Allow only SubD(0,X) and fail out for all others; NegD is not OK | 378 // Allow only SubD(0,X) and fail out for all others; NegD is not OK |
379 if( sub->Opcode() != Op_SubD || | 379 if( sub->Opcode() != Op_SubD || |
380 sub->in(2) != X || | 380 sub->in(2) != X || |
381 phase->type(sub->in(1)) != TypeD::ZERO ) return NULL; | 381 phase->type(sub->in(1)) != TypeD::ZERO ) return NULL; |
382 | 382 |
383 Node *abs = new (phase->C, 2) AbsDNode( X ); | 383 Node *abs = new (phase->C) AbsDNode( X ); |
384 if( flip ) | 384 if( flip ) |
385 abs = new (phase->C, 3) SubDNode(sub->in(1), phase->transform(abs)); | 385 abs = new (phase->C) SubDNode(sub->in(1), phase->transform(abs)); |
386 | 386 |
387 return abs; | 387 return abs; |
388 } | 388 } |
389 | 389 |
390 | 390 |
959 jlong rylo0 = rylo; | 959 jlong rylo0 = rylo; |
960 rylo = -ryhi; | 960 rylo = -ryhi; |
961 ryhi = -rylo0; | 961 ryhi = -rylo0; |
962 } | 962 } |
963 | 963 |
964 Node* cx = phase->transform( new (phase->C, 2) ConvI2LNode(x, TypeLong::make(rxlo, rxhi, widen)) ); | 964 Node* cx = phase->transform( new (phase->C) ConvI2LNode(x, TypeLong::make(rxlo, rxhi, widen)) ); |
965 Node* cy = phase->transform( new (phase->C, 2) ConvI2LNode(y, TypeLong::make(rylo, ryhi, widen)) ); | 965 Node* cy = phase->transform( new (phase->C) ConvI2LNode(y, TypeLong::make(rylo, ryhi, widen)) ); |
966 switch (op) { | 966 switch (op) { |
967 case Op_AddI: return new (phase->C, 3) AddLNode(cx, cy); | 967 case Op_AddI: return new (phase->C) AddLNode(cx, cy); |
968 case Op_SubI: return new (phase->C, 3) SubLNode(cx, cy); | 968 case Op_SubI: return new (phase->C) SubLNode(cx, cy); |
969 default: ShouldNotReachHere(); | 969 default: ShouldNotReachHere(); |
970 } | 970 } |
971 } | 971 } |
972 #endif //_LP64 | 972 #endif //_LP64 |
973 | 973 |
1037 Node* x = andl->in(1); | 1037 Node* x = andl->in(1); |
1038 Node* y = andl->in(2); | 1038 Node* y = andl->in(2); |
1039 assert( x != andl && y != andl, "dead loop in ConvL2INode::Ideal" ); | 1039 assert( x != andl && y != andl, "dead loop in ConvL2INode::Ideal" ); |
1040 if (phase->type(x) == Type::TOP) return NULL; | 1040 if (phase->type(x) == Type::TOP) return NULL; |
1041 if (phase->type(y) == Type::TOP) return NULL; | 1041 if (phase->type(y) == Type::TOP) return NULL; |
1042 Node *add1 = phase->transform(new (phase->C, 2) ConvL2INode(x)); | 1042 Node *add1 = phase->transform(new (phase->C) ConvL2INode(x)); |
1043 Node *add2 = phase->transform(new (phase->C, 2) ConvL2INode(y)); | 1043 Node *add2 = phase->transform(new (phase->C) ConvL2INode(y)); |
1044 return new (phase->C, 3) AddINode(add1,add2); | 1044 return new (phase->C) AddINode(add1,add2); |
1045 } | 1045 } |
1046 | 1046 |
1047 // Disable optimization: LoadL->ConvL2I ==> LoadI. | 1047 // Disable optimization: LoadL->ConvL2I ==> LoadI. |
1048 // It causes problems (sizes of Load and Store nodes do not match) | 1048 // It causes problems (sizes of Load and Store nodes do not match) |
1049 // in objects initialization code and Escape Analysis. | 1049 // in objects initialization code and Escape Analysis. |
1076 static inline Node* addP_of_X2P(PhaseGVN *phase, | 1076 static inline Node* addP_of_X2P(PhaseGVN *phase, |
1077 Node* base, | 1077 Node* base, |
1078 Node* dispX, | 1078 Node* dispX, |
1079 bool negate = false) { | 1079 bool negate = false) { |
1080 if (negate) { | 1080 if (negate) { |
1081 dispX = new (phase->C, 3) SubXNode(phase->MakeConX(0), phase->transform(dispX)); | 1081 dispX = new (phase->C) SubXNode(phase->MakeConX(0), phase->transform(dispX)); |
1082 } | 1082 } |
1083 return new (phase->C, 4) AddPNode(phase->C->top(), | 1083 return new (phase->C) AddPNode(phase->C->top(), |
1084 phase->transform(new (phase->C, 2) CastX2PNode(base)), | 1084 phase->transform(new (phase->C) CastX2PNode(base)), |
1085 phase->transform(dispX)); | 1085 phase->transform(dispX)); |
1086 } | 1086 } |
1087 | 1087 |
1088 Node *CastX2PNode::Ideal(PhaseGVN *phase, bool can_reshape) { | 1088 Node *CastX2PNode::Ideal(PhaseGVN *phase, bool can_reshape) { |
1089 // convert CastX2P(AddX(x, y)) to AddP(CastX2P(x), y) if y fits in an int | 1089 // convert CastX2P(AddX(x, y)) to AddP(CastX2P(x), y) if y fits in an int |