Invalid code generated by C2 compiler in OpenJDK 21

Antoine DESSAIGNE antoine.dessaigne at gmail.com
Fri Dec 15 20:08:37 UTC 2023


Hi Volker,

> Is your code doing a lot of dynamic class loading and/or bytecode
> instrumentation/rewriting?

No bytecode instrumentation or rewriting. We do use OSGi and proxies
*but* all loading is paused while we process a file. Processing this
file makes thousands of calls to this method which gets compiled by
C2, then it throws the exception. If I stop at level 3 with
-XX:TieredStopAtLevel=3 then I don't have the exception.

And I'm sure I have the right commit because all my tests with its
parent commit are successful. Now I still don't understand how it can
have this side effect.

Le ven. 15 déc. 2023 à 18:44, Volker Simonis
<volker.simonis at gmail.com> a écrit :
>
> 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?
>
> 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