On Thu, 30 Jun 2022 12:08:19 GMT, Сергей Цыпанов <d...@openjdk.org> wrote:

>> If there are two threads calling `Executable.hasRealParameterData()` under 
>> race and the first one writes into volatile `Executable.parameters` field 
>> (doing _releasing store_) and the second thread reads non-null value from 
>> the same field (doing acquiring read) then it must read exactly the same 
>> value written into `hasRealParameterData` within `privateGetParameters()`. 
>> The reason for this is that we assign `hasRealParameterData` before  
>> _releasing store_.
>> 
>> In the opposite case (_acquiring read_ reads null) the second thread writes 
>> the value itself and returns it from the method so there is no change in 
>> behavior.
>
> Сергей Цыпанов has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8288327: Inline privateGetParameters()

Changes requested by plevart (Reviewer).

src/java.base/share/classes/java/lang/reflect/Executable.java line 457:

> 455:     private transient @Stable ParameterData parameterData;
> 456: 
> 457:     record ParameterData(@Stable Parameter[] parameters, boolean isReal) 
> {}

Record fields are implicitly "trusted final", which means they don't need 
@Stable annotation:
https://github.com/openjdk/jdk/blob/124c63c17c897404e3c5c3615d6727303e4f3d06/src/hotspot/share/ci/ciField.cpp#L240

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

PR: https://git.openjdk.org/jdk/pull/9143

Reply via email to