Mercurial > hg > graal-jvmci-8
diff src/share/vm/opto/cfgnode.cpp @ 368:36ccc817fca4
6747051: Improve code and implicit null check generation for compressed oops
Summary: Push DecodeN node below the Null check to the non-null path to use the mach node without 0 test.
Reviewed-by: rasbold, never
author | kvn |
---|---|
date | Tue, 23 Sep 2008 12:29:06 -0700 |
parents | 194b8e3a2fc4 |
children | cc80376deb0c |
line wrap: on
line diff
--- a/src/share/vm/opto/cfgnode.cpp Wed Sep 17 12:59:52 2008 -0700 +++ b/src/share/vm/opto/cfgnode.cpp Tue Sep 23 12:29:06 2008 -0700 @@ -1769,6 +1769,51 @@ } } +#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; + Node* in_decodeN = NULL; + for (uint i=1; i<req(); ++i) {// For all paths in + Node *ii = in(i); + if (ii->is_DecodeN() && ii->bottom_type() == bottom_type()) { + has_decodeN = true; + in_decodeN = ii->in(1); + } else if (!ii->is_Phi()) { + may_push = false; + } + } + + if (has_decodeN && may_push) { + PhaseIterGVN *igvn = phase->is_IterGVN(); + // Note: in_decodeN is used only to define the type of new phi here. + PhiNode *new_phi = PhiNode::make_blank(in(0), in_decodeN); + 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, 2) EncodePNode(ii, in_decodeN->bottom_type()); + 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, 2) DecodeNNode(new_phi, bottom_type()); + } + } +#endif + return progress; // Return any progress }