mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-17 13:55:20 +00:00
7131302: connode.cpp:205 Error: ShouldNotReachHere()
Add Value() methods to short and byte Load nodes to truncate constants which does not fit. Reviewed-by: jrose
This commit is contained in:
parent
4e648d883d
commit
5b3f2efc2e
@ -1718,8 +1718,10 @@ const Type *LoadNode::Value( PhaseTransform *phase ) const {
|
||||
bool is_instance = (tinst != NULL) && tinst->is_known_instance_field();
|
||||
if (ReduceFieldZeroing || is_instance) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
if (is_instance) {
|
||||
@ -1759,6 +1761,19 @@ Node *LoadBNode::Ideal(PhaseGVN *phase, bool 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-------------------------------------
|
||||
//
|
||||
// If the previous store is to the same address as this load,
|
||||
@ -1775,6 +1790,19 @@ Node* LoadUBNode::Ideal(PhaseGVN* phase, bool 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-------------------------------------
|
||||
//
|
||||
// If the previous store is to the same address as this load,
|
||||
@ -1791,6 +1819,19 @@ Node *LoadUSNode::Ideal(PhaseGVN *phase, bool 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--------------------------------------
|
||||
//
|
||||
// If the previous store is to the same address as this load,
|
||||
@ -1809,6 +1850,19 @@ Node *LoadSNode::Ideal(PhaseGVN *phase, bool 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------------------------------
|
||||
// Polymorphic factory method:
|
||||
|
||||
@ -215,6 +215,7 @@ public:
|
||||
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_StoreB; }
|
||||
virtual BasicType memory_type() const { return T_BYTE; }
|
||||
};
|
||||
@ -228,6 +229,7 @@ public:
|
||||
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_StoreB; }
|
||||
virtual BasicType memory_type() const { return T_BYTE; }
|
||||
};
|
||||
@ -241,10 +243,25 @@ public:
|
||||
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_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--------------------------------------
|
||||
// Load an integer from memory
|
||||
class LoadINode : public LoadNode {
|
||||
@ -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--------------------------------------
|
||||
// Store value; requires Store, Address and Value
|
||||
class StoreNode : public MemNode {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user