On Fri, 8 May 2026 18:25:21 GMT, Dan Smith <[email protected]> wrote:

>> Got it, thank you for checking!
>> 
>>> do you check whether this is a value object (an Integer, not a BigInteger), 
>>> or do you apply the special-case logic to all values of this, whether they 
>>> are Integers or BigIntegers?
>> 
>> We check whether this is a value object and do not care about identity 
>> objects like BigIntegers.
>> 
>>> I'm guessing a "snapshot" is an operation that only makes sense for value 
>>> objects, so you would not do it for the BigInteger.
>> 
>> Yes, exactly.
>
> Okay, then here's how I'd phrase it:
> 
>> When preview features are enabled, if the requested local is the 
>> "<code>this</code>" variable
>> of a constructor, and it references a value object, the value_ptr is set to 
>> a snapshot of the
>> value object.

On a behavioral level, I wonder how you are deciding which locals are `this` 
variables; like what happens if somebody copies `this` into local slot 3?

It may make more sense to say and implement:

> When preview features are enabled, if the frame's method is a value class 
> constructor
> and the requested local is a value object, the value_ptr is set to a snapshot 
> of the
> value object.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2412#discussion_r3210600800

Reply via email to