提交 8705c53f 编写于 作者: K kvn

7131302: connode.cpp:205 Error: ShouldNotReachHere()

Summary: Add Value() methods to short and byte Load nodes to truncate constants which does not fit.
Reviewed-by: jrose
上级 460bb1dc
...@@ -1718,8 +1718,10 @@ const Type *LoadNode::Value( PhaseTransform *phase ) const { ...@@ -1718,8 +1718,10 @@ const Type *LoadNode::Value( PhaseTransform *phase ) const {
bool is_instance = (tinst != NULL) && tinst->is_known_instance_field(); bool is_instance = (tinst != NULL) && tinst->is_known_instance_field();
if (ReduceFieldZeroing || is_instance) { if (ReduceFieldZeroing || is_instance) {
Node* value = can_see_stored_value(mem,phase); Node* value = can_see_stored_value(mem,phase);
if (value != NULL && value->is_Con()) if (value != NULL && value->is_Con()) {
assert(value->bottom_type()->higher_equal(_type),"sanity");
return value->bottom_type(); return value->bottom_type();
}
} }
if (is_instance) { if (is_instance) {
...@@ -1759,6 +1761,19 @@ Node *LoadBNode::Ideal(PhaseGVN *phase, bool can_reshape) { ...@@ -1759,6 +1761,19 @@ Node *LoadBNode::Ideal(PhaseGVN *phase, bool can_reshape) {
return LoadNode::Ideal(phase, can_reshape); return LoadNode::Ideal(phase, can_reshape);
} }
const Type* LoadBNode::Value(PhaseTransform *phase) const {
Node* mem = in(MemNode::Memory);
Node* value = can_see_stored_value(mem,phase);
if (value != NULL && value->is_Con()) {
// If the input to the store does not fit with the load's result type,
// it must be truncated. We can't delay until Ideal call since
// a singleton Value is needed for split_thru_phi optimization.
int con = value->get_int();
return TypeInt::make((con << 24) >> 24);
}
return LoadNode::Value(phase);
}
//--------------------------LoadUBNode::Ideal------------------------------------- //--------------------------LoadUBNode::Ideal-------------------------------------
// //
// If the previous store is to the same address as this load, // If the previous store is to the same address as this load,
...@@ -1775,6 +1790,19 @@ Node* LoadUBNode::Ideal(PhaseGVN* phase, bool can_reshape) { ...@@ -1775,6 +1790,19 @@ Node* LoadUBNode::Ideal(PhaseGVN* phase, bool can_reshape) {
return LoadNode::Ideal(phase, can_reshape); return LoadNode::Ideal(phase, can_reshape);
} }
const Type* LoadUBNode::Value(PhaseTransform *phase) const {
Node* mem = in(MemNode::Memory);
Node* value = can_see_stored_value(mem,phase);
if (value != NULL && value->is_Con()) {
// If the input to the store does not fit with the load's result type,
// it must be truncated. We can't delay until Ideal call since
// a singleton Value is needed for split_thru_phi optimization.
int con = value->get_int();
return TypeInt::make(con & 0xFF);
}
return LoadNode::Value(phase);
}
//--------------------------LoadUSNode::Ideal------------------------------------- //--------------------------LoadUSNode::Ideal-------------------------------------
// //
// If the previous store is to the same address as this load, // If the previous store is to the same address as this load,
...@@ -1791,6 +1819,19 @@ Node *LoadUSNode::Ideal(PhaseGVN *phase, bool can_reshape) { ...@@ -1791,6 +1819,19 @@ Node *LoadUSNode::Ideal(PhaseGVN *phase, bool can_reshape) {
return LoadNode::Ideal(phase, can_reshape); return LoadNode::Ideal(phase, can_reshape);
} }
const Type* LoadUSNode::Value(PhaseTransform *phase) const {
Node* mem = in(MemNode::Memory);
Node* value = can_see_stored_value(mem,phase);
if (value != NULL && value->is_Con()) {
// If the input to the store does not fit with the load's result type,
// it must be truncated. We can't delay until Ideal call since
// a singleton Value is needed for split_thru_phi optimization.
int con = value->get_int();
return TypeInt::make(con & 0xFFFF);
}
return LoadNode::Value(phase);
}
//--------------------------LoadSNode::Ideal-------------------------------------- //--------------------------LoadSNode::Ideal--------------------------------------
// //
// If the previous store is to the same address as this load, // If the previous store is to the same address as this load,
...@@ -1809,6 +1850,19 @@ Node *LoadSNode::Ideal(PhaseGVN *phase, bool can_reshape) { ...@@ -1809,6 +1850,19 @@ Node *LoadSNode::Ideal(PhaseGVN *phase, bool can_reshape) {
return LoadNode::Ideal(phase, can_reshape); return LoadNode::Ideal(phase, can_reshape);
} }
const Type* LoadSNode::Value(PhaseTransform *phase) const {
Node* mem = in(MemNode::Memory);
Node* value = can_see_stored_value(mem,phase);
if (value != NULL && value->is_Con()) {
// If the input to the store does not fit with the load's result type,
// it must be truncated. We can't delay until Ideal call since
// a singleton Value is needed for split_thru_phi optimization.
int con = value->get_int();
return TypeInt::make((con << 16) >> 16);
}
return LoadNode::Value(phase);
}
//============================================================================= //=============================================================================
//----------------------------LoadKlassNode::make------------------------------ //----------------------------LoadKlassNode::make------------------------------
// Polymorphic factory method: // Polymorphic factory method:
......
...@@ -215,6 +215,7 @@ public: ...@@ -215,6 +215,7 @@ public:
virtual int Opcode() const; virtual int Opcode() const;
virtual uint ideal_reg() const { return Op_RegI; } virtual uint ideal_reg() const { return Op_RegI; }
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
virtual const Type *Value(PhaseTransform *phase) const;
virtual int store_Opcode() const { return Op_StoreB; } virtual int store_Opcode() const { return Op_StoreB; }
virtual BasicType memory_type() const { return T_BYTE; } virtual BasicType memory_type() const { return T_BYTE; }
}; };
...@@ -228,6 +229,7 @@ public: ...@@ -228,6 +229,7 @@ public:
virtual int Opcode() const; virtual int Opcode() const;
virtual uint ideal_reg() const { return Op_RegI; } virtual uint ideal_reg() const { return Op_RegI; }
virtual Node* Ideal(PhaseGVN *phase, bool can_reshape); virtual Node* Ideal(PhaseGVN *phase, bool can_reshape);
virtual const Type *Value(PhaseTransform *phase) const;
virtual int store_Opcode() const { return Op_StoreB; } virtual int store_Opcode() const { return Op_StoreB; }
virtual BasicType memory_type() const { return T_BYTE; } virtual BasicType memory_type() const { return T_BYTE; }
}; };
...@@ -241,10 +243,25 @@ public: ...@@ -241,10 +243,25 @@ public:
virtual int Opcode() const; virtual int Opcode() const;
virtual uint ideal_reg() const { return Op_RegI; } virtual uint ideal_reg() const { return Op_RegI; }
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
virtual const Type *Value(PhaseTransform *phase) const;
virtual int store_Opcode() const { return Op_StoreC; } virtual int store_Opcode() const { return Op_StoreC; }
virtual BasicType memory_type() const { return T_CHAR; } virtual BasicType memory_type() const { return T_CHAR; }
}; };
//------------------------------LoadSNode--------------------------------------
// Load a short (16bits signed) from memory
class LoadSNode : public LoadNode {
public:
LoadSNode( Node *c, Node *mem, Node *adr, const TypePtr* at, const TypeInt *ti = TypeInt::SHORT )
: LoadNode(c,mem,adr,at,ti) {}
virtual int Opcode() const;
virtual uint ideal_reg() const { return Op_RegI; }
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
virtual const Type *Value(PhaseTransform *phase) const;
virtual int store_Opcode() const { return Op_StoreC; }
virtual BasicType memory_type() const { return T_SHORT; }
};
//------------------------------LoadINode-------------------------------------- //------------------------------LoadINode--------------------------------------
// Load an integer from memory // Load an integer from memory
class LoadINode : public LoadNode { class LoadINode : public LoadNode {
...@@ -433,19 +450,6 @@ public: ...@@ -433,19 +450,6 @@ public:
}; };
//------------------------------LoadSNode--------------------------------------
// Load a short (16bits signed) from memory
class LoadSNode : public LoadNode {
public:
LoadSNode( Node *c, Node *mem, Node *adr, const TypePtr* at, const TypeInt *ti = TypeInt::SHORT )
: LoadNode(c,mem,adr,at,ti) {}
virtual int Opcode() const;
virtual uint ideal_reg() const { return Op_RegI; }
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
virtual int store_Opcode() const { return Op_StoreC; }
virtual BasicType memory_type() const { return T_SHORT; }
};
//------------------------------StoreNode-------------------------------------- //------------------------------StoreNode--------------------------------------
// Store value; requires Store, Address and Value // Store value; requires Store, Address and Value
class StoreNode : public MemNode { class StoreNode : public MemNode {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册