RFR: 8352681: C2 compilation hits asserts "must set the initial type just once"

Cesar Soares Lucas cslucas at openjdk.org
Mon Apr 7 16:23:53 UTC 2025


On Mon, 7 Apr 2025 13:07:18 GMT, Damon Fenacci <dfenacci at openjdk.org> wrote:

>> The reason for the error reported is that when RAM tries to reduce a field load through a Phi it ends up calling `step_through_mergemem` with `_delay_transform` set to true and, since `step_through_mergemem` assumes that `_delay_transform` is `false`, it calls `igvn->transform` passing a MergeMem that has been added to the graph long ago.
>> 
>> I didn't opt to make `_delay_transform` false during the RAM transformations because that seemed to be a risky move, nevertheless I'll create an RFE and keep investigating that option.
>> 
>> Also, while working on a test case I found that C2 doesn't remove (at least not before EA steps) the `if (param != param) {...}` and I'm going to investigate that as a separate RFE.
>> 
>> I tested this with JTREG Tier 1-3 on Linux x86_64.
>
> test/hotspot/jtreg/compiler/escapeAnalysis/TestReduceAllocationAndSetTypeTwice.java line 32:
> 
>> 30:  *                   -Xcomp compiler.escapeAnalysis.TestReduceAllocationAndSetTypeTwice
>> 31:  * @run main compiler.escapeAnalysis.TestReduceAllocationAndSetTypeTwice
>> 32:  */
> 
> I quickly tried to trigger the crash with this regression test (with macosx-aarch64 and linux-x64 debug versions) but wasn't able to. On the other hand it crashed with the Test file attached to the JBS issue. Did you try on a specific architecture? Is there possibly something missing?

Good catch. Thanks. It's missing a `-XX:CompileCommand=dontinline,*TestReduceAllocationAndSetTypeTwice*::*`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24471#discussion_r2031594231


More information about the hotspot-compiler-dev mailing list