Invalid code generated by C2 compiler in OpenJDK 21

Antoine DESSAIGNE antoine.dessaigne at gmail.com
Mon Dec 18 10:08:13 UTC 2023


> I wonder if there's a data race here. Is it possible that the storedValue
> is changing while this executes?

No, storedValue doesn't change. And here is how the method
getValidTime looks like
public ReadableInterval getValidTime() {
    if (this.validTime == null) {
        this.validTime = new Interval(this.startMillis,
this.endMillis); // both fields are longs
    }
    return this.validTime;
}

Once the reference to Interval is copied into my local variable
storedValueVT, no change on the other class can change it.


More information about the hotspot-compiler-dev mailing list