{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/coreclr/issues/1226","labels_url":"https://api.github.com/repos/dotnet/coreclr/issues/1226/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/1226/comments","events_url":"https://api.github.com/repos/dotnet/coreclr/issues/1226/events","html_url":"https://github.com/dotnet/coreclr/issues/1226","id":94237564,"number":1226,"title":"RyuJIT: volatile read and Volatile.Read","user":{"login":"omariom","id":1781701,"avatar_url":"https://avatars.githubusercontent.com/u/1781701?v=3","gravatar_id":"","url":"https://api.github.com/users/omariom","html_url":"https://github.com/omariom","followers_url":"https://api.github.com/users/omariom/followers","following_url":"https://api.github.com/users/omariom/following{/other_user}","gists_url":"https://api.github.com/users/omariom/gists{/gist_id}","starred_url":"https://api.github.com/users/omariom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omariom/subscriptions","organizations_url":"https://api.github.com/users/omariom/orgs","repos_url":"https://api.github.com/users/omariom/repos","events_url":"https://api.github.com/users/omariom/events{/privacy}","received_events_url":"https://api.github.com/users/omariom/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/coreclr/labels/CodeGen","name":"CodeGen","color":"d4c5f9"},{"url":"https://api.github.com/repos/dotnet/coreclr/labels/optimization","name":"optimization","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-07-10T07:28:17Z","updated_at":"2015-08-20T13:32:51Z","closed_at":null,"body":"There is a small difference between code generated for  direct reading of a volatile variable and doing it via Volatile.Read. \r\n\r\n\r\n```C#\r\nvolatile int sharedVar;\r\n\r\npublic int Test()\r\n{\r\n    return sharedVar;\r\n}\r\n\r\npublic int Test2()\r\n{\r\n    return Volatile.Read(ref sharedVar);\r\n}\r\n```\r\n\r\n```ASM\r\n       mov      eax, dword ptr [rcx+8]\r\n       ret  \r\n\r\n;vs\r\n\r\n       cmp      dword ptr [rcx], ecx\r\n       lea      rax, bword ptr [rcx+8]\r\n       mov      eax, dword ptr [rax]\r\n       ret  \r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/dotnet/coreclr/issues/comments/133008965","html_url":"https://github.com/dotnet/coreclr/issues/1226#issuecomment-133008965","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/1226","id":133008965,"user":{"login":"GSPP","id":12032350,"avatar_url":"https://avatars.githubusercontent.com/u/12032350?v=3","gravatar_id":"","url":"https://api.github.com/users/GSPP","html_url":"https://github.com/GSPP","followers_url":"https://api.github.com/users/GSPP/followers","following_url":"https://api.github.com/users/GSPP/following{/other_user}","gists_url":"https://api.github.com/users/GSPP/gists{/gist_id}","starred_url":"https://api.github.com/users/GSPP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GSPP/subscriptions","organizations_url":"https://api.github.com/users/GSPP/orgs","repos_url":"https://api.github.com/users/GSPP/repos","events_url":"https://api.github.com/users/GSPP/events{/privacy}","received_events_url":"https://api.github.com/users/GSPP/received_events","type":"User","site_admin":false},"created_at":"2015-08-20T13:32:51Z","updated_at":"2015-08-20T13:32:51Z","body":"@mikedn I see what you mean. I read the answer the other way around."}}