src/share/vm/opto/cfgnode.cpp
Print this page
rev 3688 : 7054512: Compress class pointers after perm gen removal
Summary: support of compress class pointers in the compilers.
Reviewed-by:
*** 1384,1394 ****
uint i;
for( i = 1; i < phi->req()-1; i++ ) {
Node *n = phi->in(i);
if( !n ) return NULL;
if( phase->type(n) == Type::TOP ) return NULL;
! if( n->Opcode() == Op_ConP || n->Opcode() == Op_ConN )
break;
}
if( i >= phi->req() ) // Only split for constants
return NULL;
--- 1384,1394 ----
uint i;
for( i = 1; i < phi->req()-1; i++ ) {
Node *n = phi->in(i);
if( !n ) return NULL;
if( phase->type(n) == Type::TOP ) return NULL;
! if( n->Opcode() == Op_ConP || n->Opcode() == Op_ConN || n->Opcode() == Op_ConNKlass )
break;
}
if( i >= phi->req() ) // Only split for constants
return NULL;
*** 1873,1924 ****
}
}
}
#ifdef _LP64
! // Push DecodeN down through phi.
// The rest of phi graph will transform by split EncodeP node though phis up.
! if (UseCompressedOops && can_reshape && progress == NULL) {
bool may_push = true;
bool has_decodeN = false;
for (uint i=1; i<req(); ++i) {// For all paths in
Node *ii = in(i);
! if (ii->is_DecodeN() && ii->bottom_type() == bottom_type()) {
// Do optimization if a non dead path exist.
if (ii->in(1)->bottom_type() != Type::TOP) {
has_decodeN = true;
}
} else if (!ii->is_Phi()) {
may_push = false;
}
}
if (has_decodeN && may_push) {
PhaseIterGVN *igvn = phase->is_IterGVN();
// Make narrow type for new phi.
! const Type* narrow_t = TypeNarrowOop::make(this->bottom_type()->is_ptr());
PhiNode* new_phi = new (phase->C) PhiNode(r, narrow_t);
uint orig_cnt = req();
for (uint i=1; i<req(); ++i) {// For all paths in
Node *ii = in(i);
Node* new_ii = NULL;
! if (ii->is_DecodeN()) {
assert(ii->bottom_type() == bottom_type(), "sanity");
new_ii = ii->in(1);
} else {
assert(ii->is_Phi(), "sanity");
if (ii->as_Phi() == this) {
new_ii = new_phi;
} else {
new_ii = new (phase->C) EncodePNode(ii, narrow_t);
igvn->register_new_node_with_optimizer(new_ii);
}
}
new_phi->set_req(i, new_ii);
}
igvn->register_new_node_with_optimizer(new_phi, this);
progress = new (phase->C) DecodeNNode(new_phi, bottom_type());
}
}
#endif
return progress; // Return any progress
--- 1873,1939 ----
}
}
}
#ifdef _LP64
! // Push DecodeN/DecodeNKlass down through phi.
// The rest of phi graph will transform by split EncodeP node though phis up.
! if ((UseCompressedOops || UseCompressedKlassPointers) && can_reshape && progress == NULL) {
bool may_push = true;
bool has_decodeN = false;
+ bool is_decodeN = false;
for (uint i=1; i<req(); ++i) {// For all paths in
Node *ii = in(i);
! if (ii->is_DecodeNarrowPtr() && ii->bottom_type() == bottom_type()) {
// Do optimization if a non dead path exist.
if (ii->in(1)->bottom_type() != Type::TOP) {
has_decodeN = true;
+ is_decodeN = ii->is_DecodeN();
}
} else if (!ii->is_Phi()) {
may_push = false;
}
}
if (has_decodeN && may_push) {
PhaseIterGVN *igvn = phase->is_IterGVN();
// Make narrow type for new phi.
! const Type* narrow_t;
! if (is_decodeN) {
! narrow_t = TypeNarrowOop::make(this->bottom_type()->is_ptr());
! } else {
! narrow_t = TypeNarrowKlass::make(this->bottom_type()->is_ptr());
! }
PhiNode* new_phi = new (phase->C) PhiNode(r, narrow_t);
uint orig_cnt = req();
for (uint i=1; i<req(); ++i) {// For all paths in
Node *ii = in(i);
Node* new_ii = NULL;
! if (ii->is_DecodeNarrowPtr()) {
assert(ii->bottom_type() == bottom_type(), "sanity");
new_ii = ii->in(1);
} else {
assert(ii->is_Phi(), "sanity");
if (ii->as_Phi() == this) {
new_ii = new_phi;
} else {
+ if (is_decodeN) {
new_ii = new (phase->C) EncodePNode(ii, narrow_t);
+ } else {
+ new_ii = new (phase->C) EncodePKlassNode(ii, narrow_t);
+ }
igvn->register_new_node_with_optimizer(new_ii);
}
}
new_phi->set_req(i, new_ii);
}
igvn->register_new_node_with_optimizer(new_phi, this);
+ if (is_decodeN) {
progress = new (phase->C) DecodeNNode(new_phi, bottom_type());
+ } else {
+ progress = new (phase->C) DecodeNKlassNode(new_phi, bottom_type());
+ }
}
}
#endif
return progress; // Return any progress