On Fri, 8 May 2026 19:50:17 GMT, Chris Plummer <[email protected]> wrote:
>>> 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? javac will always leave `this` in slot 0, and I believe the language rules don't allow users to store it in a different local variable during early construction. The verifier has no such requirement. Generated bytecode can easily do `aload_0; astore_1;`. ------------- PR Review Comment: https://git.openjdk.org/valhalla/pull/2412#discussion_r3211079655
