[lworld] RFR: 8371199: [lworld] Flattening of nullable elements of classes similar to j.l.Long
Hannes Greule
hgreule at openjdk.org
Wed Nov 5 07:33:39 UTC 2025
On Tue, 4 Nov 2025 20:57:29 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
> Suppose a value class like this `value record(String name, int idx)`, then it should contain a pointer in its payload.
I don't know how this is currently implemented in the GC, but wouldn't it make sense for the GC to check whether the value is marked as null first, and ignore the rest of the value in that case?
Especially for ZGC flattening currently doesn't happen even for `value record(String name)` from my understanding (and more generally, with compressed oops disabled?), this might be beneficial. I don't know how this interacts with GC barriers, there is most likely more to it than I know of :)
That said, restricting to payloads without oops makes this change easier to reason about, so - assuming it makes sense - extending to payloads with oops as a follow-up might be better.
-------------
PR Comment: https://git.openjdk.org/valhalla/pull/1720#issuecomment-3489739462
More information about the valhalla-dev
mailing list