94 case Op_CastII: {
95 Node* cast = new CastIINode(n, t, carry_dependency);
96 cast->set_req(0, c);
97 return cast;
98 }
99 case Op_CastPP: {
100 Node* cast = new CastPPNode(n, t, carry_dependency);
101 cast->set_req(0, c);
102 return cast;
103 }
104 case Op_CheckCastPP: return new CheckCastPPNode(c, n, t, carry_dependency);
105 default:
106 fatal("Bad opcode %d", opcode);
107 }
108 return NULL;
109 }
110
111 TypeNode* ConstraintCastNode::dominating_cast(PhaseTransform *phase) const {
112 Node* val = in(1);
113 Node* ctl = in(0);
114 int opc = Opcode();
115 if (ctl == NULL) {
116 return NULL;
117 }
118 // Range check CastIIs may all end up under a single range check and
119 // in that case only the narrower CastII would be kept by the code
120 // below which would be incorrect.
121 if (is_CastII() && as_CastII()->has_range_check()) {
122 return NULL;
123 }
124 for (DUIterator_Fast imax, i = val->fast_outs(imax); i < imax; i++) {
125 Node* u = val->fast_out(i);
126 if (u != this &&
127 u->outcnt() > 0 &&
128 u->Opcode() == opc &&
129 u->in(0) != NULL &&
130 u->bottom_type()->higher_equal(type())) {
131 if (phase->is_dominator(u->in(0), ctl)) {
132 return u->as_Type();
133 }
134 if (is_CheckCastPP() && u->in(1)->is_Proj() && u->in(1)->in(0)->is_Allocate() &&
|
94 case Op_CastII: {
95 Node* cast = new CastIINode(n, t, carry_dependency);
96 cast->set_req(0, c);
97 return cast;
98 }
99 case Op_CastPP: {
100 Node* cast = new CastPPNode(n, t, carry_dependency);
101 cast->set_req(0, c);
102 return cast;
103 }
104 case Op_CheckCastPP: return new CheckCastPPNode(c, n, t, carry_dependency);
105 default:
106 fatal("Bad opcode %d", opcode);
107 }
108 return NULL;
109 }
110
111 TypeNode* ConstraintCastNode::dominating_cast(PhaseTransform *phase) const {
112 Node* val = in(1);
113 Node* ctl = in(0);
114 uint opc = Opcode();
115 if (ctl == NULL) {
116 return NULL;
117 }
118 // Range check CastIIs may all end up under a single range check and
119 // in that case only the narrower CastII would be kept by the code
120 // below which would be incorrect.
121 if (is_CastII() && as_CastII()->has_range_check()) {
122 return NULL;
123 }
124 for (DUIterator_Fast imax, i = val->fast_outs(imax); i < imax; i++) {
125 Node* u = val->fast_out(i);
126 if (u != this &&
127 u->outcnt() > 0 &&
128 u->Opcode() == opc &&
129 u->in(0) != NULL &&
130 u->bottom_type()->higher_equal(type())) {
131 if (phase->is_dominator(u->in(0), ctl)) {
132 return u->as_Type();
133 }
134 if (is_CheckCastPP() && u->in(1)->is_Proj() && u->in(1)->in(0)->is_Allocate() &&
|