On Thu, 18 Jun 2026 14:17:10 GMT, Jorn Vernee <[email protected]> wrote:

>> I can degrade the calls to be reporting only read for cas: after the first 
>> write, we don't really care about future writes.
>
> Right, but shouldn't we be able to read after a _successful_ CAS? Reporting 
> the write seems needed as well.
> 
> I just had a look with a debugger, and it seems the ordering of the read 
> check before the write check in `initialize` saves us. The read check will 
> throw an exception, so the write check (which clears the bit) never actually 
> happens.
> 
> I think it would still be good to add a test case for CAS, and maybe a 
> comment that the read check should be ordered before the write check in 
> `initialize`.

Ah, I see what you're saying now: CAS only works on already initialized fields 
any way, since it does a read first. Okay, that makes sense.

-------------

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2550#discussion_r3436500208

Reply via email to