{"action":"opened","number":7492,"pull_request":{"url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/7492","id":222659627,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIyNjU5NjI3","html_url":"https://github.com/dolphin-emu/dolphin/pull/7492","diff_url":"https://github.com/dolphin-emu/dolphin/pull/7492.diff","patch_url":"https://github.com/dolphin-emu/dolphin/pull/7492.patch","issue_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/7492","number":7492,"state":"open","locked":false,"title":"[RFC/WIP] JitRegCache: Refactor register cache","user":{"login":"MerryMage","id":8682882,"node_id":"MDQ6VXNlcjg2ODI4ODI=","avatar_url":"https://avatars2.githubusercontent.com/u/8682882?v=4","gravatar_id":"","url":"https://api.github.com/users/MerryMage","html_url":"https://github.com/MerryMage","followers_url":"https://api.github.com/users/MerryMage/followers","following_url":"https://api.github.com/users/MerryMage/following{/other_user}","gists_url":"https://api.github.com/users/MerryMage/gists{/gist_id}","starred_url":"https://api.github.com/users/MerryMage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MerryMage/subscriptions","organizations_url":"https://api.github.com/users/MerryMage/orgs","repos_url":"https://api.github.com/users/MerryMage/repos","events_url":"https://api.github.com/users/MerryMage/events{/privacy}","received_events_url":"https://api.github.com/users/MerryMage/received_events","type":"User","site_admin":false},"body":"Similar idea to #3565, different implementation.\r\n\r\n* Automatic unlocking using RAII.\r\n* Forking of regcache state with `Fork`.\r\n* \"Revertable bindings\" / \"Transactions\": A bind can be declared with `RevertableBind`, and a future `Revert`/`Commit` would rollback or complete the transaction.\r\n* Unlike the previous proposal, **no laziness**. Realization occurs with an explicit `Realize` call.\r\n* I have tried to make as direct a translation as possible here for ease of verifying correctness and will leave futher cleanup to future PRs.\r\n* I have done the port in so that this PR should be bisectable for debugging if necessary; each intermediate commit *should* compile and work properly.\r\n* Please note that this is incomplete.\r\n\r\nThis refactor allows for easier development of future optimizations.\r\n\r\nTODO:\r\n\r\n- [ ] Complete transition.\r\n- [ ] Remove old regcache interface.\r\n- [ ] Allow `Scratch` to allocate arbitrary scratch registers.\r\n- [ ] Make `GetFreeXReg`, `IsFreeX`, `NumFreeRegisters` private.\r\n- [ ] Remove `Lock`, `LockX`, `UnlockX`, `UnlockAll`, `UnlockAllX`, `R`, `RX`, `KillImmediate`, `BindToRegister`, `StoreFromRegister`, `FlushLockX`, `DiscardRegContentsIfCached` from interface.\r\n- [ ] Remove `mode` argument from `Flush`; all flushes should be full flushes. Use `Fork` instead if maintaining state is required.\r\n\r\n---\r\n\r\nWe introduce two new concepts, `RCX64Reg` and `RCOpArg`, which are analogues of `X64Reg` and `OpArg`.\r\n\r\nAs an example, here is what an addition of register a and register b to be stored in register d would look like:\r\n\r\n```cpp\r\nRCX64Reg Rd = gpr.Bind(d, RCMode::Write);\r\nRCOpArg Ra = gpr.Use(a, RCMode::Read);\r\nRCOpArg Rb = gpr.Use(b, RCMode::Read);\r\nRegAlloc::Realize(Rd, Ra, Rb);\r\n\r\nMOV_sum(32, Rd, Ra, Rb);\r\n```\r\n\r\nEach declaration is a constraint, and when `Realize` is called these constraints are realized. Note that there is no need to check for `d == a || d == b` &c&c, this is automatically handled by constraints.\r\n\r\nThere are several constraint types:\r\n\r\n* `Use`: Can be memory, bound, or immediate\r\n* `UseNoImm`: Can be memory or bound. Intended to replace old uses of `KillImmediate`.\r\n* `BindOrImm`: Can be bound or immediate. I found this pattern in multiple places in the JIT and found this helpful.\r\n* `Bind`: Must be bound to a register. Intended to replace old uses of `BindToRegiser`.\r\n* `RevertableBind`: Mentioned above, replaces `js.revertGprLoad`/`js.revertFprLoad`.\r\n\r\nOne can use `RCOpArg` with immediates, which allows for cleaner code. `RCOpArg::Imm32` constructs such an immediate.","created_at":"2018-10-13T16:16:24Z","updated_at":"2018-10-13T16:16:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/7492/commits","review_comments_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/7492/comments","review_comment_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/7492/comments","statuses_url":"https://api.github.com/repos/dolphin-emu/dolphin/statuses/06aa7043d6ba0a444ed1c35eef51229b852eca5f","head":{"label":"MerryMage:regcache2","ref":"regcache2","sha":"06aa7043d6ba0a444ed1c35eef51229b852eca5f","user":{"login":"MerryMage","id":8682882,"node_id":"MDQ6VXNlcjg2ODI4ODI=","avatar_url":"https://avatars2.githubusercontent.com/u/8682882?v=4","gravatar_id":"","url":"https://api.github.com/users/MerryMage","html_url":"https://github.com/MerryMage","followers_url":"https://api.github.com/users/MerryMage/followers","following_url":"https://api.github.com/users/MerryMage/following{/other_user}","gists_url":"https://api.github.com/users/MerryMage/gists{/gist_id}","starred_url":"https://api.github.com/users/MerryMage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MerryMage/subscriptions","organizations_url":"https://api.github.com/users/MerryMage/orgs","repos_url":"https://api.github.com/users/MerryMage/repos","events_url":"https://api.github.com/users/MerryMage/events{/privacy}","received_events_url":"https://api.github.com/users/MerryMage/received_events","type":"User","site_admin":false},"repo":{"id":57233989,"node_id":"MDEwOlJlcG9zaXRvcnk1NzIzMzk4OQ==","name":"dolphin","full_name":"MerryMage/dolphin","private":false,"owner":{"login":"MerryMage","id":8682882,"node_id":"MDQ6VXNlcjg2ODI4ODI=","avatar_url":"https://avatars2.githubusercontent.com/u/8682882?v=4","gravatar_id":"","url":"https://api.github.com/users/MerryMage","html_url":"https://github.com/MerryMage","followers_url":"https://api.github.com/users/MerryMage/followers","following_url":"https://api.github.com/users/MerryMage/following{/other_user}","gists_url":"https://api.github.com/users/MerryMage/gists{/gist_id}","starred_url":"https://api.github.com/users/MerryMage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MerryMage/subscriptions","organizations_url":"https://api.github.com/users/MerryMage/orgs","repos_url":"https://api.github.com/users/MerryMage/repos","events_url":"https://api.github.com/users/MerryMage/events{/privacy}","received_events_url":"https://api.github.com/users/MerryMage/received_events","type":"User","site_admin":false},"html_url":"https://github.com/MerryMage/dolphin","description":"Dolphin is a GameCube / Wii emulator, allowing you to play games for these two platforms on PC with improvements.","fork":true,"url":"https://api.github.com/repos/MerryMage/dolphin","forks_url":"https://api.github.com/repos/MerryMage/dolphin/forks","keys_url":"https://api.github.com/repos/MerryMage/dolphin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MerryMage/dolphin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MerryMage/dolphin/teams","hooks_url":"https://api.github.com/repos/MerryMage/dolphin/hooks","issue_events_url":"https://api.github.com/repos/MerryMage/dolphin/issues/events{/number}","events_url":"https://api.github.com/repos/MerryMage/dolphin/events","assignees_url":"https://api.github.com/repos/MerryMage/dolphin/assignees{/user}","branches_url":"https://api.github.com/repos/MerryMage/dolphin/branches{/branch}","tags_url":"https://api.github.com/repos/MerryMage/dolphin/tags","blobs_url":"https://api.github.com/repos/MerryMage/dolphin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MerryMage/dolphin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MerryMage/dolphin/git/refs{/sha}","trees_url":"https://api.github.com/repos/MerryMage/dolphin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MerryMage/dolphin/statuses/{sha}","languages_url":"https://api.github.com/repos/MerryMage/dolphin/languages","stargazers_url":"https://api.github.com/repos/MerryMage/dolphin/stargazers","contributors_url":"https://api.github.com/repos/MerryMage/dolphin/contributors","subscribers_url":"https://api.github.com/repos/MerryMage/dolphin/subscribers","subscription_url":"https://api.github.com/repos/MerryMage/dolphin/subscription","commits_url":"https://api.github.com/repos/MerryMage/dolphin/commits{/sha}","git_commits_url":"https://api.github.com/repos/MerryMage/dolphin/git/commits{/sha}","comments_url":"https://api.github.com/repos/MerryMage/dolphin/comments{/number}","issue_comment_url":"https://api.github.com/repos/MerryMage/dolphin/issues/comments{/number}","contents_url":"https://api.github.com/repos/MerryMage/dolphin/contents/{+path}","compare_url":"https://api.github.com/repos/MerryMage/dolphin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MerryMage/dolphin/merges","archive_url":"https://api.github.com/repos/MerryMage/dolphin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MerryMage/dolphin/downloads","issues_url":"https://api.github.com/repos/MerryMage/dolphin/issues{/number}","pulls_url":"https://api.github.com/repos/MerryMage/dolphin/pulls{/number}","milestones_url":"https://api.github.com/repos/MerryMage/dolphin/milestones{/number}","notifications_url":"https://api.github.com/repos/MerryMage/dolphin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MerryMage/dolphin/labels{/name}","releases_url":"https://api.github.com/repos/MerryMage/dolphin/releases{/id}","deployments_url":"https://api.github.com/repos/MerryMage/dolphin/deployments","created_at":"2016-04-27T17:48:36Z","updated_at":"2018-10-13T13:22:03Z","pushed_at":"2018-10-13T15:59:38Z","git_url":"git://github.com/MerryMage/dolphin.git","ssh_url":"git@github.com:MerryMage/dolphin.git","clone_url":"https://github.com/MerryMage/dolphin.git","svn_url":"https://github.com/MerryMage/dolphin","homepage":"https://dolphin-emu.org/","size":331569,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"dolphin-emu:master","ref":"master","sha":"1fe40c59fa7dbd5ecf2bedfdb941e72f0315a382","user":{"login":"dolphin-emu","id":5050316,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUwNTAzMTY=","avatar_url":"https://avatars2.githubusercontent.com/u/5050316?v=4","gravatar_id":"","url":"https://api.github.com/users/dolphin-emu","html_url":"https://github.com/dolphin-emu","followers_url":"https://api.github.com/users/dolphin-emu/followers","following_url":"https://api.github.com/users/dolphin-emu/following{/other_user}","gists_url":"https://api.github.com/users/dolphin-emu/gists{/gist_id}","starred_url":"https://api.github.com/users/dolphin-emu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dolphin-emu/subscriptions","organizations_url":"https://api.github.com/users/dolphin-emu/orgs","repos_url":"https://api.github.com/users/dolphin-emu/repos","events_url":"https://api.github.com/users/dolphin-emu/events{/privacy}","received_events_url":"https://api.github.com/users/dolphin-emu/received_events","type":"Organization","site_admin":false},"repo":{"id":11577304,"node_id":"MDEwOlJlcG9zaXRvcnkxMTU3NzMwNA==","name":"dolphin","full_name":"dolphin-emu/dolphin","private":false,"owner":{"login":"dolphin-emu","id":5050316,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUwNTAzMTY=","avatar_url":"https://avatars2.githubusercontent.com/u/5050316?v=4","gravatar_id":"","url":"https://api.github.com/users/dolphin-emu","html_url":"https://github.com/dolphin-emu","followers_url":"https://api.github.com/users/dolphin-emu/followers","following_url":"https://api.github.com/users/dolphin-emu/following{/other_user}","gists_url":"https://api.github.com/users/dolphin-emu/gists{/gist_id}","starred_url":"https://api.github.com/users/dolphin-emu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dolphin-emu/subscriptions","organizations_url":"https://api.github.com/users/dolphin-emu/orgs","repos_url":"https://api.github.com/users/dolphin-emu/repos","events_url":"https://api.github.com/users/dolphin-emu/events{/privacy}","received_events_url":"https://api.github.com/users/dolphin-emu/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/dolphin-emu/dolphin","description":"Dolphin is a GameCube / Wii emulator, allowing you to play games for these two platforms on PC with improvements.","fork":false,"url":"https://api.github.com/repos/dolphin-emu/dolphin","forks_url":"https://api.github.com/repos/dolphin-emu/dolphin/forks","keys_url":"https://api.github.com/repos/dolphin-emu/dolphin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dolphin-emu/dolphin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dolphin-emu/dolphin/teams","hooks_url":"https://api.github.com/repos/dolphin-emu/dolphin/hooks","issue_events_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/events{/number}","events_url":"https://api.github.com/repos/dolphin-emu/dolphin/events","assignees_url":"https://api.github.com/repos/dolphin-emu/dolphin/assignees{/user}","branches_url":"https://api.github.com/repos/dolphin-emu/dolphin/branches{/branch}","tags_url":"https://api.github.com/repos/dolphin-emu/dolphin/tags","blobs_url":"https://api.github.com/repos/dolphin-emu/dolphin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dolphin-emu/dolphin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dolphin-emu/dolphin/git/refs{/sha}","trees_url":"https://api.github.com/repos/dolphin-emu/dolphin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dolphin-emu/dolphin/statuses/{sha}","languages_url":"https://api.github.com/repos/dolphin-emu/dolphin/languages","stargazers_url":"https://api.github.com/repos/dolphin-emu/dolphin/stargazers","contributors_url":"https://api.github.com/repos/dolphin-emu/dolphin/contributors","subscribers_url":"https://api.github.com/repos/dolphin-emu/dolphin/subscribers","subscription_url":"https://api.github.com/repos/dolphin-emu/dolphin/subscription","commits_url":"https://api.github.com/repos/dolphin-emu/dolphin/commits{/sha}","git_commits_url":"https://api.github.com/repos/dolphin-emu/dolphin/git/commits{/sha}","comments_url":"https://api.github.com/repos/dolphin-emu/dolphin/comments{/number}","issue_comment_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/comments{/number}","contents_url":"https://api.github.com/repos/dolphin-emu/dolphin/contents/{+path}","compare_url":"https://api.github.com/repos/dolphin-emu/dolphin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dolphin-emu/dolphin/merges","archive_url":"https://api.github.com/repos/dolphin-emu/dolphin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dolphin-emu/dolphin/downloads","issues_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues{/number}","pulls_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls{/number}","milestones_url":"https://api.github.com/repos/dolphin-emu/dolphin/milestones{/number}","notifications_url":"https://api.github.com/repos/dolphin-emu/dolphin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dolphin-emu/dolphin/labels{/name}","releases_url":"https://api.github.com/repos/dolphin-emu/dolphin/releases{/id}","deployments_url":"https://api.github.com/repos/dolphin-emu/dolphin/deployments","created_at":"2013-07-22T09:07:57Z","updated_at":"2018-10-13T16:12:57Z","pushed_at":"2018-10-13T14:59:51Z","git_url":"git://github.com/dolphin-emu/dolphin.git","ssh_url":"git@github.com:dolphin-emu/dolphin.git","clone_url":"https://github.com/dolphin-emu/dolphin.git","svn_url":"https://github.com/dolphin-emu/dolphin","homepage":"https://dolphin-emu.org/","size":368731,"stargazers_count":4743,"watchers_count":4743,"language":"C++","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1123,"mirror_url":null,"archived":false,"open_issues_count":115,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":1123,"open_issues":115,"watchers":4743,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/7492"},"html":{"href":"https://github.com/dolphin-emu/dolphin/pull/7492"},"issue":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/issues/7492"},"comments":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/issues/7492/comments"},"review_comments":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/7492/comments"},"review_comment":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/7492/commits"},"statuses":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/statuses/06aa7043d6ba0a444ed1c35eef51229b852eca5f"}},"author_association":"MEMBER","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":58,"additions":2299,"deletions":1436,"changed_files":23}}
{"actor":{"display_login":"MerryMage"}}