{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/53980949","id":53980949,"diff_hunk":"@@ -474,3 +642,179 @@ void InlineResult::report()\n         comp->reportInliningDecision(inlCaller, inlCallee, result(), reasonString());\n     }\n }\n+\n+//------------------------------------------------------------------------\n+// getPolicy: Factory method for getting an InlinePolicy\n+//\n+// Arguments:\n+//    compiler - the compiler instance that will evaluate inlines\n+//\n+// Return Value:\n+//    InlinePolicy to use in evaluationg the inlines\n+//\n+// Notes:\n+//    Determines which of the various policies should apply,\n+//    and creates (or reuses) a policy instance to use.\n+\n+InlinePolicy* InlinePolicy::getPolicy(Compiler* compiler)\n+{\n+    // For now, always create a Legacy policy.\n+    InlinePolicy* policy = new (compiler, CMK_Inlining) LegacyPolicy;\n+\n+    return policy;\n+}\n+\n+//------------------------------------------------------------------------\n+// noteCandidate: handle passing a set of inlining checks successfully\n+//\n+// Arguments:\n+//    obs      - the current obsevation\n+\n+void LegacyPolicy::noteCandidate(InlineObservation obs)\n+{\n+    assert(!inlDecisionIsDecided(inlDecision));\n+\n+    // Check the impact, it should be INFORMATION\n+    InlineImpact impact = inlGetImpact(obs);\n+    assert(impact == InlineImpact::INFORMATION);\n+\n+    // Update the status\n+    setCommon(InlineDecision::CANDIDATE, obs);\n+}\n+\n+//------------------------------------------------------------------------\n+// noteSuccess: handle finishing all the inlining checks successfully\n+\n+void LegacyPolicy::noteSuccess()\n+{\n+    assert(inlDecisionIsCandidate(inlDecision));\n+    inlDecision = InlineDecision::SUCCESS;\n+}\n+\n+//------------------------------------------------------------------------\n+// note: handle an observation with non-fatal impact\n+//\n+// Arguments:\n+//    obs      - the current obsevation\n+\n+void LegacyPolicy::note(InlineObservation obs)\n+{\n+    // Check the impact\n+    InlineImpact impact = inlGetImpact(obs);\n+\n+    // As a safeguard, all fatal impact must be\n+    // reported via noteFatal.\n+    assert(impact != InlineImpact::FATAL);\n+    noteInternal(obs, impact);\n+}\n+\n+//------------------------------------------------------------------------\n+// noteFatal: handle an observation with fatal impact\n+//\n+// Arguments:\n+//    obs      - the current obsevation\n+\n+void LegacyPolicy::noteFatal(InlineObservation obs)\n+{\n+    // Check the impact\n+    InlineImpact impact = inlGetImpact(obs);\n+\n+    // As a safeguard, all fatal impact must be\n+    // reported via noteFatal.\n+    assert(impact == InlineImpact::FATAL);\n+    noteInternal(obs, impact);\n+    assert(inlDecisionIsFailure(inlDecision));\n+}\n+\n+//------------------------------------------------------------------------\n+// noteInt: handle an observed integer value\n+//\n+// Arguments:\n+//    obs      - the current obsevation\n+//    value    - the value being observed\n+\n+void LegacyPolicy::noteInt(InlineObservation obs, int value)\n+{\n+    (void) value;\n+    note(obs);\n+}\n+\n+//------------------------------------------------------------------------\n+// noteDouble: handle an observed double value\n+//\n+// Arguments:\n+//    obs      - the current obsevation\n+//    value    - the value being observed\n+\n+void LegacyPolicy::noteDouble(InlineObservation obs, double value)\n+{\n+    (void) value;\n+    note(obs);\n+}\n+\n+//------------------------------------------------------------------------\n+// setNever: helper for handling an observation\n+//\n+// Arguments:\n+//    obs      - the current obsevation\n+//    impact   - impact of the current observation\n+\n+void LegacyPolicy::noteInternal(InlineObservation obs, InlineImpact impact)","path":"src/jit/inline.cpp","position":377,"original_position":377,"commit_id":"d5d25db5934520997ef085bd5f973451fd15a947","original_commit_id":"d5d25db5934520997ef085bd5f973451fd15a947","user":{"login":"AndyAyersMS","id":10121823,"avatar_url":"https://avatars.githubusercontent.com/u/10121823?v=3","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":"`noteInternal` is private, the key public callers `note` and `noteFatal` already screen for appropriate impacts. I think this is sufficient for the time being -- legacy policy only really cares about `FATAL` for the most part.","created_at":"2016-02-24T18:14:50Z","updated_at":"2016-02-24T18:14:50Z","html_url":"https://github.com/dotnet/coreclr/pull/3315#discussion_r53980949","pull_request_url":"https://api.github.com/repos/dotnet/coreclr/pulls/3315","_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/53980949"},"html":{"href":"https://github.com/dotnet/coreclr/pull/3315#discussion_r53980949"},"pull_request":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/3315"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/3315","id":60370148,"html_url":"https://github.com/dotnet/coreclr/pull/3315","diff_url":"https://github.com/dotnet/coreclr/pull/3315.diff","patch_url":"https://github.com/dotnet/coreclr/pull/3315.patch","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/3315","number":3315,"state":"open","locked":false,"title":"InlineRefactoring: introducing InlinePolicy","user":{"login":"AndyAyersMS","id":10121823,"avatar_url":"https://avatars.githubusercontent.com/u/10121823?v=3","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":"Split the policy aspect of the InlineResult into a separate\r\npolicy object, acessed from the InlineResult via a base class.\r\n\r\nImplement a LegacyPolicy to capture today's behavior.\r\n\r\nCreate a factory method for determining what policy to use. Right\r\nnow it always creates a LegacyPolicy. This is newed up for each\r\nInline decision, but since the InlineResult has relatively short\r\nlifetime, we should probably recycle policy objects (might be\r\nmore desirable once they start having a bit more state).\r\n\r\nSplit out a bunch of the InlineDecision helper methods that lived\r\non InlineResult into global methods since policies will want to refer\r\nto them too. Shame that enum classes don't allow member functions.","created_at":"2016-02-23T16:45:03Z","updated_at":"2016-02-24T18:14:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"51bd0678ea003565200736a17d3172ed74e1c744","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/coreclr/pulls/3315/commits","review_comments_url":"https://api.github.com/repos/dotnet/coreclr/pulls/3315/comments","review_comment_url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/3315/comments","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/d5d25db5934520997ef085bd5f973451fd15a947","head":{"label":"AndyAyersMS:InlineRefactor5","ref":"InlineRefactor5","sha":"d5d25db5934520997ef085bd5f973451fd15a947","user":{"login":"AndyAyersMS","id":10121823,"avatar_url":"https://avatars.githubusercontent.com/u/10121823?v=3","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,"name":"coreclr","full_name":"AndyAyersMS/coreclr","owner":{"login":"AndyAyersMS","id":10121823,"avatar_url":"https://avatars.githubusercontent.com/u/10121823?v=3","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},"private":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":"2016-02-11T00:27:03Z","pushed_at":"2016-02-23T16:42:34Z","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":60064,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"e9fa953a295d16b7e00e9192b4973743398358e9","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.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://avatars.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":"2016-02-24T06:51:07Z","pushed_at":"2016-02-24T17:37:40Z","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":"http://dotnet.github.io/","size":65274,"stargazers_count":5919,"watchers_count":5919,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1307,"mirror_url":null,"open_issues_count":566,"forks":1307,"open_issues":566,"watchers":5919,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/3315"},"html":{"href":"https://github.com/dotnet/coreclr/pull/3315"},"issue":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/3315"},"comments":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/3315/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/3315/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/3315/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/coreclr/statuses/d5d25db5934520997ef085bd5f973451fd15a947"}}}}