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:
Vladimir Kozlov 2012-01-20 09:43:06 -08:00
parent 4e648d883d
commit 5b3f2efc2e
2 changed files with 72 additions and 14 deletions

View file

@ -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: