{"action":"created","comment":{"url":"https://api.github.com/repos/dlang/dmd/pulls/comments/82319007","pull_request_review_id":3235946,"id":82319007,"diff_hunk":"@@ -0,0 +1,256 @@\n+\n+/*\n+ * Copyright (c) 2016 by Digital Mars\n+ * All Rights Reserved\n+ * written by Walter Bright\n+ * http://www.digitalmars.com\n+ * Distributed under the Boost Software License, Version 1.0.\n+ * http://www.boost.org/LICENSE_1_0.txt\n+ * https://github.com/dlang/dmd/blob/master/src/backend/gslice.c\n+ */\n+\n+#if (SCPP || MARS) && !HTOD\n+\n+#include        <stdio.h>\n+#include        <string.h>\n+#include        <stdlib.h>\n+#include        <time.h>\n+\n+#include        \"cc.h\"\n+#include        \"el.h\"\n+#include        \"go.h\"\n+#include        \"oper.h\"\n+#include        \"global.h\"\n+#include        \"type.h\"\n+#include        \"code.h\"\n+\n+static char __file__[] = __FILE__;      /* for tassert.h                */\n+#include        \"tassert.h\"\n+\n+struct SymInfo\n+{\n+    bool canSlice;\n+    SYMIDX si0;\n+};\n+\n+static void sliceStructs_Gather(SymInfo *sia, elem *e)\n+{\n+    while (1)\n+    {\n+        switch (e->Eoper)\n+        {\n+            case OPvar:\n+            {\n+                SYMIDX si = e->EV.sp.Vsym->Ssymnum;\n+                if (si >= 0 && sia[si].canSlice)\n+                {\n+                    assert(si < globsym.top);\n+                    if (tysize(e->Ety) == REGSIZE &&\n+                        (e->Eoffset == 0 || e->Eoffset == REGSIZE))\n+                    {\n+                    }\n+                    else\n+                    {\n+                        sia[si].canSlice = false;\n+                    }\n+                }\n+                return;\n+            }\n+            default:\n+                if (OTunary(e->Eoper))\n+                {\n+                    e = e->E1;\n+                    break;\n+                }\n+                if (OTbinary(e->Eoper))\n+                {\n+                    sliceStructs_Gather(sia, e->E2);\n+                    e = e->E1;\n+                    break;\n+                }\n+                return;\n+        }\n+    }\n+}\n+\n+static void sliceStructs_Replace(SymInfo *sia, elem *e)\n+{\n+    while (1)\n+    {\n+        switch (e->Eoper)\n+        {\n+            case OPvar:\n+            {\n+                Symbol *s = e->EV.sp.Vsym;\n+                SYMIDX si = s->Ssymnum;\n+                //printf(\"e: %d %d\\n\", si, sia[si].canSlice);\n+                //elem_print(e);\n+                if (si >= 0 && sia[si].canSlice)\n+                {\n+                    if (e->Eoffset == 0)\n+                    {\n+                        type_free(s->Stype);\n+                        s->Stype = type_fake(e->Ety);\n+                    }\n+                    else\n+                    {\n+                        Symbol *s1 = globsym.tab[sia[si].si0 + 1];\n+                        type_free(s1->Stype);\n+                        s1->Stype = type_fake(e->Ety);\n+                        e->EV.sp.Vsym = s1;\n+                        e->Eoffset = 0;\n+                        //printf(\"replaced with:\\n\");\n+                        //elem_print(e);\n+                    }\n+                }\n+                return;\n+            }\n+\n+            default:\n+                if (OTunary(e->Eoper))\n+                {\n+                    e = e->E1;\n+                    break;\n+                }\n+                if (OTbinary(e->Eoper))\n+                {\n+                    sliceStructs_Replace(sia, e->E2);\n+                    e = e->E1;\n+                    break;\n+                }\n+                return;\n+        }\n+    }\n+}\n+\n+void sliceStructs()\n+{\n+    if (debugc) printf(\"sliceStructs()\\n\");\n+    size_t sia_length = globsym.top;\n+    SymInfo *sia = (SymInfo *)malloc(3 * sia_length * sizeof(SymInfo));\n+    assert(sia);\n+    SymInfo *sia2 = sia + sia_length;\n+\n+    bool anySlice = false;\n+    for (int si = 0; si < globsym.top; si++)\n+    {\n+        Symbol *s = globsym.tab[si];\n+        //printf(\"slice1: %s\\n\", s->Sident);\n+\n+        if ((s->Sflags & (GTregcand | SFLunambig)) != (GTregcand | SFLunambig))\n+        {\n+            sia[si].canSlice = false;\n+            continue;\n+        }\n+\n+        targ_size_t sz = type_size(s->Stype);\n+        if (sz != 2 * REGSIZE ||\n+            tyfv(s->Stype->Tty) || tybasic(s->Stype->Tty) == TYhptr)    // because there is no TYseg\n+        {\n+            sia[si].canSlice = false;\n+            continue;\n+        }\n+\n+        switch (s->Sclass)\n+        {\n+            case SCfastpar:\n+            case SCregister:\n+            case SCauto:\n+            case SCshadowreg:\n+            case SCparameter:\n+                anySlice = true;\n+                sia[si].canSlice = true;\n+                break;\n+\n+            case SCstack:\n+            case SCpseudo:\n+            case SCstatic:\n+            case SCbprel:\n+                sia[si].canSlice = false;\n+                break;\n+\n+            default:\n+                symbol_print(s);\n+                assert(0);\n+        }\n+    }\n+\n+    if (!anySlice)\n+        goto Ldone;\n+\n+    for (block *b = startblock; b; b = b->Bnext)\n+    {\n+        if (b->BC == BCasm)\n+            goto Ldone;\n+        if (b->Belem)\n+            sliceStructs_Gather(sia, b->Belem);\n+    }\n+\n+    {\n+        bool any = false;\n+        int n = 0;\n+        for (int si = 0; si < sia_length; si++)\n+        {\n+            sia2[si + n].canSlice = false;\n+            if (sia[si].canSlice)","path":"src/backend/gslice.c","position":192,"original_position":195,"commit_id":"f98bcbeae19f97a3e3cae539274f35dfbda26115","original_commit_id":"e3af5a9b94624aa6903fbc031263c54135f52049","user":{"login":"WalterBright","id":568298,"avatar_url":"https://avatars.githubusercontent.com/u/568298?v=3","gravatar_id":"","url":"https://api.github.com/users/WalterBright","html_url":"https://github.com/WalterBright","followers_url":"https://api.github.com/users/WalterBright/followers","following_url":"https://api.github.com/users/WalterBright/following{/other_user}","gists_url":"https://api.github.com/users/WalterBright/gists{/gist_id}","starred_url":"https://api.github.com/users/WalterBright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WalterBright/subscriptions","organizations_url":"https://api.github.com/users/WalterBright/orgs","repos_url":"https://api.github.com/users/WalterBright/repos","events_url":"https://api.github.com/users/WalterBright/events{/privacy}","received_events_url":"https://api.github.com/users/WalterBright/received_events","type":"User","site_admin":false},"body":"I like to avoid things like \"not can slice\", the negations are cognitively harder.","created_at":"2016-10-07T01:59:39Z","updated_at":"2016-10-07T01:59:39Z","html_url":"https://github.com/dlang/dmd/pull/6176#discussion_r82319007","pull_request_url":"https://api.github.com/repos/dlang/dmd/pulls/6176","_links":{"self":{"href":"https://api.github.com/repos/dlang/dmd/pulls/comments/82319007"},"html":{"href":"https://github.com/dlang/dmd/pull/6176#discussion_r82319007"},"pull_request":{"href":"https://api.github.com/repos/dlang/dmd/pulls/6176"}}},"pull_request":{"url":"https://api.github.com/repos/dlang/dmd/pulls/6176","id":88199836,"html_url":"https://github.com/dlang/dmd/pull/6176","diff_url":"https://github.com/dlang/dmd/pull/6176.diff","patch_url":"https://github.com/dlang/dmd/pull/6176.patch","issue_url":"https://api.github.com/repos/dlang/dmd/issues/6176","number":6176,"state":"open","locked":false,"title":"add backend/gslice.d:  struct slice optimization","user":{"login":"WalterBright","id":568298,"avatar_url":"https://avatars.githubusercontent.com/u/568298?v=3","gravatar_id":"","url":"https://api.github.com/users/WalterBright","html_url":"https://github.com/WalterBright","followers_url":"https://api.github.com/users/WalterBright/followers","following_url":"https://api.github.com/users/WalterBright/following{/other_user}","gists_url":"https://api.github.com/users/WalterBright/gists{/gist_id}","starred_url":"https://api.github.com/users/WalterBright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WalterBright/subscriptions","organizations_url":"https://api.github.com/users/WalterBright/orgs","repos_url":"https://api.github.com/users/WalterBright/repos","events_url":"https://api.github.com/users/WalterBright/events{/privacy}","received_events_url":"https://api.github.com/users/WalterBright/received_events","type":"User","site_admin":false},"body":"This enables 'slicing' a two register wide aggregate into two register-sized variables, enabling much better enregistering. This is just a start for this. I'm doing this in smaller steps to make it easier to track down causes of any regressions.\r\n","created_at":"2016-10-06T05:12:59Z","updated_at":"2016-10-07T01:59:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"398de230448c5b17d2c59ecd3fd32bec10f21dec","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dlang/dmd/pulls/6176/commits","review_comments_url":"https://api.github.com/repos/dlang/dmd/pulls/6176/comments","review_comment_url":"https://api.github.com/repos/dlang/dmd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dlang/dmd/issues/6176/comments","statuses_url":"https://api.github.com/repos/dlang/dmd/statuses/f98bcbeae19f97a3e3cae539274f35dfbda26115","head":{"label":"WalterBright:structslice1","ref":"structslice1","sha":"f98bcbeae19f97a3e3cae539274f35dfbda26115","user":{"login":"WalterBright","id":568298,"avatar_url":"https://avatars.githubusercontent.com/u/568298?v=3","gravatar_id":"","url":"https://api.github.com/users/WalterBright","html_url":"https://github.com/WalterBright","followers_url":"https://api.github.com/users/WalterBright/followers","following_url":"https://api.github.com/users/WalterBright/following{/other_user}","gists_url":"https://api.github.com/users/WalterBright/gists{/gist_id}","starred_url":"https://api.github.com/users/WalterBright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WalterBright/subscriptions","organizations_url":"https://api.github.com/users/WalterBright/orgs","repos_url":"https://api.github.com/users/WalterBright/repos","events_url":"https://api.github.com/users/WalterBright/events{/privacy}","received_events_url":"https://api.github.com/users/WalterBright/received_events","type":"User","site_admin":false},"repo":{"id":7849157,"name":"dmd","full_name":"WalterBright/dmd","owner":{"login":"WalterBright","id":568298,"avatar_url":"https://avatars.githubusercontent.com/u/568298?v=3","gravatar_id":"","url":"https://api.github.com/users/WalterBright","html_url":"https://github.com/WalterBright","followers_url":"https://api.github.com/users/WalterBright/followers","following_url":"https://api.github.com/users/WalterBright/following{/other_user}","gists_url":"https://api.github.com/users/WalterBright/gists{/gist_id}","starred_url":"https://api.github.com/users/WalterBright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WalterBright/subscriptions","organizations_url":"https://api.github.com/users/WalterBright/orgs","repos_url":"https://api.github.com/users/WalterBright/repos","events_url":"https://api.github.com/users/WalterBright/events{/privacy}","received_events_url":"https://api.github.com/users/WalterBright/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/WalterBright/dmd","description":"dmd D Programming Language compiler","fork":true,"url":"https://api.github.com/repos/WalterBright/dmd","forks_url":"https://api.github.com/repos/WalterBright/dmd/forks","keys_url":"https://api.github.com/repos/WalterBright/dmd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/WalterBright/dmd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/WalterBright/dmd/teams","hooks_url":"https://api.github.com/repos/WalterBright/dmd/hooks","issue_events_url":"https://api.github.com/repos/WalterBright/dmd/issues/events{/number}","events_url":"https://api.github.com/repos/WalterBright/dmd/events","assignees_url":"https://api.github.com/repos/WalterBright/dmd/assignees{/user}","branches_url":"https://api.github.com/repos/WalterBright/dmd/branches{/branch}","tags_url":"https://api.github.com/repos/WalterBright/dmd/tags","blobs_url":"https://api.github.com/repos/WalterBright/dmd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/WalterBright/dmd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/WalterBright/dmd/git/refs{/sha}","trees_url":"https://api.github.com/repos/WalterBright/dmd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/WalterBright/dmd/statuses/{sha}","languages_url":"https://api.github.com/repos/WalterBright/dmd/languages","stargazers_url":"https://api.github.com/repos/WalterBright/dmd/stargazers","contributors_url":"https://api.github.com/repos/WalterBright/dmd/contributors","subscribers_url":"https://api.github.com/repos/WalterBright/dmd/subscribers","subscription_url":"https://api.github.com/repos/WalterBright/dmd/subscription","commits_url":"https://api.github.com/repos/WalterBright/dmd/commits{/sha}","git_commits_url":"https://api.github.com/repos/WalterBright/dmd/git/commits{/sha}","comments_url":"https://api.github.com/repos/WalterBright/dmd/comments{/number}","issue_comment_url":"https://api.github.com/repos/WalterBright/dmd/issues/comments{/number}","contents_url":"https://api.github.com/repos/WalterBright/dmd/contents/{+path}","compare_url":"https://api.github.com/repos/WalterBright/dmd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/WalterBright/dmd/merges","archive_url":"https://api.github.com/repos/WalterBright/dmd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/WalterBright/dmd/downloads","issues_url":"https://api.github.com/repos/WalterBright/dmd/issues{/number}","pulls_url":"https://api.github.com/repos/WalterBright/dmd/pulls{/number}","milestones_url":"https://api.github.com/repos/WalterBright/dmd/milestones{/number}","notifications_url":"https://api.github.com/repos/WalterBright/dmd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/WalterBright/dmd/labels{/name}","releases_url":"https://api.github.com/repos/WalterBright/dmd/releases{/id}","deployments_url":"https://api.github.com/repos/WalterBright/dmd/deployments","created_at":"2013-01-27T06:45:40Z","updated_at":"2015-08-23T08:04:14Z","pushed_at":"2016-10-07T01:59:30Z","git_url":"git://github.com/WalterBright/dmd.git","ssh_url":"git@github.com:WalterBright/dmd.git","clone_url":"https://github.com/WalterBright/dmd.git","svn_url":"https://github.com/WalterBright/dmd","homepage":"d-programming-language.org","size":68851,"stargazers_count":0,"watchers_count":0,"language":"D","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"dlang:master","ref":"master","sha":"77d690fa8894b024b4700e09371d4ed6f745e1c1","user":{"login":"dlang","id":565913,"avatar_url":"https://avatars.githubusercontent.com/u/565913?v=3","gravatar_id":"","url":"https://api.github.com/users/dlang","html_url":"https://github.com/dlang","followers_url":"https://api.github.com/users/dlang/followers","following_url":"https://api.github.com/users/dlang/following{/other_user}","gists_url":"https://api.github.com/users/dlang/gists{/gist_id}","starred_url":"https://api.github.com/users/dlang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlang/subscriptions","organizations_url":"https://api.github.com/users/dlang/orgs","repos_url":"https://api.github.com/users/dlang/repos","events_url":"https://api.github.com/users/dlang/events{/privacy}","received_events_url":"https://api.github.com/users/dlang/received_events","type":"Organization","site_admin":false},"repo":{"id":1257070,"name":"dmd","full_name":"dlang/dmd","owner":{"login":"dlang","id":565913,"avatar_url":"https://avatars.githubusercontent.com/u/565913?v=3","gravatar_id":"","url":"https://api.github.com/users/dlang","html_url":"https://github.com/dlang","followers_url":"https://api.github.com/users/dlang/followers","following_url":"https://api.github.com/users/dlang/following{/other_user}","gists_url":"https://api.github.com/users/dlang/gists{/gist_id}","starred_url":"https://api.github.com/users/dlang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlang/subscriptions","organizations_url":"https://api.github.com/users/dlang/orgs","repos_url":"https://api.github.com/users/dlang/repos","events_url":"https://api.github.com/users/dlang/events{/privacy}","received_events_url":"https://api.github.com/users/dlang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dlang/dmd","description":"dmd D Programming Language compiler","fork":false,"url":"https://api.github.com/repos/dlang/dmd","forks_url":"https://api.github.com/repos/dlang/dmd/forks","keys_url":"https://api.github.com/repos/dlang/dmd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dlang/dmd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dlang/dmd/teams","hooks_url":"https://api.github.com/repos/dlang/dmd/hooks","issue_events_url":"https://api.github.com/repos/dlang/dmd/issues/events{/number}","events_url":"https://api.github.com/repos/dlang/dmd/events","assignees_url":"https://api.github.com/repos/dlang/dmd/assignees{/user}","branches_url":"https://api.github.com/repos/dlang/dmd/branches{/branch}","tags_url":"https://api.github.com/repos/dlang/dmd/tags","blobs_url":"https://api.github.com/repos/dlang/dmd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dlang/dmd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dlang/dmd/git/refs{/sha}","trees_url":"https://api.github.com/repos/dlang/dmd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dlang/dmd/statuses/{sha}","languages_url":"https://api.github.com/repos/dlang/dmd/languages","stargazers_url":"https://api.github.com/repos/dlang/dmd/stargazers","contributors_url":"https://api.github.com/repos/dlang/dmd/contributors","subscribers_url":"https://api.github.com/repos/dlang/dmd/subscribers","subscription_url":"https://api.github.com/repos/dlang/dmd/subscription","commits_url":"https://api.github.com/repos/dlang/dmd/commits{/sha}","git_commits_url":"https://api.github.com/repos/dlang/dmd/git/commits{/sha}","comments_url":"https://api.github.com/repos/dlang/dmd/comments{/number}","issue_comment_url":"https://api.github.com/repos/dlang/dmd/issues/comments{/number}","contents_url":"https://api.github.com/repos/dlang/dmd/contents/{+path}","compare_url":"https://api.github.com/repos/dlang/dmd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dlang/dmd/merges","archive_url":"https://api.github.com/repos/dlang/dmd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dlang/dmd/downloads","issues_url":"https://api.github.com/repos/dlang/dmd/issues{/number}","pulls_url":"https://api.github.com/repos/dlang/dmd/pulls{/number}","milestones_url":"https://api.github.com/repos/dlang/dmd/milestones{/number}","notifications_url":"https://api.github.com/repos/dlang/dmd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dlang/dmd/labels{/name}","releases_url":"https://api.github.com/repos/dlang/dmd/releases{/id}","deployments_url":"https://api.github.com/repos/dlang/dmd/deployments","created_at":"2011-01-15T06:53:53Z","updated_at":"2016-10-05T15:33:34Z","pushed_at":"2016-10-07T01:59:30Z","git_url":"git://github.com/dlang/dmd.git","ssh_url":"git@github.com:dlang/dmd.git","clone_url":"https://github.com/dlang/dmd.git","svn_url":"https://github.com/dlang/dmd","homepage":"dlang.org","size":90968,"stargazers_count":1288,"watchers_count":1288,"language":"D","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":379,"mirror_url":null,"open_issues_count":142,"forks":379,"open_issues":142,"watchers":1288,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dlang/dmd/pulls/6176"},"html":{"href":"https://github.com/dlang/dmd/pull/6176"},"issue":{"href":"https://api.github.com/repos/dlang/dmd/issues/6176"},"comments":{"href":"https://api.github.com/repos/dlang/dmd/issues/6176/comments"},"review_comments":{"href":"https://api.github.com/repos/dlang/dmd/pulls/6176/comments"},"review_comment":{"href":"https://api.github.com/repos/dlang/dmd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dlang/dmd/pulls/6176/commits"},"statuses":{"href":"https://api.github.com/repos/dlang/dmd/statuses/f98bcbeae19f97a3e3cae539274f35dfbda26115"}}}}
{"actor":{"display_login":"WalterBright"}}