[PATCH] remove redundant initialization of volatile fields with default values

Сергей Цыпанов sergei.tsypanov at yandex.ru
Thu Aug 13 13:04:38 UTC 2020


I don't have account in JBS, so I cannot file an issue.

Previously when I submitted patches via core-libs-dev mailing list previleged users 
filed the issues and created web-reviews.

I think this should be a subtask of https://bugs.openjdk.java.net/browse/JDK-6736490, there's
already one I've mentioned in previous mail: https://bugs.openjdk.java.net/browse/JDK-8145680

Sergey Tsypanov

13.08.2020, 14:05, "Sean Mullan" <sean.mullan at oracle.com>:
> On 8/13/20 7:04 AM, Сергей Цыпанов wrote:
>>  Hello,
>>  previously I've sent an email regarding removal of redundant assignments if default values to volatile fields, see
>>  https://mail.openjdk.java.net/pipermail/security-dev/2020-June/022137.html
>>  There was a concern whether it's completely safe to remove those assignments from JMM point of view, see
>>  https://mail.openjdk.java.net/pipermail/core-libs-dev/2020-June/067341.html
>>  Recently I've found a thread in concurrency-interest mailing list where Aleksey Shiplive tried to find a constraint
>>  agians such removal: http://cs.oswego.edu/pipermail/concurrency-interest/2015-December/014767.html
>>  It appears that there are no constraitns and Doug Lea mentions in
>>  http://cs.oswego.edu/pipermail/concurrency-interest/2015-December/014770.html
>>  that "there is never any reason to explicitly initialize fields to 0/0.0/false/null"
>>  Also there we similar code changes in java.base before:
>>  - https://bugs.openjdk.java.net/browse/JDK-6736490
>>  - https://bugs.openjdk.java.net/browse/JDK-8035284
>>  - https://bugs.openjdk.java.net/browse/JDK-8145680
>>  So I think now we can accept the patch as the changes appear to be safe.
> Ok, it seems like a good change. Are you able to file a JBS issue for
> this? After that you can request a formal code review.
> Thanks,
> Sean

More information about the security-dev mailing list