[lworld] RFR: 8352647: [lworld] Remove larval InlineTypeNode in Unsafe intrinsics [v2]

Quan Anh Mai qamai at openjdk.org
Sun Mar 30 05:54:42 UTC 2025


On Wed, 26 Mar 2025 14:14:12 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> Hi,
>> 
>> As a step of #1405, I would like to remove the usage of larval value objects in `Unsafe` intrinsics. This patch also tries to make sure that `Unsafe::makePrivateBuffer` and `Unsafe::finishPrivateBuffer` are always inlined, so that larval objects do not cross call boundaries except for invoking object constructors.
>> 
>> Please take a look and review this PR, thanks a lot.
>
> Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:
> 
>   comments, set and unset larval bit

To be clear, your second example is irrelevant also because a `java.lang.Integer` is not a larval `int`, it is a fully constructed `int` and its identity comes from the lack of value classes, which will eventually be removed once value classes land. A more direct translation of your first example to non-unsafe would be something like:

    p = new Point;
    p.<init>(val, val + 10);
    if (val > 5000) {
        q = new Point;
        q.f1 = p.f1;
        q.f2 = p.f2;
        p = q;
        p.f1 = val + 10;
    }
    last_hash = p.hashCode();
    if (val > 5000) {
        p.<init>();
    }
    return p;

And I am sure the verifier would reject a bytecode sequence like this.

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

PR Comment: https://git.openjdk.org/valhalla/pull/1406#issuecomment-2764399874


More information about the valhalla-dev mailing list