On Fri, 8 May 2026 19:47:03 GMT, Chris Plummer <[email protected]> wrote:

>>> so to be safe we've got to cast a wider net and clone all value objects 
>>> accessed through a value class constructor.
>> 
>> I like this suggestion.
>> 
>> Then we need to reformulate the spec clarification to something like this:
>>> When preview features are enabled, the frame's method is a value class
>>  constructor and the local is a value object, the value_ptr is set to a 
>> snapshot of the
>> value object.
>> 
>> The implementation can be corrected by replacing the check `_index == 0` 
>> with the check `method->method_holder()->is_inline_class()`
>
>> My read on this is that if you are in a constructor, accessing local 0 
>> (this), and the current frame's method is for a value class, then the 
>> snapshot will be done. 
> 
> Sorry, I misread the code. The "value" check is on the object, not the class.

> I'm concerned about "the this variable of a constructor", though, because 
> that's not really what the code is doing. To more accurately specify it, it 
> should be "if the 0th local variable of a constructor is requested".

I think JVMTI (and by extension JDWP and JDI) assume that "this" is always in 
slot 0. Does valhalla allow it to be stored elsewhere before initialization is 
complete?

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

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

Reply via email to