--- old/src/share/vm/opto/cfgnode.cpp 2012-10-08 20:36:25.809110539 +0200 +++ new/src/share/vm/opto/cfgnode.cpp 2012-10-08 20:36:25.618700756 +0200 @@ -1386,7 +1386,7 @@ 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 ) + if( n->Opcode() == Op_ConP || n->Opcode() == Op_ConN || n->Opcode() == Op_ConNKlass ) break; } if( i >= phi->req() ) // Only split for constants @@ -1875,17 +1875,19 @@ } #ifdef _LP64 - // Push DecodeN down through phi. + // Push DecodeN/DecodeNKlass down through phi. // The rest of phi graph will transform by split EncodeP node though phis up. - if (UseCompressedOops && can_reshape && progress == NULL) { + if ((UseCompressedOops || UseCompressedKlassPointers) && can_reshape && progress == NULL) { bool may_push = true; bool has_decodeN = false; + bool is_decodeN = false; for (uint i=1; iis_DecodeN() && ii->bottom_type() == bottom_type()) { + 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; @@ -1895,13 +1897,18 @@ 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()); + 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; iis_DecodeN()) { + if (ii->is_DecodeNarrowPtr()) { assert(ii->bottom_type() == bottom_type(), "sanity"); new_ii = ii->in(1); } else { @@ -1909,14 +1916,22 @@ if (ii->as_Phi() == this) { new_ii = new_phi; } else { - new_ii = new (phase->C) EncodePNode(ii, narrow_t); + 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); - progress = new (phase->C) DecodeNNode(new_phi, bottom_type()); + if (is_decodeN) { + progress = new (phase->C) DecodeNNode(new_phi, bottom_type()); + } else { + progress = new (phase->C) DecodeNKlassNode(new_phi, bottom_type()); + } } } #endif