[lworld] RFR: 8352647: [lworld] Remove larval InlineTypeNode in Unsafe intrinsics [v2]
Quan Anh Mai
qamai at openjdk.org
Sun Mar 30 08:27:28 UTC 2025
On Sun, 30 Mar 2025 07:59:11 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:
> Bytecode verification should be same for larval and non-larval objects, you are mixing explicit and implicit larval here which is where the confusion arises.
I have addressed this point above: "`Unsafe` lets you bypass the restriction that final fields can only be set inside the constructor of its holder class. To achieve this, it lies to the bytecode verifier that you are having a value of type `MyValue` when in reality the returned value of `Unsafe::makePrivateBuffer` is a value of type `uninitialized`. However, you still must adhere to the rules that are put on the values of type `uninitialized`". Bytecode verification being the same for `Unsafe::makePrivateBuffer` and non-larval objects is due to the fact that you are lying to the bytecode verifier when using `Unsafe`, not because they are fundamentally the same. Explicit and implicit larval objects should be fundamentally the same.
> Crash occurs at the state merge point. If you run following test with C1 compiler it works fine. So we need to address this crash in C2 compiler.
Undefined behaviour means that any behaviour is an acceptable behaviour. C1 can execute just fine and it is an acceptable outcome, C2 crashes and it is also an acceptable outcome.
> For now I am ok with your fix, please also emit the IR to set larval bit in mark word during allocation expansion.
I believe setting `AllocateNode._larval` to true will make the expansion include setting the larval bit.
-------------
PR Comment: https://git.openjdk.org/valhalla/pull/1406#issuecomment-2764447663
More information about the valhalla-dev
mailing list