Invalid code generated by C2 compiler in OpenJDK 21

Antoine DESSAIGNE antoine.dessaigne at
Mon Dec 18 11:41:24 UTC 2023

Hello everyone,

Good news, I've found the typo in,
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> 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. <>
> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671

More information about the hotspot-compiler-dev mailing list