RFR: 8370405: C2: mismatched store from MergeStores wrongly scalarized in allocation elimination [v2]

Emanuel Peter epeter at openjdk.org
Wed Oct 29 17:12:59 UTC 2025


On Wed, 29 Oct 2025 17:03:56 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> Yes I agree that we should investigate this separately.
>
> We have these lines:
> 
>     // Note I do NOT always 'replace_in_map(obj,result)' here.
>     //  if( tk->klass()->can_be_primary_super()  )
>       // This means that if I successfully store an Object into an array-of-String
>       // I 'forget' that the Object is really now known to be a String.  I have to
>       // do this because we don't have true union types for interfaces - if I store
>       // a Baz into an array-of-Interface and then tell the optimizer it's an
>       // Interface, I forget that it's also a Baz and cannot do Baz-like field
>       // references to it.  FIX THIS WHEN UNION TYPES APPEAR!
>     //  replace_in_map( obj, res );
> 
> But we do have union types now. So this seems doable.

I modified the check to only check primitive types now. And filed this RFE:
[JDK-8370901](https://bugs.openjdk.org/browse/JDK-8370901)

@merykitty @rwestrel would either of you want to look into that?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27997#discussion_r2474295135


More information about the hotspot-compiler-dev mailing list