< prev index next >

src/share/vm/opto/castnode.cpp

Print this page

        

*** 53,71 **** #ifdef ASSERT // Previous versions of this function had some special case logic, // which is no longer necessary. Make sure of the required effects. switch (Opcode()) { ! case Op_CastII: { const Type* t1 = phase->type(in(1)); if( t1 == Type::TOP ) assert(ft == Type::TOP, "special case #1"); const Type* rt = t1->join_speculative(_type); if (rt->empty()) assert(ft == Type::TOP, "special case #2"); break; } ! case Op_CastPP: if (phase->type(in(1)) == TypePtr::NULL_PTR && _type->isa_ptr() && _type->is_ptr()->_ptr == TypePtr::NotNull) assert(ft == Type::TOP, "special case #3"); break; } --- 53,71 ---- #ifdef ASSERT // Previous versions of this function had some special case logic, // which is no longer necessary. Make sure of the required effects. switch (Opcode()) { ! case Opcodes::Op_CastII: { const Type* t1 = phase->type(in(1)); if( t1 == Type::TOP ) assert(ft == Type::TOP, "special case #1"); const Type* rt = t1->join_speculative(_type); if (rt->empty()) assert(ft == Type::TOP, "special case #2"); break; } ! case Opcodes::Op_CastPP: if (phase->type(in(1)) == TypePtr::NULL_PTR && _type->isa_ptr() && _type->is_ptr()->_ptr == TypePtr::NotNull) assert(ft == Type::TOP, "special case #3"); break; }
*** 87,119 **** uint ConstraintCastNode::size_of() const { return sizeof(*this); } ! Node* ConstraintCastNode::make_cast(int opcode, Node* c, Node *n, const Type *t, bool carry_dependency) { switch(opcode) { ! case Op_CastII: { Node* cast = new CastIINode(n, t, carry_dependency); cast->set_req(0, c); return cast; } ! case Op_CastPP: { Node* cast = new CastPPNode(n, t, carry_dependency); cast->set_req(0, c); return cast; } ! case Op_CheckCastPP: return new CheckCastPPNode(c, n, t, carry_dependency); default: ! fatal("Bad opcode %d", opcode); } return NULL; } TypeNode* ConstraintCastNode::dominating_cast(PhaseTransform *phase) const { Node* val = in(1); Node* ctl = in(0); ! int opc = Opcode(); if (ctl == NULL) { return NULL; } // Range check CastIIs may all end up under a single range check and // in that case only the narrower CastII would be kept by the code --- 87,119 ---- uint ConstraintCastNode::size_of() const { return sizeof(*this); } ! Node* ConstraintCastNode::make_cast(Opcodes opcode, Node* c, Node *n, const Type *t, bool carry_dependency) { switch(opcode) { ! case Opcodes::Op_CastII: { Node* cast = new CastIINode(n, t, carry_dependency); cast->set_req(0, c); return cast; } ! case Opcodes::Op_CastPP: { Node* cast = new CastPPNode(n, t, carry_dependency); cast->set_req(0, c); return cast; } ! case Opcodes::Op_CheckCastPP: return new CheckCastPPNode(c, n, t, carry_dependency); default: ! fatal("Bad opcode %u", static_cast<uint>(opcode)); } return NULL; } TypeNode* ConstraintCastNode::dominating_cast(PhaseTransform *phase) const { Node* val = in(1); Node* ctl = in(0); ! Opcodes opc = Opcode(); if (ctl == NULL) { return NULL; } // Range check CastIIs may all end up under a single range check and // in that case only the narrower CastII would be kept by the code
*** 161,171 **** if (in(0) != NULL && in(0)->in(0) != NULL && in(0)->in(0)->is_If()) { assert(in(0)->is_IfFalse() || in(0)->is_IfTrue(), "should be If proj"); Node* proj = in(0); if (proj->in(0)->in(1)->is_Bool()) { Node* b = proj->in(0)->in(1); ! if (b->in(1)->Opcode() == Op_CmpI) { Node* cmp = b->in(1); if (cmp->in(1) == in(1) && phase->type(cmp->in(2))->isa_int()) { const TypeInt* in2_t = phase->type(cmp->in(2))->is_int(); const Type* t = TypeInt::INT; BoolTest test = b->as_Bool()->_test; --- 161,171 ---- if (in(0) != NULL && in(0)->in(0) != NULL && in(0)->in(0)->is_If()) { assert(in(0)->is_IfFalse() || in(0)->is_IfTrue(), "should be If proj"); Node* proj = in(0); if (proj->in(0)->in(1)->is_Bool()) { Node* b = proj->in(0)->in(1); ! if (b->in(1)->Opcode() == Opcodes::Op_CmpI) { Node* cmp = b->in(1); if (cmp->in(1) == in(1) && phase->type(cmp->in(2))->isa_int()) { const TypeInt* in2_t = phase->type(cmp->in(2))->is_int(); const Type* t = TypeInt::INT; BoolTest test = b->as_Bool()->_test;
*** 225,235 **** } // transform: // (CastII (AddI x const)) -> (AddI (CastII x) const) // So the AddI has a chance to be optimized out ! if (in(1)->Opcode() == Op_AddI) { Node* in2 = in(1)->in(2); const TypeInt* in2_t = phase->type(in2)->isa_int(); if (in2_t != NULL && in2_t->singleton()) { int in2_const = in2_t->_lo; const TypeInt* current_type = _type->is_int(); --- 225,235 ---- } // transform: // (CastII (AddI x const)) -> (AddI (CastII x) const) // So the AddI has a chance to be optimized out ! if (in(1)->Opcode() == Opcodes::Op_AddI) { Node* in2 = in(1)->in(2); const TypeInt* in2_t = phase->type(in2)->isa_int(); if (in2_t != NULL && in2_t->singleton()) { int in2_const = in2_t->_lo; const TypeInt* current_type = _type->is_int();
*** 431,455 **** phase->transform(dispX)); } Node *CastX2PNode::Ideal(PhaseGVN *phase, bool can_reshape) { // convert CastX2P(AddX(x, y)) to AddP(CastX2P(x), y) if y fits in an int ! int op = in(1)->Opcode(); Node* x; Node* y; switch (op) { ! case Op_SubX: x = in(1)->in(1); // Avoid ideal transformations ping-pong between this and AddP for raw pointers. if (phase->find_intptr_t_con(x, -1) == 0) break; y = in(1)->in(2); if (fits_in_int(phase->type(y), true)) { return addP_of_X2P(phase, x, y, true); } break; ! case Op_AddX: x = in(1)->in(1); y = in(1)->in(2); if (fits_in_int(phase->type(y))) { return addP_of_X2P(phase, x, y); } --- 431,455 ---- phase->transform(dispX)); } Node *CastX2PNode::Ideal(PhaseGVN *phase, bool can_reshape) { // convert CastX2P(AddX(x, y)) to AddP(CastX2P(x), y) if y fits in an int ! Opcodes op = in(1)->Opcode(); Node* x; Node* y; switch (op) { ! case Opcodes::Op_SubX: x = in(1)->in(1); // Avoid ideal transformations ping-pong between this and AddP for raw pointers. if (phase->find_intptr_t_con(x, -1) == 0) break; y = in(1)->in(2); if (fits_in_int(phase->type(y), true)) { return addP_of_X2P(phase, x, y, true); } break; ! case Opcodes::Op_AddX: x = in(1)->in(1); y = in(1)->in(2); if (fits_in_int(phase->type(y))) { return addP_of_X2P(phase, x, y); }
*** 461,471 **** return NULL; } //------------------------------Identity--------------------------------------- Node* CastX2PNode::Identity(PhaseGVN* phase) { ! if (in(1)->Opcode() == Op_CastP2X) return in(1)->in(1); return this; } //============================================================================= //------------------------------Value------------------------------------------ --- 461,471 ---- return NULL; } //------------------------------Identity--------------------------------------- Node* CastX2PNode::Identity(PhaseGVN* phase) { ! if (in(1)->Opcode() == Opcodes::Op_CastP2X) return in(1)->in(1); return this; } //============================================================================= //------------------------------Value------------------------------------------
*** 483,490 **** return (in(0) && remove_dead_region(phase, can_reshape)) ? this : NULL; } //------------------------------Identity--------------------------------------- Node* CastP2XNode::Identity(PhaseGVN* phase) { ! if (in(1)->Opcode() == Op_CastX2P) return in(1)->in(1); return this; } --- 483,490 ---- return (in(0) && remove_dead_region(phase, can_reshape)) ? this : NULL; } //------------------------------Identity--------------------------------------- Node* CastP2XNode::Identity(PhaseGVN* phase) { ! if (in(1)->Opcode() == Opcodes::Op_CastX2P) return in(1)->in(1); return this; }
< prev index next >