[lworld] RFR: 8367785: [lworld] Compiler adherence to new memory model rules for strict instance fields
Chen Liang
liach at openjdk.org
Mon Oct 6 15:08:27 UTC 2025
On Mon, 6 Oct 2025 06:01:38 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:
>> src/hotspot/share/c1/c1_LIRGenerator.cpp line 3019:
>>
>>> 3017: // Check if we need a membar at the beginning of the java.lang.Object
>>> 3018: // constructor to satisfy the memory model for strict fields.
>>> 3019: if (EnableValhalla && method()->intrinsic_id() == vmIntrinsics::_Object_init) {
>>
>> Should we perform checks to try skip this fence here?
>
> What checks are you suggesting? `java.lang.Object::<init>` is root of the compilation here, so we can't omit the barrier. C1 would not emit a barrier at the end of the constructor, like the interpreter does. C1 would only do that if these conditions are met:
> https://github.com/openjdk/valhalla/blob/274d56076260a490ed52df29373216617ddf73ef/src/hotspot/share/c1/c1_GraphBuilder.cpp#L1645-L1652
Thanks, didn't realize this is for the compilation root.
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1656#discussion_r2406878367
More information about the valhalla-dev
mailing list