comparison src/share/vm/opto/connode.cpp @ 6848:8e47bac5643a

7054512: Compress class pointers after perm gen removal Summary: support of compress class pointers in the compilers. Reviewed-by: kvn, twisti
author roland
date Tue, 09 Oct 2012 10:11:38 +0200
parents e626685e9f6c
children cc32ccaaf47f
comparison
equal deleted inserted replaced
6847:65d07d9ee446 6848:8e47bac5643a
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) ConINode( t->is_int() ); 48 case T_INT: return new (C) ConINode( t->is_int() );
49 case T_LONG: return new (C) ConLNode( t->is_long() ); 49 case T_LONG: return new (C) ConLNode( t->is_long() );
50 case T_FLOAT: return new (C) ConFNode( t->is_float_constant() ); 50 case T_FLOAT: return new (C) ConFNode( t->is_float_constant() );
51 case T_DOUBLE: return new (C) ConDNode( t->is_double_constant() ); 51 case T_DOUBLE: return new (C) ConDNode( t->is_double_constant() );
52 case T_VOID: return new (C) ConNode ( Type::TOP ); 52 case T_VOID: return new (C) ConNode ( Type::TOP );
53 case T_OBJECT: return new (C) ConPNode( t->is_ptr() ); 53 case T_OBJECT: return new (C) ConPNode( t->is_ptr() );
54 case T_ARRAY: return new (C) ConPNode( t->is_aryptr() ); 54 case T_ARRAY: return new (C) ConPNode( t->is_aryptr() );
55 case T_ADDRESS: return new (C) ConPNode( t->is_ptr() ); 55 case T_ADDRESS: return new (C) ConPNode( t->is_ptr() );
56 case T_NARROWOOP: return new (C) ConNNode( t->is_narrowoop() ); 56 case T_NARROWOOP: return new (C) ConNNode( t->is_narrowoop() );
57 case T_METADATA: return new (C) ConPNode( t->is_ptr() ); 57 case T_NARROWKLASS: return new (C) ConNKlassNode( t->is_narrowklass() );
58 case T_METADATA: return new (C) ConPNode( t->is_ptr() );
58 // Expected cases: TypePtr::NULL_PTR, any is_rawptr() 59 // Expected cases: TypePtr::NULL_PTR, any is_rawptr()
59 // Also seen: AnyPtr(TopPTR *+top); from command line: 60 // Also seen: AnyPtr(TopPTR *+top); from command line:
60 // r -XX:+PrintOpto -XX:CIStart=285 -XX:+CompileTheWorld -XX:CompileTheWorldStartAt=660 61 // 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 62 // %%%% 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 63 // or else TypeOopPtr::NULL_PTR. Then set Type::_basic_type[AnyPtr] = T_ILLEGAL
445 446
446 //------------------------------Ideal_DU_postCCP------------------------------- 447 //------------------------------Ideal_DU_postCCP-------------------------------
447 // If not converting int->oop, throw away cast after constant propagation 448 // If not converting int->oop, throw away cast after constant propagation
448 Node *CastPPNode::Ideal_DU_postCCP( PhaseCCP *ccp ) { 449 Node *CastPPNode::Ideal_DU_postCCP( PhaseCCP *ccp ) {
449 const Type *t = ccp->type(in(1)); 450 const Type *t = ccp->type(in(1));
450 if (!t->isa_oop_ptr() || (in(1)->is_DecodeN() && Matcher::gen_narrow_oop_implicit_null_checks())) { 451 if (!t->isa_oop_ptr() || ((in(1)->is_DecodeN()) && Matcher::gen_narrow_oop_implicit_null_checks())) {
451 return NULL; // do not transform raw pointers or narrow oops 452 return NULL; // do not transform raw pointers or narrow oops
452 } 453 }
453 return ConstraintCastNode::Ideal_DU_postCCP(ccp); 454 return ConstraintCastNode::Ideal_DU_postCCP(ccp);
454 } 455 }
455 456
605 const Type *EncodePNode::Value( PhaseTransform *phase ) const { 606 const Type *EncodePNode::Value( PhaseTransform *phase ) const {
606 const Type *t = phase->type( in(1) ); 607 const Type *t = phase->type( in(1) );
607 if (t == Type::TOP) return Type::TOP; 608 if (t == Type::TOP) return Type::TOP;
608 if (t == TypePtr::NULL_PTR) return TypeNarrowOop::NULL_PTR; 609 if (t == TypePtr::NULL_PTR) return TypeNarrowOop::NULL_PTR;
609 610
610 assert(t->isa_oop_ptr() || UseCompressedKlassPointers && t->isa_klassptr(), "only oopptr here"); 611 assert(t->isa_oop_ptr(), "only oopptr here");
611 return t->make_narrowoop(); 612 return t->make_narrowoop();
612 } 613 }
613 614
614 615
615 Node *EncodePNode::Ideal_DU_postCCP( PhaseCCP *ccp ) { 616 Node *EncodeNarrowPtrNode::Ideal_DU_postCCP( PhaseCCP *ccp ) {
616 return MemNode::Ideal_common_DU_postCCP(ccp, this, in(1)); 617 return MemNode::Ideal_common_DU_postCCP(ccp, this, in(1));
617 } 618 }
619
620 Node* DecodeNKlassNode::Identity(PhaseTransform* phase) {
621 const Type *t = phase->type( in(1) );
622 if( t == Type::TOP ) return in(1);
623
624 if (in(1)->is_EncodePKlass()) {
625 // (DecodeNKlass (EncodePKlass p)) -> p
626 return in(1)->in(1);
627 }
628 return this;
629 }
630
631 const Type *DecodeNKlassNode::Value( PhaseTransform *phase ) const {
632 const Type *t = phase->type( in(1) );
633 if (t == Type::TOP) return Type::TOP;
634 assert(t != TypeNarrowKlass::NULL_PTR, "null klass?");
635
636 assert(t->isa_narrowklass(), "only narrow klass ptr here");
637 return t->make_ptr();
638 }
639
640 Node* EncodePKlassNode::Identity(PhaseTransform* phase) {
641 const Type *t = phase->type( in(1) );
642 if( t == Type::TOP ) return in(1);
643
644 if (in(1)->is_DecodeNKlass()) {
645 // (EncodePKlass (DecodeNKlass p)) -> p
646 return in(1)->in(1);
647 }
648 return this;
649 }
650
651 const Type *EncodePKlassNode::Value( PhaseTransform *phase ) const {
652 const Type *t = phase->type( in(1) );
653 if (t == Type::TOP) return Type::TOP;
654 assert (t != TypePtr::NULL_PTR, "null klass?");
655
656 assert(UseCompressedKlassPointers && t->isa_klassptr(), "only klass ptr here");
657 return t->make_narrowklass();
658 }
659
618 660
619 //============================================================================= 661 //=============================================================================
620 //------------------------------Identity--------------------------------------- 662 //------------------------------Identity---------------------------------------
621 Node *Conv2BNode::Identity( PhaseTransform *phase ) { 663 Node *Conv2BNode::Identity( PhaseTransform *phase ) {
622 const Type *t = phase->type( in(1) ); 664 const Type *t = phase->type( in(1) );