2000 #ifdef _LP64
2001 if (UseCompressedOops &&
2002 addp->Opcode() == Op_ConP &&
2003 addp == n->in(AddPNode::Base) &&
2004 n->in(AddPNode::Offset)->is_Con()) {
2005 // Use addressing with narrow klass to load with offset on x86.
2006 // On sparc loading 32-bits constant and decoding it have less
2007 // instructions (4) then load 64-bits constant (7).
2008 // Do this transformation here since IGVN will convert ConN back to ConP.
2009 const Type* t = addp->bottom_type();
2010 if (t->isa_oopptr()) {
2011 Node* nn = NULL;
2012
2013 // Look for existing ConN node of the same exact type.
2014 Compile* C = Compile::current();
2015 Node* r = C->root();
2016 uint cnt = r->outcnt();
2017 for (uint i = 0; i < cnt; i++) {
2018 Node* m = r->raw_out(i);
2019 if (m!= NULL && m->Opcode() == Op_ConN &&
2020 m->bottom_type()->is_narrowoop()->make_oopptr() == t) {
2021 nn = m;
2022 break;
2023 }
2024 }
2025 if (nn != NULL) {
2026 // Decode a narrow oop to match address
2027 // [R12 + narrow_oop_reg<<3 + offset]
2028 nn = new (C, 2) DecodeNNode(nn, t);
2029 n->set_req(AddPNode::Base, nn);
2030 n->set_req(AddPNode::Address, nn);
2031 if (addp->outcnt() == 0) {
2032 addp->disconnect_inputs(NULL);
2033 }
2034 }
2035 }
2036 }
2037 #endif
2038 break;
2039 }
2040
2053 Node *in1 = n->in(1);
2054 if (Matcher::clone_shift_expressions) {
2055 // x86, ARM and friends can handle 2 adds in addressing mode.
2056 // Decode a narrow oop and do implicit NULL check in address
2057 // [R12 + narrow_oop_reg<<3 + offset]
2058 in2 = ConNode::make(C, TypeNarrowOop::NULL_PTR);
2059 } else {
2060 // Don't replace CmpP(o ,null) if 'o' is used in AddP
2061 // to generate implicit NULL check on Sparc where
2062 // narrow oops can't be used in address.
2063 uint i = 0;
2064 for (; i < in1->outcnt(); i++) {
2065 if (in1->raw_out(i)->is_AddP())
2066 break;
2067 }
2068 if (i >= in1->outcnt()) {
2069 in2 = ConNode::make(C, TypeNarrowOop::NULL_PTR);
2070 }
2071 }
2072 } else if (t->isa_oopptr()) {
2073 in2 = ConNode::make(C, t->is_oopptr()->make_narrowoop());
2074 }
2075 }
2076 if( in2 != NULL ) {
2077 Node* cmpN = new (C, 3) CmpNNode(n->in(1)->in(1), in2);
2078 n->subsume_by( cmpN );
2079 }
2080 }
2081 #endif
2082
2083 case Op_ModI:
2084 if (UseDivMod) {
2085 // Check if a%b and a/b both exist
2086 Node* d = n->find_similar(Op_DivI);
2087 if (d) {
2088 // Replace them with a fused divmod if supported
2089 Compile* C = Compile::current();
2090 if (Matcher::has_match_rule(Op_DivModI)) {
2091 DivModINode* divmod = DivModINode::make(C, n);
2092 d->subsume_by(divmod->div_proj());
2093 n->subsume_by(divmod->mod_proj());
|
2000 #ifdef _LP64
2001 if (UseCompressedOops &&
2002 addp->Opcode() == Op_ConP &&
2003 addp == n->in(AddPNode::Base) &&
2004 n->in(AddPNode::Offset)->is_Con()) {
2005 // Use addressing with narrow klass to load with offset on x86.
2006 // On sparc loading 32-bits constant and decoding it have less
2007 // instructions (4) then load 64-bits constant (7).
2008 // Do this transformation here since IGVN will convert ConN back to ConP.
2009 const Type* t = addp->bottom_type();
2010 if (t->isa_oopptr()) {
2011 Node* nn = NULL;
2012
2013 // Look for existing ConN node of the same exact type.
2014 Compile* C = Compile::current();
2015 Node* r = C->root();
2016 uint cnt = r->outcnt();
2017 for (uint i = 0; i < cnt; i++) {
2018 Node* m = r->raw_out(i);
2019 if (m!= NULL && m->Opcode() == Op_ConN &&
2020 m->bottom_type()->make_ptr() == t) {
2021 nn = m;
2022 break;
2023 }
2024 }
2025 if (nn != NULL) {
2026 // Decode a narrow oop to match address
2027 // [R12 + narrow_oop_reg<<3 + offset]
2028 nn = new (C, 2) DecodeNNode(nn, t);
2029 n->set_req(AddPNode::Base, nn);
2030 n->set_req(AddPNode::Address, nn);
2031 if (addp->outcnt() == 0) {
2032 addp->disconnect_inputs(NULL);
2033 }
2034 }
2035 }
2036 }
2037 #endif
2038 break;
2039 }
2040
2053 Node *in1 = n->in(1);
2054 if (Matcher::clone_shift_expressions) {
2055 // x86, ARM and friends can handle 2 adds in addressing mode.
2056 // Decode a narrow oop and do implicit NULL check in address
2057 // [R12 + narrow_oop_reg<<3 + offset]
2058 in2 = ConNode::make(C, TypeNarrowOop::NULL_PTR);
2059 } else {
2060 // Don't replace CmpP(o ,null) if 'o' is used in AddP
2061 // to generate implicit NULL check on Sparc where
2062 // narrow oops can't be used in address.
2063 uint i = 0;
2064 for (; i < in1->outcnt(); i++) {
2065 if (in1->raw_out(i)->is_AddP())
2066 break;
2067 }
2068 if (i >= in1->outcnt()) {
2069 in2 = ConNode::make(C, TypeNarrowOop::NULL_PTR);
2070 }
2071 }
2072 } else if (t->isa_oopptr()) {
2073 in2 = ConNode::make(C, t->make_narrowoop());
2074 }
2075 }
2076 if( in2 != NULL ) {
2077 Node* cmpN = new (C, 3) CmpNNode(n->in(1)->in(1), in2);
2078 n->subsume_by( cmpN );
2079 }
2080 }
2081 #endif
2082
2083 case Op_ModI:
2084 if (UseDivMod) {
2085 // Check if a%b and a/b both exist
2086 Node* d = n->find_similar(Op_DivI);
2087 if (d) {
2088 // Replace them with a fused divmod if supported
2089 Compile* C = Compile::current();
2090 if (Matcher::has_match_rule(Op_DivModI)) {
2091 DivModINode* divmod = DivModINode::make(C, n);
2092 d->subsume_by(divmod->div_proj());
2093 n->subsume_by(divmod->mod_proj());
|