comparison src/share/vm/opto/connode.cpp @ 168:7793bd37a336

6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops Summary: Generate addresses and implicit null checks with narrow oops to avoid decoding. Reviewed-by: jrose, never
author kvn
date Thu, 29 May 2008 12:04:14 -0700
parents c436414a719e
children d1605aabd0a1 8d191a7697e2
comparison
equal deleted inserted replaced
167:feeb96a45707 168:7793bd37a336
33 return (uintptr_t)in(TypeFunc::Control) + _type->hash(); 33 return (uintptr_t)in(TypeFunc::Control) + _type->hash();
34 } 34 }
35 35
36 //------------------------------make------------------------------------------- 36 //------------------------------make-------------------------------------------
37 ConNode *ConNode::make( Compile* C, const Type *t ) { 37 ConNode *ConNode::make( Compile* C, const Type *t ) {
38 if (t->isa_narrowoop()) return new (C, 1) ConNNode( t->is_narrowoop() );
39 switch( t->basic_type() ) { 38 switch( t->basic_type() ) {
40 case T_INT: return new (C, 1) ConINode( t->is_int() ); 39 case T_INT: return new (C, 1) ConINode( t->is_int() );
41 case T_LONG: return new (C, 1) ConLNode( t->is_long() ); 40 case T_LONG: return new (C, 1) ConLNode( t->is_long() );
42 case T_FLOAT: return new (C, 1) ConFNode( t->is_float_constant() ); 41 case T_FLOAT: return new (C, 1) ConFNode( t->is_float_constant() );
43 case T_DOUBLE: return new (C, 1) ConDNode( t->is_double_constant() ); 42 case T_DOUBLE: return new (C, 1) ConDNode( t->is_double_constant() );
44 case T_VOID: return new (C, 1) ConNode ( Type::TOP ); 43 case T_VOID: return new (C, 1) ConNode ( Type::TOP );
45 case T_OBJECT: return new (C, 1) ConPNode( t->is_oopptr() ); 44 case T_OBJECT: return new (C, 1) ConPNode( t->is_oopptr() );
46 case T_ARRAY: return new (C, 1) ConPNode( t->is_aryptr() ); 45 case T_ARRAY: return new (C, 1) ConPNode( t->is_aryptr() );
47 case T_ADDRESS: return new (C, 1) ConPNode( t->is_ptr() ); 46 case T_ADDRESS: return new (C, 1) ConPNode( t->is_ptr() );
47 case T_NARROWOOP: return new (C, 1) ConNNode( t->is_narrowoop() );
48 // Expected cases: TypePtr::NULL_PTR, any is_rawptr() 48 // Expected cases: TypePtr::NULL_PTR, any is_rawptr()
49 // Also seen: AnyPtr(TopPTR *+top); from command line: 49 // Also seen: AnyPtr(TopPTR *+top); from command line:
50 // r -XX:+PrintOpto -XX:CIStart=285 -XX:+CompileTheWorld -XX:CompileTheWorldStartAt=660 50 // r -XX:+PrintOpto -XX:CIStart=285 -XX:+CompileTheWorld -XX:CompileTheWorldStartAt=660
51 // %%%% Stop using TypePtr::NULL_PTR to represent nulls: use either TypeRawPtr::NULL_PTR 51 // %%%% Stop using TypePtr::NULL_PTR to represent nulls: use either TypeRawPtr::NULL_PTR
52 // or else TypeOopPtr::NULL_PTR. Then set Type::_basic_type[AnyPtr] = T_ILLEGAL 52 // or else TypeOopPtr::NULL_PTR. Then set Type::_basic_type[AnyPtr] = T_ILLEGAL
555 555
556 Node* DecodeNNode::Identity(PhaseTransform* phase) { 556 Node* DecodeNNode::Identity(PhaseTransform* phase) {
557 const Type *t = phase->type( in(1) ); 557 const Type *t = phase->type( in(1) );
558 if( t == Type::TOP ) return in(1); 558 if( t == Type::TOP ) return in(1);
559 559
560 if (in(1)->Opcode() == Op_EncodeP) { 560 if (in(1)->is_EncodeP()) {
561 // (DecodeN (EncodeP p)) -> p 561 // (DecodeN (EncodeP p)) -> p
562 return in(1)->in(1); 562 return in(1)->in(1);
563 } 563 }
564 return this; 564 return this;
565 } 565 }
570 } 570 }
571 return bottom_type(); 571 return bottom_type();
572 } 572 }
573 573
574 Node* DecodeNNode::decode(PhaseTransform* phase, Node* value) { 574 Node* DecodeNNode::decode(PhaseTransform* phase, Node* value) {
575 if (value->Opcode() == Op_EncodeP) { 575 if (value->is_EncodeP()) {
576 // (DecodeN (EncodeP p)) -> p 576 // (DecodeN (EncodeP p)) -> p
577 return value->in(1); 577 return value->in(1);
578 } 578 }
579 const Type* newtype = value->bottom_type(); 579 const Type* newtype = value->bottom_type();
580 if (newtype == TypeNarrowOop::NULL_PTR) { 580 if (newtype == TypeNarrowOop::NULL_PTR) {
589 589
590 Node* EncodePNode::Identity(PhaseTransform* phase) { 590 Node* EncodePNode::Identity(PhaseTransform* phase) {
591 const Type *t = phase->type( in(1) ); 591 const Type *t = phase->type( in(1) );
592 if( t == Type::TOP ) return in(1); 592 if( t == Type::TOP ) return in(1);
593 593
594 if (in(1)->Opcode() == Op_DecodeN) { 594 if (in(1)->is_DecodeN()) {
595 // (EncodeP (DecodeN p)) -> p 595 // (EncodeP (DecodeN p)) -> p
596 return in(1)->in(1); 596 return in(1)->in(1);
597 } 597 }
598 return this; 598 return this;
599 } 599 }
604 } 604 }
605 return bottom_type(); 605 return bottom_type();
606 } 606 }
607 607
608 Node* EncodePNode::encode(PhaseTransform* phase, Node* value) { 608 Node* EncodePNode::encode(PhaseTransform* phase, Node* value) {
609 if (value->Opcode() == Op_DecodeN) { 609 if (value->is_DecodeN()) {
610 // (EncodeP (DecodeN p)) -> p 610 // (EncodeP (DecodeN p)) -> p
611 return value->in(1); 611 return value->in(1);
612 } 612 }
613 const Type* newtype = value->bottom_type(); 613 const Type* newtype = value->bottom_type();
614 if (newtype == TypePtr::NULL_PTR) { 614 if (newtype == TypePtr::NULL_PTR) {