RFR: 8259021 avoid double racy reads from non-volatile fields of SharedSecrets [v2]

Richard Reingruber rrich at openjdk.java.net
Mon Jan 4 15:59:58 UTC 2021

On Mon, 4 Jan 2021 15:11:27 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Peter Levart has updated the pull request incrementally with one additional commit since the last revision:
>>   revert the unrelated change
> The bug title and the PR title need to be the same.
> Editing either one is fine.

But wouldn't it be legal for a compiler (java to bytecode or bytecode to
machinecode) to replace references of my_local_copy with references to

Foo my_local_copy = static_field;
if (my_copy == null) {
   my_local_copy = static_field;
return my_local_copy;

Only if static_field was volatile this would be illegal, wouldn't it?


PR: https://git.openjdk.java.net/jdk/pull/1914

More information about the core-libs-dev mailing list