Invalid code generated by C2 compiler in OpenJDK 21

Andrew Haley aph-open at littlepinkcloud.com
Mon Dec 18 11:04:47 UTC 2023


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-runtime-dev mailing list