{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/105539336","pull_request_review_id":26428509,"id":105539336,"diff_hunk":"@@ -91,14 +91,13 @@ class GCHeap : public IGCHeapInternal\n     HRESULT Initialize ();\n \n     //flags can be GC_ALLOC_CONTAINS_REF GC_ALLOC_FINALIZE\n-    Object*  Alloc (size_t size, uint32_t flags);\n-    Object*  AllocAlign8 (size_t size, uint32_t flags);\n     Object*  AllocAlign8 (gc_alloc_context* acontext, size_t size, uint32_t flags);\n private:\n     Object*  AllocAlign8Common (void* hp, alloc_context* acontext, size_t size, uint32_t flags);\n public:\n     Object*  AllocLHeap (size_t size, uint32_t flags);\n     Object* Alloc (gc_alloc_context* acontext, size_t size, uint32_t flags);\n+    bool UseThreadAllocationContexts();","path":"src/gc/gcimpl.h","position":12,"original_position":12,"commit_id":"868f2b016761ec5a452bc7a8ed325165f6c41f14","original_commit_id":"868f2b016761ec5a452bc7a8ed325165f6c41f14","user":{"login":"swgillespie","id":1871912,"avatar_url":"https://avatars1.githubusercontent.com/u/1871912?v=3","gravatar_id":"","url":"https://api.github.com/users/swgillespie","html_url":"https://github.com/swgillespie","followers_url":"https://api.github.com/users/swgillespie/followers","following_url":"https://api.github.com/users/swgillespie/following{/other_user}","gists_url":"https://api.github.com/users/swgillespie/gists{/gist_id}","starred_url":"https://api.github.com/users/swgillespie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swgillespie/subscriptions","organizations_url":"https://api.github.com/users/swgillespie/orgs","repos_url":"https://api.github.com/users/swgillespie/repos","events_url":"https://api.github.com/users/swgillespie/events{/privacy}","received_events_url":"https://api.github.com/users/swgillespie/received_events","type":"User","site_admin":false},"body":"will delete.","created_at":"2017-03-11T18:33:13Z","updated_at":"2017-03-11T18:33:13Z","html_url":"https://github.com/dotnet/coreclr/pull/10065#discussion_r105539336","pull_request_url":"https://api.github.com/repos/dotnet/coreclr/pulls/10065","_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/105539336"},"html":{"href":"https://github.com/dotnet/coreclr/pull/10065#discussion_r105539336"},"pull_request":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/10065"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/10065","id":109979216,"html_url":"https://github.com/dotnet/coreclr/pull/10065","diff_url":"https://github.com/dotnet/coreclr/pull/10065.diff","patch_url":"https://github.com/dotnet/coreclr/pull/10065.patch","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/10065","number":10065,"state":"open","locked":false,"title":"[Local GC] Break EE dependency on GC's generation table and alloc lock in single-proc scenarios","user":{"login":"swgillespie","id":1871912,"avatar_url":"https://avatars1.githubusercontent.com/u/1871912?v=3","gravatar_id":"","url":"https://api.github.com/users/swgillespie","html_url":"https://github.com/swgillespie","followers_url":"https://api.github.com/users/swgillespie/followers","following_url":"https://api.github.com/users/swgillespie/following{/other_user}","gists_url":"https://api.github.com/users/swgillespie/gists{/gist_id}","starred_url":"https://api.github.com/users/swgillespie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swgillespie/subscriptions","organizations_url":"https://api.github.com/users/swgillespie/orgs","repos_url":"https://api.github.com/users/swgillespie/repos","events_url":"https://api.github.com/users/swgillespie/events{/privacy}","received_events_url":"https://api.github.com/users/swgillespie/received_events","type":"User","site_admin":false},"body":"This PR is a follow-up to #9836, with the feedback given in the last PR (hopefully) fully addressed.\r\n\r\nThe problem: when running on a single-proc x86/x64 Windows machine, a number of assembly allocation helpers directly reference the GC's generation table and alloc lock (`m_GCLock`). The generation table is used because the structure at offset 0 from the start of the generation table is the Gen 0 alloc context. When allocating, the EE acquires the alloc lock and uses the Gen 0 alloc context to allocate a new object in the normal way. If an object can't be allocated in this way (either because the assembly helper failed to acquire the alloc lock or the alloc context's allocation pointer exceeds the alloc limit), the assembly helper takes a slow path that eventually calls into the GC.\r\n\r\nThis PR modifies this process slightly by moving both of these concepts (a \"global\" alloc context for all SOH allocations and the alloc lock) to the EE side of the GC/EE interface. Some new functions were added to both `IGCHeap` and `IGCToCLR` to accommodate this:\r\n * `IGCToCLR::GetGlobalAllocContext` - this new function is called by the GC whenever it needs a pointer to the global alloc context - when fixing allocation contexts.\r\n* `IGCHeap::UseThreadAllocationContexts` - this function is called by the EE whenever it needs to know whether or not the GC intends to use per-thread allocation contexts. Today, per-thread allocation contexts are used on all platforms other than single-proc x86/x64 Windows.\r\n\r\nA new class, `GlobalAllocLock`, was also added to facilitate the acquiring and release of the global alloc lock, which guards the global alloc context against concurrent modification and is now also owned by the EE. This lock is acquired by the assembly allocation helpers as well ass `Alloc` and `AllocAlign8` in `gchelpers.cpp`, the slow path for allocations.\r\n\r\nThis PR also removes two methods from `IGCHeap`, because they are no longer needed: `IGCHeap::Alloc(size_t, size_t)` and `IGCHeap::AllocAlilgn8(size_t, size_t`. Previously, they were used to allocate using the GC's gen 0 alloc context, but they are not necessary anymore since the EE can acquire it's alloc lock and pass a pointer to its global alloc context to the versions of `Alloc` and `AllocAlign8` that accept allocation contexts to achieve the same thing.\r\n\r\nI did not remove `m_GCLock` from the GC, because it is still acquired by `GCHeap::StartNoGCRegion` and `GCHeap::EndNoGCRegion`. If this lock is intended to prevent all allocations while these methods are being called, I can ensure that the VM acquires the lock before calling into these functions - if not, and it is intended to synchronize between the two methods, it should work as it is. (Though, perhaps the lock should be renamed if it's only protecting these two methods). I'm not sure about which one of these is true, so I welcome feedback! ","created_at":"2017-03-09T18:43:28Z","updated_at":"2017-03-11T18:33:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"93a760921ffbfd170ffcae5063d91e71e7a40d9e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/coreclr/pulls/10065/commits","review_comments_url":"https://api.github.com/repos/dotnet/coreclr/pulls/10065/comments","review_comment_url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/10065/comments","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/868f2b016761ec5a452bc7a8ed325165f6c41f14","head":{"label":"swgillespie:gc-generation-table-staging","ref":"gc-generation-table-staging","sha":"868f2b016761ec5a452bc7a8ed325165f6c41f14","user":{"login":"swgillespie","id":1871912,"avatar_url":"https://avatars1.githubusercontent.com/u/1871912?v=3","gravatar_id":"","url":"https://api.github.com/users/swgillespie","html_url":"https://github.com/swgillespie","followers_url":"https://api.github.com/users/swgillespie/followers","following_url":"https://api.github.com/users/swgillespie/following{/other_user}","gists_url":"https://api.github.com/users/swgillespie/gists{/gist_id}","starred_url":"https://api.github.com/users/swgillespie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swgillespie/subscriptions","organizations_url":"https://api.github.com/users/swgillespie/orgs","repos_url":"https://api.github.com/users/swgillespie/repos","events_url":"https://api.github.com/users/swgillespie/events{/privacy}","received_events_url":"https://api.github.com/users/swgillespie/received_events","type":"User","site_admin":false},"repo":{"id":47656398,"name":"coreclr","full_name":"swgillespie/coreclr","owner":{"login":"swgillespie","id":1871912,"avatar_url":"https://avatars1.githubusercontent.com/u/1871912?v=3","gravatar_id":"","url":"https://api.github.com/users/swgillespie","html_url":"https://github.com/swgillespie","followers_url":"https://api.github.com/users/swgillespie/followers","following_url":"https://api.github.com/users/swgillespie/following{/other_user}","gists_url":"https://api.github.com/users/swgillespie/gists{/gist_id}","starred_url":"https://api.github.com/users/swgillespie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swgillespie/subscriptions","organizations_url":"https://api.github.com/users/swgillespie/orgs","repos_url":"https://api.github.com/users/swgillespie/repos","events_url":"https://api.github.com/users/swgillespie/events{/privacy}","received_events_url":"https://api.github.com/users/swgillespie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/swgillespie/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/swgillespie/coreclr","forks_url":"https://api.github.com/repos/swgillespie/coreclr/forks","keys_url":"https://api.github.com/repos/swgillespie/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/swgillespie/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/swgillespie/coreclr/teams","hooks_url":"https://api.github.com/repos/swgillespie/coreclr/hooks","issue_events_url":"https://api.github.com/repos/swgillespie/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/swgillespie/coreclr/events","assignees_url":"https://api.github.com/repos/swgillespie/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/swgillespie/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/swgillespie/coreclr/tags","blobs_url":"https://api.github.com/repos/swgillespie/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/swgillespie/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/swgillespie/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/swgillespie/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/swgillespie/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/swgillespie/coreclr/languages","stargazers_url":"https://api.github.com/repos/swgillespie/coreclr/stargazers","contributors_url":"https://api.github.com/repos/swgillespie/coreclr/contributors","subscribers_url":"https://api.github.com/repos/swgillespie/coreclr/subscribers","subscription_url":"https://api.github.com/repos/swgillespie/coreclr/subscription","commits_url":"https://api.github.com/repos/swgillespie/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/swgillespie/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/swgillespie/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/swgillespie/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/swgillespie/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/swgillespie/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/swgillespie/coreclr/merges","archive_url":"https://api.github.com/repos/swgillespie/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/swgillespie/coreclr/downloads","issues_url":"https://api.github.com/repos/swgillespie/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/swgillespie/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/swgillespie/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/swgillespie/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/swgillespie/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/swgillespie/coreclr/releases{/id}","deployments_url":"https://api.github.com/repos/swgillespie/coreclr/deployments","created_at":"2015-12-08T23:40:42Z","updated_at":"2016-01-13T23:23:53Z","pushed_at":"2017-03-11T00:22:23Z","git_url":"git://github.com/swgillespie/coreclr.git","ssh_url":"git@github.com:swgillespie/coreclr.git","clone_url":"https://github.com/swgillespie/coreclr.git","svn_url":"https://github.com/swgillespie/coreclr","homepage":"http://dotnet.github.io/","size":141010,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"a7bed220d5455a705452eb0cc7248b941a6ecd99","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars3.githubusercontent.com/u/9141961?v=3","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,"name":"coreclr","full_name":"dotnet/coreclr","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars3.githubusercontent.com/u/9141961?v=3","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},"private":false,"html_url":"https://github.com/dotnet/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":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":"2017-03-11T05:44:50Z","pushed_at":"2017-03-11T17:54:49Z","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://docs.microsoft.com/dotnet/","size":141301,"stargazers_count":7484,"watchers_count":7484,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1861,"mirror_url":null,"open_issues_count":1171,"forks":1861,"open_issues":1171,"watchers":7484,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/10065"},"html":{"href":"https://github.com/dotnet/coreclr/pull/10065"},"issue":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/10065"},"comments":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/10065/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/10065/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/10065/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/coreclr/statuses/868f2b016761ec5a452bc7a8ed325165f6c41f14"}}}}
{"actor":{"display_login":"swgillespie"}}