-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Remove some volatile use on objects in corelib #100969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Tagging subscribers to this area: @dotnet/area-meta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is a new analyzer or something like that motivating this cleanup? Or is this just something that you have run into?
Personally, I like volatile
as a documentation for lock-free code. I do not have a problem with deleting it where it is not needed.
It's motivated by @VSadov citing earlier this week that such usage still results in extra fences being emitted on arm (I don't have a machine handy to test on). If that's not the case, or if we can teach the jit somehow they can be elided, I agree it's better to leave them. If not, seems like unnecessary overhead. |
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Threading/LazyInitializer.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs
Outdated
Show resolved
Hide resolved
776ab3c
to
7508d98
Compare
From a review of the use, all of this use for lazy initialization now appears to be superfluous, given our documented memory model.
7508d98
to
f30b470
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs
Show resolved
Hide resolved
From a review of the use, all of this use for lazy initialization now appears to be superfluous, given our documented memory model.
From a review of usage sites, all of this use for lazy initialization now appears to be superfluous, given our documented memory model.