Invalid code generated by C2 compiler in OpenJDK 21

David Holmes david.holmes at oracle.com
Mon Dec 18 00:26:50 UTC 2023


Also from the original:

 > I bisected the repository to find where the regression comes from. I
 > found this commit 3696711efa5 [1] but it's a merge so I bisected the
 > branch and found 10737e168c9 [2].

but commit [2] is not part of the merge commit [1].

David

On 18/12/2023 10:02 am, David Holmes wrote:
> On 16/12/2023 3:44 am, Volker Simonis wrote:
>> On Fri, Dec 15, 2023 at 1:11 PM Antoine DESSAIGNE
>> <antoine.dessaigne at gmail.com> wrote:
>>>
>>> Thank you Volker and Andrew for your replies,
>>>
>>> Unfortunately, there's no hs_error generated, the code throws a
>>> NullPointerException when it shouldn't.
>>
>> Sorry, overlooked the "without" before "crashing due to assertions" :)
>>
>>>
>>> I can even reproduce it with JDK 23, I took the master of the jdk
>>> repository this morning (commit b31454e3623 to be precise) and it
>>> still fails.
>>>
>>> I cannot exclude this method from the JIT as it's used a lot in our 
>>> application.
>>>
>>> I checked many many times the commit to be sure that I have the right
>>> one and I do. It fails almost every time with 10737e168c9 [1] but it
>>> never fails with its parent commit, even after 20 tests.
>>>
>>
>> The change looks innocent, but CCing hotstpo-runtime-dev and Coleen
>> (who's the author of that change [1]). Maybe she has an idea?
> 
> Coleen is away for a while. I reviewed the change in [1] and I also 
> cannot see how it could affect anything to do with the JIT.
> 
>  From the original mail on compiler-dev:
> 
>  >  A valued local variable (effectively final) has its value removed
> 
> What does this mean???
> 
> David
> -----
> 
>> Is your code doing a lot of dynamic class loading and/or bytecode
>> instrumentation/rewriting?
>>
>>> [1] 
>>> https://github.com/openjdk/jdk/commit/10737e168c967a08e257927251861bf2c14795ab
>>>
>>> Le ven. 15 déc. 2023 à 12:37, Andrew Haley
>>> <aph-open at littlepinkcloud.com> a écrit :
>>>>
>>>> On 12/15/23 10:20, Antoine DESSAIGNE wrote:
>>>>> Do you have an idea of why this is happening? Do you know what test I
>>>>> can run?
>>>>
>>>> First, try to reproduce it with JDK 22 preview.
>>>>
>>>> If you can't provide a reproducer, it's likely that no one will be
>>>> able to fix it now, and you'll have to wait until it gets fixed.
>>>>
>>>> Try: '-XX:CompileCommand=exclude,foo.bar.baz.Classname::badMethodName'
>>>>
>>>> -- 
>>>> Andrew Haley  (he/him)
>>>> Java Platform Lead Engineer
>>>> Red Hat UK Ltd. <https://www.redhat.com>
>>>> https://keybase.io/andrewhaley
>>>> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
>>>>


More information about the hotspot-compiler-dev mailing list