--- old/src/share/vm/opto/compile.cpp 2015-03-17 11:32:57.207812186 +0100 +++ new/src/share/vm/opto/compile.cpp 2015-03-17 11:32:56.869563811 +0100 @@ -2811,8 +2811,40 @@ break; } -#ifdef _LP64 case Op_CastPP: + { + // Remove CastPP nodes to gain more freedom during scheduling + // but keep the dependency they encode as control or precedence + // edges (if control is set already) on memory operations. + ResourceMark rm; + Unique_Node_List wq; + wq.push(n); + for (uint next = 0; next < wq.size(); ++next) { + Node *m = wq.at(next); + for (DUIterator_Fast imax, i = m->fast_outs(imax); i < imax; i++) { + Node* use = m->fast_out(i); + if (use->is_Mem() || use->is_EncodeNarrowPtr()) { + if (use->in(0) == NULL) { + use->set_req(0, n->in(0)); + } else { + use->add_prec(n->in(0)); + } + } else if (use->in(0) == NULL) { + switch(use->Opcode()) { + case Op_AddP: + case Op_DecodeN: + case Op_DecodeNKlass: + case Op_CheckCastPP: + break; + default: + continue; + } + wq.push(use); + } + } + } + } +#ifdef _LP64 if (n->in(1)->is_DecodeN() && Matcher::gen_narrow_oop_implicit_null_checks()) { Node* in1 = n->in(1); const Type* t = n->bottom_type(); @@ -2846,9 +2878,18 @@ if (in1->outcnt() == 0) { in1->disconnect_inputs(NULL, this); } + } else { +#endif + n->subsume_by(n->in(1), this); + if (n->outcnt() == 0) { + n->disconnect_inputs(NULL, this); + } +#ifdef _LP64 } +#endif break; +#ifdef _LP64 case Op_CmpP: // Do this transformation here to preserve CmpPNode::sub() and // other TypePtr related Ideal optimizations (for example, ptr nullness).