RFR(S): 8188785: CCP sets invalid type for java mirror load
tobias.hartmann at oracle.com
Fri Oct 20 08:04:04 UTC 2017
please review the following patch:
Since 8186777 , we require two loads to retrieve the java mirror from a klass oop:
The problem is that now the type of the outermost LoadP does not depend on the inner LoadP (which has a raw pointer
type) but on the type of the AddP which is one level up. CPP only propagates the types downwards to the direct users and
as a result, the mirror LoadP ends up with an incorrect (too narrow/optimistic) type.
I've verified the fix with the failing test and also verified that 8188835  is a duplicate.
During CCP, we compute the type of a Phi that merges oops of type A and B where B is a subtype of A. Since the type of
the A input was not computed yet (it was initialized to TOP at the beginning of CCP), the Phi temporarily ends up with
type B (i.e. with a type that is too narrow/optimistic). This type is propagated downwards and is being used to optimize
a java mirror load from the klass oop:
The mirror load is then folded to TypeInstPtr::make(B) which is not correct because the oop can be of type A at runtime.
More information about the hotspot-compiler-dev