{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/232461664","pull_request_review_id":173670906,"id":232461664,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMjQ2MTY2NA==","diff_hunk":"@@ -337,6 +337,15 @@ FCIMPL7(void, RuntimeFieldHandle::SetValue, ReflectFieldObject *pFieldUNSAFE, Ob\n \n     FieldDesc* pFieldDesc = gc.refField->GetField();\n \n+    // Verify we're not trying to set the value of a static initonly field\n+    // once the class has been initialized.\n+    if (pFieldDesc->IsStatic())\n+    {\n+        MethodTable* pEnclosingMT = pFieldDesc->GetEnclosingMethodTable();\n+        if (pEnclosingMT->IsClassInited() && IsFdInitOnly(pFieldDesc->GetAttributes()))\n+            FCThrowVoid(kFieldAccessException);","path":"src/vm/reflectioninvocation.cpp","position":10,"original_position":10,"commit_id":"ef59ca11a8f568cbcc400b6bba160d31eb80f142","original_commit_id":"ef59ca11a8f568cbcc400b6bba160d31eb80f142","user":{"login":"jkotas","id":6668460,"node_id":"MDQ6VXNlcjY2Njg0NjA=","avatar_url":"https://avatars2.githubusercontent.com/u/6668460?v=4","gravatar_id":"","url":"https://api.github.com/users/jkotas","html_url":"https://github.com/jkotas","followers_url":"https://api.github.com/users/jkotas/followers","following_url":"https://api.github.com/users/jkotas/following{/other_user}","gists_url":"https://api.github.com/users/jkotas/gists{/gist_id}","starred_url":"https://api.github.com/users/jkotas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkotas/subscriptions","organizations_url":"https://api.github.com/users/jkotas/orgs","repos_url":"https://api.github.com/users/jkotas/repos","events_url":"https://api.github.com/users/jkotas/events{/privacy}","received_events_url":"https://api.github.com/users/jkotas/received_events","type":"User","site_admin":false},"body":"This needs good error message","created_at":"2018-11-10T18:34:49Z","updated_at":"2018-11-10T18:34:50Z","html_url":"https://github.com/dotnet/coreclr/pull/20886#discussion_r232461664","pull_request_url":"https://api.github.com/repos/dotnet/coreclr/pulls/20886","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/232461664"},"html":{"href":"https://github.com/dotnet/coreclr/pull/20886#discussion_r232461664"},"pull_request":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/20886"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/20886","id":229486534,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI5NDg2NTM0","html_url":"https://github.com/dotnet/coreclr/pull/20886","diff_url":"https://github.com/dotnet/coreclr/pull/20886.diff","patch_url":"https://github.com/dotnet/coreclr/pull/20886.patch","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/20886","number":20886,"state":"open","locked":false,"title":"Allow jit to examine type of initonly static ref typed fields","user":{"login":"AndyAyersMS","id":10121823,"node_id":"MDQ6VXNlcjEwMTIxODIz","avatar_url":"https://avatars1.githubusercontent.com/u/10121823?v=4","gravatar_id":"","url":"https://api.github.com/users/AndyAyersMS","html_url":"https://github.com/AndyAyersMS","followers_url":"https://api.github.com/users/AndyAyersMS/followers","following_url":"https://api.github.com/users/AndyAyersMS/following{/other_user}","gists_url":"https://api.github.com/users/AndyAyersMS/gists{/gist_id}","starred_url":"https://api.github.com/users/AndyAyersMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndyAyersMS/subscriptions","organizations_url":"https://api.github.com/users/AndyAyersMS/orgs","repos_url":"https://api.github.com/users/AndyAyersMS/repos","events_url":"https://api.github.com/users/AndyAyersMS/events{/privacy}","received_events_url":"https://api.github.com/users/AndyAyersMS/received_events","type":"User","site_admin":false},"body":"The jit incorporates the value of integer and float typed initonly static\r\nfields into its codegen, if the class initializer has already run.\r\n\r\nThe jit can't incorporate the values of ref typed initonly static fields,\r\nbut the types of those values can't change, and the jit can use this knowledge\r\nto enable type based optimizations like devirtualization.\r\n\r\nIn particular for static fields initialized by complex class factory logic the\r\njit can now see the end result of that logic instead of having to try and deduce\r\nthe type of object that will initialize or did initialize the field.\r\n\r\nExamples of this factory pattern in include `EqualityComparer<T>.Default` and\r\n`Comparer<T>.Default`. The former is already optimized in some cases by via\r\nspecial-purpose modelling in the framework, jit, and runtime (see #14125) but\r\nthe latter is not. With this change calls through `Comparer<T>.Default` may now\r\nalso devirtualize (though won't yet inline as the devirtualization happens\r\nlate).\r\n\r\nAddresses #4108.","created_at":"2018-11-08T19:45:27Z","updated_at":"2018-11-10T18:34:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"62ddaba185c042aad0e16cbb2eb2b38cafa10938","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/coreclr/pulls/20886/commits","review_comments_url":"https://api.github.com/repos/dotnet/coreclr/pulls/20886/comments","review_comment_url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/20886/comments","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/ef59ca11a8f568cbcc400b6bba160d31eb80f142","head":{"label":"AndyAyersMS:GetExactTypeForRefClassReadonlyStatics","ref":"GetExactTypeForRefClassReadonlyStatics","sha":"ef59ca11a8f568cbcc400b6bba160d31eb80f142","user":{"login":"AndyAyersMS","id":10121823,"node_id":"MDQ6VXNlcjEwMTIxODIz","avatar_url":"https://avatars1.githubusercontent.com/u/10121823?v=4","gravatar_id":"","url":"https://api.github.com/users/AndyAyersMS","html_url":"https://github.com/AndyAyersMS","followers_url":"https://api.github.com/users/AndyAyersMS/followers","following_url":"https://api.github.com/users/AndyAyersMS/following{/other_user}","gists_url":"https://api.github.com/users/AndyAyersMS/gists{/gist_id}","starred_url":"https://api.github.com/users/AndyAyersMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndyAyersMS/subscriptions","organizations_url":"https://api.github.com/users/AndyAyersMS/orgs","repos_url":"https://api.github.com/users/AndyAyersMS/repos","events_url":"https://api.github.com/users/AndyAyersMS/events{/privacy}","received_events_url":"https://api.github.com/users/AndyAyersMS/received_events","type":"User","site_admin":false},"repo":{"id":34692475,"node_id":"MDEwOlJlcG9zaXRvcnkzNDY5MjQ3NQ==","name":"coreclr","full_name":"AndyAyersMS/coreclr","private":false,"owner":{"login":"AndyAyersMS","id":10121823,"node_id":"MDQ6VXNlcjEwMTIxODIz","avatar_url":"https://avatars1.githubusercontent.com/u/10121823?v=4","gravatar_id":"","url":"https://api.github.com/users/AndyAyersMS","html_url":"https://github.com/AndyAyersMS","followers_url":"https://api.github.com/users/AndyAyersMS/followers","following_url":"https://api.github.com/users/AndyAyersMS/following{/other_user}","gists_url":"https://api.github.com/users/AndyAyersMS/gists{/gist_id}","starred_url":"https://api.github.com/users/AndyAyersMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndyAyersMS/subscriptions","organizations_url":"https://api.github.com/users/AndyAyersMS/orgs","repos_url":"https://api.github.com/users/AndyAyersMS/repos","events_url":"https://api.github.com/users/AndyAyersMS/events{/privacy}","received_events_url":"https://api.github.com/users/AndyAyersMS/received_events","type":"User","site_admin":false},"html_url":"https://github.com/AndyAyersMS/coreclr","description":"This repo contains the .NET Core runtime, called CoreCLR, and the base library, called mscorlib. It includes the garbage collector, JIT compiler, base .NET data types and many low-level classes.","fork":true,"url":"https://api.github.com/repos/AndyAyersMS/coreclr","forks_url":"https://api.github.com/repos/AndyAyersMS/coreclr/forks","keys_url":"https://api.github.com/repos/AndyAyersMS/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AndyAyersMS/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AndyAyersMS/coreclr/teams","hooks_url":"https://api.github.com/repos/AndyAyersMS/coreclr/hooks","issue_events_url":"https://api.github.com/repos/AndyAyersMS/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/AndyAyersMS/coreclr/events","assignees_url":"https://api.github.com/repos/AndyAyersMS/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/AndyAyersMS/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/AndyAyersMS/coreclr/tags","blobs_url":"https://api.github.com/repos/AndyAyersMS/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AndyAyersMS/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AndyAyersMS/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/AndyAyersMS/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AndyAyersMS/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/AndyAyersMS/coreclr/languages","stargazers_url":"https://api.github.com/repos/AndyAyersMS/coreclr/stargazers","contributors_url":"https://api.github.com/repos/AndyAyersMS/coreclr/contributors","subscribers_url":"https://api.github.com/repos/AndyAyersMS/coreclr/subscribers","subscription_url":"https://api.github.com/repos/AndyAyersMS/coreclr/subscription","commits_url":"https://api.github.com/repos/AndyAyersMS/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/AndyAyersMS/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/AndyAyersMS/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/AndyAyersMS/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/AndyAyersMS/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/AndyAyersMS/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AndyAyersMS/coreclr/merges","archive_url":"https://api.github.com/repos/AndyAyersMS/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AndyAyersMS/coreclr/downloads","issues_url":"https://api.github.com/repos/AndyAyersMS/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/AndyAyersMS/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/AndyAyersMS/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/AndyAyersMS/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AndyAyersMS/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/AndyAyersMS/coreclr/releases{/id}","deployments_url":"https://api.github.com/repos/AndyAyersMS/coreclr/deployments","created_at":"2015-04-27T21:34:06Z","updated_at":"2018-11-08T23:04:26Z","pushed_at":"2018-11-10T15:34:15Z","git_url":"git://github.com/AndyAyersMS/coreclr.git","ssh_url":"git@github.com:AndyAyersMS/coreclr.git","clone_url":"https://github.com/AndyAyersMS/coreclr.git","svn_url":"https://github.com/AndyAyersMS/coreclr","homepage":"","size":251562,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"624767281d5dfa75c82a72d56c348cc53db844b4","user":{"login":"dotnet","id":9141961,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkxNDE5NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":30092893,"node_id":"MDEwOlJlcG9zaXRvcnkzMDA5Mjg5Mw==","name":"coreclr","full_name":"dotnet/coreclr","private":false,"owner":{"login":"dotnet","id":9141961,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkxNDE5NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/dotnet/coreclr","description":"This repo contains the .NET Core runtime, called CoreCLR, and the base library, called System.Private.Corelib (or mscorlib). It includes the garbage collector, JIT compiler, base .NET data types and many low-level classes. We welcome contributions.","fork":false,"url":"https://api.github.com/repos/dotnet/coreclr","forks_url":"https://api.github.com/repos/dotnet/coreclr/forks","keys_url":"https://api.github.com/repos/dotnet/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/coreclr/teams","hooks_url":"https://api.github.com/repos/dotnet/coreclr/hooks","issue_events_url":"https://api.github.com/repos/dotnet/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/coreclr/events","assignees_url":"https://api.github.com/repos/dotnet/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/coreclr/tags","blobs_url":"https://api.github.com/repos/dotnet/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/coreclr/languages","stargazers_url":"https://api.github.com/repos/dotnet/coreclr/stargazers","contributors_url":"https://api.github.com/repos/dotnet/coreclr/contributors","subscribers_url":"https://api.github.com/repos/dotnet/coreclr/subscribers","subscription_url":"https://api.github.com/repos/dotnet/coreclr/subscription","commits_url":"https://api.github.com/repos/dotnet/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/coreclr/merges","archive_url":"https://api.github.com/repos/dotnet/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/coreclr/downloads","issues_url":"https://api.github.com/repos/dotnet/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/coreclr/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/coreclr/deployments","created_at":"2015-01-30T22:10:02Z","updated_at":"2018-11-10T15:19:56Z","pushed_at":"2018-11-10T18:15:50Z","git_url":"git://github.com/dotnet/coreclr.git","ssh_url":"git@github.com:dotnet/coreclr.git","clone_url":"https://github.com/dotnet/coreclr.git","svn_url":"https://github.com/dotnet/coreclr","homepage":"https://github.com/dotnet/core","size":253012,"stargazers_count":10493,"watchers_count":10493,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2502,"mirror_url":null,"archived":false,"open_issues_count":2016,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":2502,"open_issues":2016,"watchers":10493,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/20886"},"html":{"href":"https://github.com/dotnet/coreclr/pull/20886"},"issue":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/20886"},"comments":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/20886/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/20886/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/20886/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/coreclr/statuses/ef59ca11a8f568cbcc400b6bba160d31eb80f142"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"jkotas"}}