On Mon, 20 Sep 2021 11:55:43 GMT, Andrey Turbanov 
<github.com+741251+turban...@openjdk.org> wrote:

>> This is a continuation of
>> 
>> - https://bugs.openjdk.java.net/browse/JDK-6736490
>> - https://bugs.openjdk.java.net/browse/JDK-8035284
>> - https://bugs.openjdk.java.net/browse/JDK-8145680
>> - https://bugs.openjdk.java.net/browse/JDK-8251548
>> 
>> As mentioned in JDK-6736490:
>> 
>> _An explicit initialization of a volatile class instance variable, such as 
>> private volatile Object = null; or private volatile int scale = 0; is 
>> unnecessary since the Java spec automatically initializes objects to null 
>> and primitive type short, int, long, float and double to 0 and boolean to 
>> false. Explicit initialization of volatile variable to a value the same as 
>> the default implicit initialized value results in an unnecessary store and 
>> membar operation._
>
> As I can see there are a few more zero-initializations of volatiles. Are they 
> intentionally skipped?
> 1. sun.lwawt.macosx.CPlatformEmbeddedFrame#screenX
> 2. sun.lwawt.macosx.CPlatformEmbeddedFrame#screenY
> 3. sun.lwawt.macosx.CWarningWindow#currentIcon
> 4. com.sun.media.sound.SoftSynthesizer.WeakAudioStream#silent_samples

@turbanoff nice catch! I've missed them in my original commit, no intention 
here. I've included them either.

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

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

Reply via email to