When flattening the alias type for [KlassPtr + Offset], the code in
flatten_alias_type() is incorrect and leads to assertion failures at:
memnode.cpp line 87:
assert(adr_type() == NULL || adr_type()->empty() || phase->C->must_alias(adr_type(), alias_idx), "adr_type must match alias idx");
compile.cpp line 908, Compile::flatten_alias_type( const TypePtr *tj )
...
// Klass pointers to object array klasses need some flattening
const TypeKlassPtr *tk = tj->isa_klassptr();
if( tk ) {
// if we are referencing a field within a Klass, we need
// to assume the worst case of an Object
if (offset == Type::OffsetBot || offset < sizeof(Klass))
tj = tk = TypeKlassPtr::make( ptr, TypeKlassPtr::OBJECT->klass(), offset );
The problem occurs when a the memory input to an AddP changes from inexact to
exact and the input to TypeKlassPtr::make changes from TypePtr::NotNull to
TypePtr::Constant. This implies that two memory accesses can be incorrectly
scheduled when one starts out being a Constant and the other does not.
Problem has been observed on AMD64/LIN64 when running 200_check, but is in
machine independent code that is run on all platforms.