Right, the example provided by Rémi shows the issue. The null marker needs to 
be written atomically with the payload.

Best regards,
Tobias


On 11/6/25 2:02 PM, Remi Forax wrote:
Hello,
as far as i remember, the problem is that you can resurrect a value,
for example with a Long

Thread1
   a.x = new Long(12);
   a.x = null;
   IO.println(a.x); //12

Thread2
   IO.println(a.x);  // null
   a.x = new Long(77);   // descheduled in between writing the maker and 
writing the long


The thread1 can see the Long(12) to be resurrected, something that is not 
possible with references.

regards,
Rémi

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

    *From: *"Quân Anh Mai" <[email protected]>
    *To: *"David Alayachew" <[email protected]>
    *Cc: *"valhalla-dev" <[email protected]>
    *Sent: *Thursday, November 6, 2025 3:52:41 AM
    *Subject: *Re: About flattening a nullable j.l.Long

    Ah yes, my bad, it is https://github.com/openjdk/valhalla/pull/1720 
<https://github.com/openjdk/valhalla/pull/1720>

    On Thu, 6 Nov 2025 at 07:26, David Alayachew <[email protected] 
<mailto:[email protected]>> wrote:

        Just a heads up, your [1] is a dead link. Can you try to put the url in 
again?

        On Wed, Nov 5, 2025, 2:06 PM Quân Anh Mai <[email protected] 
<mailto:[email protected]>> wrote:

            Hi,
            Currently, I'm having a PR that allows flattening of a nullable 
value class with a 64-bit payload [1]. Dan Smith told me that some ideas along 
these lines were discussed a few years ago, and the consensus was that it was a 
dead end. May I ask what the concerns were, and whether they are still relevant 
now?

            Thanks a lot,
            Quan Anh



Reply via email to