2840 assert(in1->is_DecodeN(), "compare klass to null?"); |
2840 assert(in1->is_DecodeN(), "compare klass to null?"); |
2841 // Don't convert CmpP null check into CmpN if compressed |
2841 // Don't convert CmpP null check into CmpN if compressed |
2842 // oops implicit null check is not generated. |
2842 // oops implicit null check is not generated. |
2843 // This will allow to generate normal oop implicit null check. |
2843 // This will allow to generate normal oop implicit null check. |
2844 if (Matcher::gen_narrow_oop_implicit_null_checks()) |
2844 if (Matcher::gen_narrow_oop_implicit_null_checks()) |
2845 new_in2 = ConNode::make(this, TypeNarrowOop::NULL_PTR); |
2845 new_in2 = ConNode::make(TypeNarrowOop::NULL_PTR); |
2846 // |
2846 // |
2847 // This transformation together with CastPP transformation above |
2847 // This transformation together with CastPP transformation above |
2848 // will generated code for implicit NULL checks for compressed oops. |
2848 // will generated code for implicit NULL checks for compressed oops. |
2849 // |
2849 // |
2850 // The original code after Optimize() |
2850 // The original code after Optimize() |
2879 // decode_not_null narrow_oop_reg, base_reg |
2879 // decode_not_null narrow_oop_reg, base_reg |
2880 // Load [base_reg + offset], val_reg |
2880 // Load [base_reg + offset], val_reg |
2881 // NullCheck base_reg |
2881 // NullCheck base_reg |
2882 // |
2882 // |
2883 } else if (t->isa_oopptr()) { |
2883 } else if (t->isa_oopptr()) { |
2884 new_in2 = ConNode::make(this, t->make_narrowoop()); |
2884 new_in2 = ConNode::make(t->make_narrowoop()); |
2885 } else if (t->isa_klassptr()) { |
2885 } else if (t->isa_klassptr()) { |
2886 new_in2 = ConNode::make(this, t->make_narrowklass()); |
2886 new_in2 = ConNode::make(t->make_narrowklass()); |
2887 } |
2887 } |
2888 } |
2888 } |
2889 if (new_in2 != NULL) { |
2889 if (new_in2 != NULL) { |
2890 Node* cmpN = new CmpNNode(in1->in(1), new_in2); |
2890 Node* cmpN = new CmpNNode(in1->in(1), new_in2); |
2891 n->subsume_by(cmpN, this); |
2891 n->subsume_by(cmpN, this); |
2914 n->subsume_by(in1->in(1), this); |
2914 n->subsume_by(in1->in(1), this); |
2915 } else if (in1->Opcode() == Op_ConP) { |
2915 } else if (in1->Opcode() == Op_ConP) { |
2916 const Type* t = in1->bottom_type(); |
2916 const Type* t = in1->bottom_type(); |
2917 if (t == TypePtr::NULL_PTR) { |
2917 if (t == TypePtr::NULL_PTR) { |
2918 assert(t->isa_oopptr(), "null klass?"); |
2918 assert(t->isa_oopptr(), "null klass?"); |
2919 n->subsume_by(ConNode::make(this, TypeNarrowOop::NULL_PTR), this); |
2919 n->subsume_by(ConNode::make(TypeNarrowOop::NULL_PTR), this); |
2920 } else if (t->isa_oopptr()) { |
2920 } else if (t->isa_oopptr()) { |
2921 n->subsume_by(ConNode::make(this, t->make_narrowoop()), this); |
2921 n->subsume_by(ConNode::make(t->make_narrowoop()), this); |
2922 } else if (t->isa_klassptr()) { |
2922 } else if (t->isa_klassptr()) { |
2923 n->subsume_by(ConNode::make(this, t->make_narrowklass()), this); |
2923 n->subsume_by(ConNode::make(t->make_narrowklass()), this); |
2924 } |
2924 } |
2925 } |
2925 } |
2926 if (in1->outcnt() == 0) { |
2926 if (in1->outcnt() == 0) { |
2927 in1->disconnect_inputs(NULL, this); |
2927 in1->disconnect_inputs(NULL, this); |
2928 } |
2928 } |
2979 // Check if a%b and a/b both exist |
2979 // Check if a%b and a/b both exist |
2980 Node* d = n->find_similar(Op_DivI); |
2980 Node* d = n->find_similar(Op_DivI); |
2981 if (d) { |
2981 if (d) { |
2982 // Replace them with a fused divmod if supported |
2982 // Replace them with a fused divmod if supported |
2983 if (Matcher::has_match_rule(Op_DivModI)) { |
2983 if (Matcher::has_match_rule(Op_DivModI)) { |
2984 DivModINode* divmod = DivModINode::make(this, n); |
2984 DivModINode* divmod = DivModINode::make(n); |
2985 d->subsume_by(divmod->div_proj(), this); |
2985 d->subsume_by(divmod->div_proj(), this); |
2986 n->subsume_by(divmod->mod_proj(), this); |
2986 n->subsume_by(divmod->mod_proj(), this); |
2987 } else { |
2987 } else { |
2988 // replace a%b with a-((a/b)*b) |
2988 // replace a%b with a-((a/b)*b) |
2989 Node* mult = new MulINode(d, d->in(2)); |
2989 Node* mult = new MulINode(d, d->in(2)); |
2999 // Check if a%b and a/b both exist |
2999 // Check if a%b and a/b both exist |
3000 Node* d = n->find_similar(Op_DivL); |
3000 Node* d = n->find_similar(Op_DivL); |
3001 if (d) { |
3001 if (d) { |
3002 // Replace them with a fused divmod if supported |
3002 // Replace them with a fused divmod if supported |
3003 if (Matcher::has_match_rule(Op_DivModL)) { |
3003 if (Matcher::has_match_rule(Op_DivModL)) { |
3004 DivModLNode* divmod = DivModLNode::make(this, n); |
3004 DivModLNode* divmod = DivModLNode::make(n); |
3005 d->subsume_by(divmod->div_proj(), this); |
3005 d->subsume_by(divmod->div_proj(), this); |
3006 n->subsume_by(divmod->mod_proj(), this); |
3006 n->subsume_by(divmod->mod_proj(), this); |
3007 } else { |
3007 } else { |
3008 // replace a%b with a-((a/b)*b) |
3008 // replace a%b with a-((a/b)*b) |
3009 Node* mult = new MulLNode(d, d->in(2)); |
3009 Node* mult = new MulLNode(d, d->in(2)); |
3025 case Op_PackL: |
3025 case Op_PackL: |
3026 case Op_PackD: |
3026 case Op_PackD: |
3027 if (n->req()-1 > 2) { |
3027 if (n->req()-1 > 2) { |
3028 // Replace many operand PackNodes with a binary tree for matching |
3028 // Replace many operand PackNodes with a binary tree for matching |
3029 PackNode* p = (PackNode*) n; |
3029 PackNode* p = (PackNode*) n; |
3030 Node* btp = p->binary_tree_pack(this, 1, n->req()); |
3030 Node* btp = p->binary_tree_pack(1, n->req()); |
3031 n->subsume_by(btp, this); |
3031 n->subsume_by(btp, this); |
3032 } |
3032 } |
3033 break; |
3033 break; |
3034 case Op_Loop: |
3034 case Op_Loop: |
3035 case Op_CountedLoop: |
3035 case Op_CountedLoop: |
3050 juint mask = (n->bottom_type() == TypeInt::INT) ? (BitsPerInt - 1) : (BitsPerLong - 1); |
3050 juint mask = (n->bottom_type() == TypeInt::INT) ? (BitsPerInt - 1) : (BitsPerLong - 1); |
3051 const TypeInt* t = in2->find_int_type(); |
3051 const TypeInt* t = in2->find_int_type(); |
3052 if (t != NULL && t->is_con()) { |
3052 if (t != NULL && t->is_con()) { |
3053 juint shift = t->get_con(); |
3053 juint shift = t->get_con(); |
3054 if (shift > mask) { // Unsigned cmp |
3054 if (shift > mask) { // Unsigned cmp |
3055 n->set_req(2, ConNode::make(this, TypeInt::make(shift & mask))); |
3055 n->set_req(2, ConNode::make(TypeInt::make(shift & mask))); |
3056 } |
3056 } |
3057 } else { |
3057 } else { |
3058 if (t == NULL || t->_lo < 0 || t->_hi > (int)mask) { |
3058 if (t == NULL || t->_lo < 0 || t->_hi > (int)mask) { |
3059 Node* shift = new AndINode(in2, ConNode::make(this, TypeInt::make(mask))); |
3059 Node* shift = new AndINode(in2, ConNode::make(TypeInt::make(mask))); |
3060 n->set_req(2, shift); |
3060 n->set_req(2, shift); |
3061 } |
3061 } |
3062 } |
3062 } |
3063 if (in2->outcnt() == 0) { // Remove dead node |
3063 if (in2->outcnt() == 0) { // Remove dead node |
3064 in2->disconnect_inputs(NULL, this); |
3064 in2->disconnect_inputs(NULL, this); |