{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/coreclr/issues/2555","labels_url":"https://api.github.com/repos/dotnet/coreclr/issues/2555/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/2555/comments","events_url":"https://api.github.com/repos/dotnet/coreclr/issues/2555/events","html_url":"https://github.com/dotnet/coreclr/issues/2555","id":125416559,"number":2555,"title":"Document any Memory model/visibility changes when executing on X64 Linux/Mac","user":{"login":"clrjunkie","id":15968411,"avatar_url":"https://avatars.githubusercontent.com/u/15968411?v=3","gravatar_id":"","url":"https://api.github.com/users/clrjunkie","html_url":"https://github.com/clrjunkie","followers_url":"https://api.github.com/users/clrjunkie/followers","following_url":"https://api.github.com/users/clrjunkie/following{/other_user}","gists_url":"https://api.github.com/users/clrjunkie/gists{/gist_id}","starred_url":"https://api.github.com/users/clrjunkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clrjunkie/subscriptions","organizations_url":"https://api.github.com/users/clrjunkie/orgs","repos_url":"https://api.github.com/users/clrjunkie/repos","events_url":"https://api.github.com/users/clrjunkie/events{/privacy}","received_events_url":"https://api.github.com/users/clrjunkie/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/coreclr/labels/docs","name":"docs","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/dotnet/coreclr/milestones/5","html_url":"https://github.com/dotnet/coreclr/milestones/Future","labels_url":"https://api.github.com/repos/dotnet/coreclr/milestones/5/labels","id":1328081,"number":5,"title":"Future","description":"Milestone tracking the issues that have been triaged for after 1.0.0-rtm","creator":{"login":"joshfree","id":1302850,"avatar_url":"https://avatars.githubusercontent.com/u/1302850?v=3","gravatar_id":"","url":"https://api.github.com/users/joshfree","html_url":"https://github.com/joshfree","followers_url":"https://api.github.com/users/joshfree/followers","following_url":"https://api.github.com/users/joshfree/following{/other_user}","gists_url":"https://api.github.com/users/joshfree/gists{/gist_id}","starred_url":"https://api.github.com/users/joshfree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshfree/subscriptions","organizations_url":"https://api.github.com/users/joshfree/orgs","repos_url":"https://api.github.com/users/joshfree/repos","events_url":"https://api.github.com/users/joshfree/events{/privacy}","received_events_url":"https://api.github.com/users/joshfree/received_events","type":"User","site_admin":false},"open_issues":234,"closed_issues":10,"state":"open","created_at":"2015-09-29T00:26:07Z","updated_at":"2016-01-08T09:02:38Z","due_on":null,"closed_at":null},"comments":8,"created_at":"2016-01-07T15:33:42Z","updated_at":"2016-01-08T13:19:23Z","closed_at":null,"body":"For example: Are all writes volatile? Does lock still generate a full barrier?"},"comment":{"url":"https://api.github.com/repos/dotnet/coreclr/issues/comments/170001089","html_url":"https://github.com/dotnet/coreclr/issues/2555#issuecomment-170001089","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/2555","id":170001089,"user":{"login":"zpodlovics","id":8523206,"avatar_url":"https://avatars.githubusercontent.com/u/8523206?v=3","gravatar_id":"","url":"https://api.github.com/users/zpodlovics","html_url":"https://github.com/zpodlovics","followers_url":"https://api.github.com/users/zpodlovics/followers","following_url":"https://api.github.com/users/zpodlovics/following{/other_user}","gists_url":"https://api.github.com/users/zpodlovics/gists{/gist_id}","starred_url":"https://api.github.com/users/zpodlovics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zpodlovics/subscriptions","organizations_url":"https://api.github.com/users/zpodlovics/orgs","repos_url":"https://api.github.com/users/zpodlovics/repos","events_url":"https://api.github.com/users/zpodlovics/events{/privacy}","received_events_url":"https://api.github.com/users/zpodlovics/received_events","type":"User","site_admin":false},"created_at":"2016-01-08T13:19:23Z","updated_at":"2016-01-08T13:19:23Z","body":"Yes, I am aware of the ECMA 335 spec five page \"I.12.6 Memory model and optimizations\" section.\r\n\r\nCarolEidt comment from https://github.com/dotnet/coreclr/issues/422\r\n\r\n\"As far as I know there is no formal definition for the CLR memory model, though this blog post from some years ago describes the de facto model pretty accurately, I believe: http://joeduffyblog.com/2007/11/10/clr-20-memory-model/. A couple of additional points:\r\n\r\nFirst, the JIT is somewhat more conservative than Joe describes in his post. That is, I don't think it will eliminate stores to \"non-local\" fields even if they are \"adjacent\" (i.e. not separated by any calls or aliased references that could be accessing them). By \"non-local\" I mean any location that may be visible to other threads.\r\n\r\nSecond, the JIT is also somewhat limited in its optimizations, which means that even the load will not be eliminated because it would require a loop transformation to enregister the counter prior to the loop.\"\r\n\r\nJoe Duffy comment from the same page:\r\n\r\n\"We have constructed our model over years of informal work and design-by-example, but something about the JMM approach is far more attractive. Lastly, what I've described applies to the implemented memory model, and not to what was specified in ECMA.\""}}