8160360: Mismatched field loads are folded in LoadNode::Value
Reviewed-by: kvn, thartmann
This commit is contained in:
parent
3e441ea1a2
commit
4c31d5f745
@ -2337,6 +2337,8 @@ bool LibraryCallKit::inline_unsafe_access(bool is_store, const BasicType type, c
|
||||
return false;
|
||||
}
|
||||
mismatched = (bt != type);
|
||||
} else if (alias_type->adr_type() == TypeOopPtr::BOTTOM) {
|
||||
mismatched = true; // conservatively mark all "wide" on-heap accesses as mismatched
|
||||
}
|
||||
|
||||
// First guess at the value type.
|
||||
|
@ -1713,9 +1713,6 @@ const Type* LoadNode::Value(PhaseGVN* phase) const {
|
||||
}
|
||||
}
|
||||
} else if (tp->base() == Type::InstPtr) {
|
||||
ciEnv* env = C->env();
|
||||
const TypeInstPtr* tinst = tp->is_instptr();
|
||||
ciKlass* klass = tinst->klass();
|
||||
assert( off != Type::OffsetBot ||
|
||||
// arrays can be cast to Objects
|
||||
tp->is_oopptr()->klass()->is_java_lang_Object() ||
|
||||
@ -1723,9 +1720,11 @@ const Type* LoadNode::Value(PhaseGVN* phase) const {
|
||||
C->has_unsafe_access(),
|
||||
"Field accesses must be precise" );
|
||||
// For oop loads, we expect the _type to be precise.
|
||||
// Optimizations for constant objects
|
||||
|
||||
// Optimize loads from constant fields.
|
||||
const TypeInstPtr* tinst = tp->is_instptr();
|
||||
ciObject* const_oop = tinst->const_oop();
|
||||
if (const_oop != NULL && const_oop->is_instance()) {
|
||||
if (!is_mismatched_access() && off != Type::OffsetBot && const_oop != NULL && const_oop->is_instance()) {
|
||||
const Type* con_type = Type::make_constant_from_field(const_oop->as_instance(), off, is_unsigned(), memory_type());
|
||||
if (con_type != NULL) {
|
||||
return con_type;
|
||||
|
@ -936,7 +936,7 @@ public:
|
||||
};
|
||||
|
||||
//------------------------------TypeOopPtr-------------------------------------
|
||||
// Some kind of oop (Java pointer), either klass or instance or array.
|
||||
// Some kind of oop (Java pointer), either instance or array.
|
||||
class TypeOopPtr : public TypePtr {
|
||||
protected:
|
||||
TypeOopPtr(TYPES t, PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id,
|
||||
|
Loading…
Reference in New Issue
Block a user