Invalid code generated by C2 compiler in OpenJDK 21
Antoine DESSAIGNE
antoine.dessaigne at gmail.com
Mon Dec 18 12:07:15 UTC 2023
Quick follow-up, Aleksey Shipilev created the bug [1] and the pull
request [2] as I have no idea how long it will take for me to have the
signed OCA :)
Thank you all
Antoine
[1] https://bugs.openjdk.org/browse/JDK-8322282
[2] https://github.com/openjdk/jdk/pull/17140
Le lun. 18 déc. 2023 à 12:41, Antoine DESSAIGNE
<antoine.dessaigne at gmail.com> a écrit :
>
> Hello everyone,
>
> Good news, I've found the typo in
> https://github.com/openjdk/jdk/commit/10737e168c967a08e257927251861bf2c14795ab,
> it's in loaderConstraints.cpp.
>
> Previously it was
> } else if (pp1 == NULL) {
> pp2->extend_loader_constraint(class_name, class_loader1, klass);
> } else if (pp2 == NULL) {
> pp1->extend_loader_constraint(class_name, class_loader2, klass);
>
> Now it is (and still is on master but line numbers have changed)
> } else if (pp1 == NULL) {
> pp2->extend_loader_constraint(class_name, loader1, klass);
> } else if (pp2 == NULL) {
> pp1->extend_loader_constraint(class_name, loader1, klass);
>
> The last line should be using loader2
> pp1->extend_loader_constraint(class_name, loader2, klass);
>
> If I do the fix locally then I no longer have the issue.
>
> Now, I don't know what to do next to have it fixed. Can someone either
> do it or tell me how to do it? Thank you.
>
> Le lun. 18 déc. 2023 à 12:04, Andrew Haley
> <aph-open at littlepinkcloud.com> a écrit :
> >
> > On 12/18/23 10:08, Antoine DESSAIGNE wrote:
> >
> > >
> > > Once the reference to Interval is copied into my local variable
> > > storedValueVT, no change on the other class can change it.
> >
> > I'm not sure about that. C2 contains logic to rematerialize a value
> > rather than spilling, if it's cheaper. That could be happening here.
> > At least, I know of no place in the JMM that forbids it.
> >
> > As an experiment, you could try making validTime volatile.
> >
> > --
> > 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