--- old/src/share/vm/opto/compile.cpp 2011-12-07 12:03:23.000000000 +0100 +++ new/src/share/vm/opto/compile.cpp 2011-12-07 12:03:23.000000000 +0100 @@ -1307,10 +1307,12 @@ // these 2 disparate memories into the same alias class. Since the // primary supertype array is read-only, there's no chance of confusion // where we bypass an array load and an array store. - uint off2 = offset - Klass::primary_supers_offset_in_bytes(); + // Bug: the "- sizeof(klassOopDesc)" bug was exposed by moving + // sizeof(klassOopDesc) into the *_offset_in_bytes() functions. + uint off2 = offset - (Klass::primary_supers_offset_in_bytes() - sizeof(klassOopDesc)); if( offset == Type::OffsetBot || off2 < Klass::primary_super_limit()*wordSize ) { - offset = sizeof(oopDesc) +Klass::secondary_super_cache_offset_in_bytes(); + offset = Klass::secondary_super_cache_offset_in_bytes(); tj = tk = TypeKlassPtr::make( TypePtr::NotNull, tk->klass(), offset ); } } @@ -1489,13 +1491,13 @@ alias_type(idx)->set_rewritable(false); } if (flat->isa_klassptr()) { - if (flat->offset() == Klass::super_check_offset_offset_in_bytes() + (int)sizeof(oopDesc)) + if (flat->offset() == Klass::super_check_offset_offset_in_bytes()) alias_type(idx)->set_rewritable(false); - if (flat->offset() == Klass::modifier_flags_offset_in_bytes() + (int)sizeof(oopDesc)) + if (flat->offset() == Klass::modifier_flags_offset_in_bytes()) alias_type(idx)->set_rewritable(false); - if (flat->offset() == Klass::access_flags_offset_in_bytes() + (int)sizeof(oopDesc)) + if (flat->offset() == Klass::access_flags_offset_in_bytes()) alias_type(idx)->set_rewritable(false); - if (flat->offset() == Klass::java_mirror_offset_in_bytes() + (int)sizeof(oopDesc)) + if (flat->offset() == Klass::java_mirror_offset_in_bytes()) alias_type(idx)->set_rewritable(false); } // %%% (We would like to finalize JavaThread::threadObj_offset(),