[lworld] RFR: 8374165: [lworld] Shortcut in value copying can lead to incorrect substitutability tests
Frederic Parain
fparain at openjdk.org
Thu Jan 8 21:04:45 UTC 2026
On Thu, 8 Jan 2026 19:24:56 GMT, Dan Heidinga <heidinga at openjdk.org> wrote:
>> Remove an optimization in value copying that could cause incorrect results with the new substitutability test method.
>>
>> Tested with Mach5 tier 1-3.
>>
>> Thank you,
>>
>> Fred
>
> Change is straight forward and correct.
>
> Copying this comment from jbs for context in why this is the right approach:
>>The goal is to keep the default implementation of the substitutability test, and its companion the identity hash code method, as simple as possible. It is possible to make this implementation aware of the null-marker and its semantic, but it would make the code much more complex. Resetting a flat value by rewriting its whole content when it is nullified is a simple approach, as the code to do that is already available for values containing oops.
> A specialized version of the substitutability test, like the one a JIT can generate for a particular value type, can perfectly have a different approach and use the null-marker as indicators to skip comparison of some memory segments.
Thanks @DanHeidinga @coleenp for the reviews.
-------------
PR Comment: https://git.openjdk.org/valhalla/pull/1869#issuecomment-3725783318
More information about the valhalla-dev
mailing list