On Sat, 25 Apr 2026 19:59:16 GMT, Markus Grönlund <[email protected]> wrote:

>> src/java.base/share/classes/jdk/internal/event/FinalFieldMutationEvent.java 
>> line 66:
>> 
>>> 64:                 int newRootFieldSlotEpoch =
>>> 65:                     currentEpoch << JfrEpochGeneration.EPOCH_SHIFT_INT 
>>> | (slot & JfrEpochGeneration.VALUE_MASK_INT);
>>> 66:                 return JfrEpochGeneration.compareAndExchange(root, 
>>> SLOT_OFFSET, slot, newRootFieldSlotEpoch);
>> 
>> Drive-by-comment: Can you make `slot` non-final? I'm afraid there is a 
>> chance the JIT will not produce correct code for accesses into this field if 
>> it lies about its finality. See 
>> [JDK-8379875](https://bugs.openjdk.org/browse/JDK-8379875).
>
> I will leave the `slot` final, and instead inject a dedicated field for the 
> epoch value.

Unable to add an injected field because it is not possible to reflect on it 
from Java. Committed your suggestion about making the slot field non-final. 
Thanks.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30922#discussion_r3145758575

Reply via email to