{"action":"created","comment":{"url":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments/41675180","id":41675180,"diff_hunk":"@@ -135,11 +44,27 @@ static bool isAssignment(FnSymbol* fn)\n }\n \n \n-static bool isTrivialAssignment(FnSymbol* fn, FnSet& visited)\n+static bool isTrivialAssignment(FnSymbol* fn)\n {\n   if (! isAssignment(fn))\n     return false;\n-  if (isTrivial(fn, visited))\n+  \n+  // The base argument types must match.\n+  ArgSymbol* lhs = fn->getFormal(1);\n+  ArgSymbol* rhs = fn->getFormal(2);\n+  if (lhs->type->getValType() != rhs->type->getValType())\n+    return false;\n+\n+  // Don't consider assignment for class types to be trivial.\n+  // That is because a class type represents a pointer, so\n+  // we don't really track whether or not it is POD.\n+  // See\n+  //   test/classes/hilde/freeAssignment.chpl\n+  if (isClass(lhs->type->getValType()))\n+    return false;\n+","path":"compiler/optimizations/bulkCopyRecords.cpp","position":129,"original_position":129,"commit_id":"d4031072dbb97f9720e4dcb9d29dbe9bfad710d1","original_commit_id":"d4031072dbb97f9720e4dcb9d29dbe9bfad710d1","user":{"login":"vasslitvinov","id":8039635,"avatar_url":"https://avatars.githubusercontent.com/u/8039635?v=3","gravatar_id":"","url":"https://api.github.com/users/vasslitvinov","html_url":"https://github.com/vasslitvinov","followers_url":"https://api.github.com/users/vasslitvinov/followers","following_url":"https://api.github.com/users/vasslitvinov/following{/other_user}","gists_url":"https://api.github.com/users/vasslitvinov/gists{/gist_id}","starred_url":"https://api.github.com/users/vasslitvinov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vasslitvinov/subscriptions","organizations_url":"https://api.github.com/users/vasslitvinov/orgs","repos_url":"https://api.github.com/users/vasslitvinov/repos","events_url":"https://api.github.com/users/vasslitvinov/events{/privacy}","received_events_url":"https://api.github.com/users/vasslitvinov/received_events","type":"User","site_admin":false},"body":"Or do we support user-overloadable assignment etc. on classes, like in freeAssignment? Then it's a different game altogether.\r\n","created_at":"2015-10-09T20:35:24Z","updated_at":"2015-10-09T20:35:24Z","html_url":"https://github.com/chapel-lang/chapel/pull/2752#discussion_r41675180","pull_request_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/2752","_links":{"self":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments/41675180"},"html":{"href":"https://github.com/chapel-lang/chapel/pull/2752#discussion_r41675180"},"pull_request":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/2752"}}},"pull_request":{"url":"https://api.github.com/repos/chapel-lang/chapel/pulls/2752","id":47199454,"html_url":"https://github.com/chapel-lang/chapel/pull/2752","diff_url":"https://github.com/chapel-lang/chapel/pull/2752.diff","patch_url":"https://github.com/chapel-lang/chapel/pull/2752.patch","issue_url":"https://api.github.com/repos/chapel-lang/chapel/issues/2752","number":2752,"state":"open","locked":false,"title":"Fix detection and handling of POD types (on master)","user":{"login":"mppf","id":3653132,"avatar_url":"https://avatars.githubusercontent.com/u/3653132?v=3","gravatar_id":"","url":"https://api.github.com/users/mppf","html_url":"https://github.com/mppf","followers_url":"https://api.github.com/users/mppf/followers","following_url":"https://api.github.com/users/mppf/following{/other_user}","gists_url":"https://api.github.com/users/mppf/gists{/gist_id}","starred_url":"https://api.github.com/users/mppf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mppf/subscriptions","organizations_url":"https://api.github.com/users/mppf/orgs","repos_url":"https://api.github.com/users/mppf/repos","events_url":"https://api.github.com/users/mppf/events{/privacy}","received_events_url":"https://api.github.com/users/mppf/received_events","type":"User","site_admin":false},"body":"The compiler would like to optimize to use bit-copies for types when it is\r\nlegal and to use no-init/assign when it is legal.  In order to do so correctly,\r\nthis patch introduces an idea of POD types. A record type or a tuple type is a\r\nPOD type if:\r\n * it does not set pragma \"ignore noinit\"\r\n * it has only a compiler generated autoCopy\r\n * it has only a compiler generated autoDestroy\r\n * it has only a compiler generated initialization/construction routine\r\n * it has only a compiler generated = routine (when LHS=RHS)\r\n * it contains only POD type fields.\r\n\r\nIt doesn't really make sense to talk about whether or not class types\r\nare POD in Chapel... but a since variables of class type are pointers,\r\nthey are considered POD.\r\n\r\nFor POD types,  we can\r\n * bit copy them across locales without calling overrides\r\n * avoid ever calling autoCopy/autoDestroy\r\n * replace record assignment with bit copy.\r\n\r\nThis patch reworks bulkCopyRecords to use the idea of a POD type since\r\npreviously, it would incorrectly think an assignment overload like\r\n\r\n     lhs.x = rhs.y;\r\n     rhs.y = rhs.x;\r\n\r\nwould be trivial.\r\n\r\nWhether or not records are POD type is computed and recorded in resolution for\r\nall records and can be checked by flags or with a primitive (for use in module\r\ncode).\r\n\r\n* correctly detect and mark POD types during function resolution\r\n* provide primitive to check if we have a POD type (for bulk transfer opt)\r\n* adjusts bulkCopyRecords to use correct POD detection\r\n* adjusts flattenFunctions to pass non-POD types by reference. This should\r\n  resolve the error with test/types/records/ferguson/on-const.chpl.\r\n* changes uses of FLAG_IGNORE_NOINIT in resolution to use FLAG_NOT_POD because\r\n  overriding the =, init copy, auto copy, or auto destroy generally means that\r\n  you can access the stack trash in a record if no-init is used.\r\n* removed flags FLAG_HAS_USER_ASSIGNMENT, FLAG_HAS_USER_DESTRUCTOR,\r\n  FLAG_HAS_USER_INIT_COPY_FN, FLAG_TRIVIAL_ASSIGNMENT in favor of using the new\r\n  flags FLAG_POD and FLAG_NOT_POD.\r\n* updates pass removeUnnecessaryAutoCopyCalls to use the new mechanism\r\n\r\nThis patch was originally developed on string-as-rec as #2367.\r\nI ported it over by doing cherry-picks of\r\n e0b0859179af0d9e26af644b4196bc1ec69f5a2f\r\n e56dbc8b3aac40dde3ed285049447f1851a565f8\r\n 4a57298b87339f9a1092e82a3b65b2171d150521\r\n a097b49b39f99985735bb4ed1fa365af08177b10\r\n ff16c529f3e2693f268f319e4af240dc167216fb\r\n fbf4370279e0ff8bf7b609886ed368309f901d74\r\n 4de1de96e7a40081c4d8558e7d9642bdabebc583\r\n 1075ca55621ef8b1a3bd3f3be0f8c9e73215fadc\r\n 199bde94e16cf9cd6cf61b354d8cfa90b89538d8\r\n 659bd0080f9a67584638ccb05462de851b7fb4cd\r\n 909db790f666a7dc951cb955edc0d7007012b891\r\n 95e05bf0e4139795a06003ea6422c21ead31622d\r\n bbcb76d215d03ae74220bb7e2ae7744009ea33ef\r\n c0bef3e2282cf4b9ecf6b66af8a09627c7a57c8d\r\n ff464db3a087a566b59630a1289c24878be34134\r\n 775bb82ea824b3db62168d5a4134b73f237bab76\r\n 733a639092c4cd50ab9bf38724114b864f8f2696\r\n 09debc0f9680fea152b88b7365eb2b3b468c98b9\r\n 9eb245458e57abeb1164e67d7eddffe9af22ba1a\r\n cf93c3e08291b940802cabd7fd4fe164523704e6\r\n\r\nand then updating removeUnnecessaryAutoCopyCalls\r\n(since that pass is not used in string-as-rec).\r\n\r\n- [x] passed full local testing\r\n- [x] passed hello*.chpl with GASNet","created_at":"2015-10-08T20:04:22Z","updated_at":"2015-10-09T20:35:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d92d6f7e161531f5cb3eddb49e9b920ba959606e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/2752/commits","review_comments_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/2752/comments","review_comment_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chapel-lang/chapel/issues/2752/comments","statuses_url":"https://api.github.com/repos/chapel-lang/chapel/statuses/d4031072dbb97f9720e4dcb9d29dbe9bfad710d1","head":{"label":"mppf:pod-changes-on-master","ref":"pod-changes-on-master","sha":"d4031072dbb97f9720e4dcb9d29dbe9bfad710d1","user":{"login":"mppf","id":3653132,"avatar_url":"https://avatars.githubusercontent.com/u/3653132?v=3","gravatar_id":"","url":"https://api.github.com/users/mppf","html_url":"https://github.com/mppf","followers_url":"https://api.github.com/users/mppf/followers","following_url":"https://api.github.com/users/mppf/following{/other_user}","gists_url":"https://api.github.com/users/mppf/gists{/gist_id}","starred_url":"https://api.github.com/users/mppf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mppf/subscriptions","organizations_url":"https://api.github.com/users/mppf/orgs","repos_url":"https://api.github.com/users/mppf/repos","events_url":"https://api.github.com/users/mppf/events{/privacy}","received_events_url":"https://api.github.com/users/mppf/received_events","type":"User","site_admin":false},"repo":{"id":22106313,"name":"chapel","full_name":"mppf/chapel","owner":{"login":"mppf","id":3653132,"avatar_url":"https://avatars.githubusercontent.com/u/3653132?v=3","gravatar_id":"","url":"https://api.github.com/users/mppf","html_url":"https://github.com/mppf","followers_url":"https://api.github.com/users/mppf/followers","following_url":"https://api.github.com/users/mppf/following{/other_user}","gists_url":"https://api.github.com/users/mppf/gists{/gist_id}","starred_url":"https://api.github.com/users/mppf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mppf/subscriptions","organizations_url":"https://api.github.com/users/mppf/orgs","repos_url":"https://api.github.com/users/mppf/repos","events_url":"https://api.github.com/users/mppf/events{/privacy}","received_events_url":"https://api.github.com/users/mppf/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mppf/chapel","description":"a Productive Parallel Programming Language","fork":true,"url":"https://api.github.com/repos/mppf/chapel","forks_url":"https://api.github.com/repos/mppf/chapel/forks","keys_url":"https://api.github.com/repos/mppf/chapel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mppf/chapel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mppf/chapel/teams","hooks_url":"https://api.github.com/repos/mppf/chapel/hooks","issue_events_url":"https://api.github.com/repos/mppf/chapel/issues/events{/number}","events_url":"https://api.github.com/repos/mppf/chapel/events","assignees_url":"https://api.github.com/repos/mppf/chapel/assignees{/user}","branches_url":"https://api.github.com/repos/mppf/chapel/branches{/branch}","tags_url":"https://api.github.com/repos/mppf/chapel/tags","blobs_url":"https://api.github.com/repos/mppf/chapel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mppf/chapel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mppf/chapel/git/refs{/sha}","trees_url":"https://api.github.com/repos/mppf/chapel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mppf/chapel/statuses/{sha}","languages_url":"https://api.github.com/repos/mppf/chapel/languages","stargazers_url":"https://api.github.com/repos/mppf/chapel/stargazers","contributors_url":"https://api.github.com/repos/mppf/chapel/contributors","subscribers_url":"https://api.github.com/repos/mppf/chapel/subscribers","subscription_url":"https://api.github.com/repos/mppf/chapel/subscription","commits_url":"https://api.github.com/repos/mppf/chapel/commits{/sha}","git_commits_url":"https://api.github.com/repos/mppf/chapel/git/commits{/sha}","comments_url":"https://api.github.com/repos/mppf/chapel/comments{/number}","issue_comment_url":"https://api.github.com/repos/mppf/chapel/issues/comments{/number}","contents_url":"https://api.github.com/repos/mppf/chapel/contents/{+path}","compare_url":"https://api.github.com/repos/mppf/chapel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mppf/chapel/merges","archive_url":"https://api.github.com/repos/mppf/chapel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mppf/chapel/downloads","issues_url":"https://api.github.com/repos/mppf/chapel/issues{/number}","pulls_url":"https://api.github.com/repos/mppf/chapel/pulls{/number}","milestones_url":"https://api.github.com/repos/mppf/chapel/milestones{/number}","notifications_url":"https://api.github.com/repos/mppf/chapel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mppf/chapel/labels{/name}","releases_url":"https://api.github.com/repos/mppf/chapel/releases{/id}","created_at":"2014-07-22T14:05:45Z","updated_at":"2015-05-08T20:28:40Z","pushed_at":"2015-10-09T20:00:50Z","git_url":"git://github.com/mppf/chapel.git","ssh_url":"git@github.com:mppf/chapel.git","clone_url":"https://github.com/mppf/chapel.git","svn_url":"https://github.com/mppf/chapel","homepage":"http://chapel.cray.com/","size":395740,"stargazers_count":1,"watchers_count":1,"language":"Chapel","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"chapel-lang:master","ref":"master","sha":"cc8f4888c64ce1b5c82ae22b59065bcd1beffd7a","user":{"login":"chapel-lang","id":7597261,"avatar_url":"https://avatars.githubusercontent.com/u/7597261?v=3","gravatar_id":"","url":"https://api.github.com/users/chapel-lang","html_url":"https://github.com/chapel-lang","followers_url":"https://api.github.com/users/chapel-lang/followers","following_url":"https://api.github.com/users/chapel-lang/following{/other_user}","gists_url":"https://api.github.com/users/chapel-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/chapel-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chapel-lang/subscriptions","organizations_url":"https://api.github.com/users/chapel-lang/orgs","repos_url":"https://api.github.com/users/chapel-lang/repos","events_url":"https://api.github.com/users/chapel-lang/events{/privacy}","received_events_url":"https://api.github.com/users/chapel-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":21663285,"name":"chapel","full_name":"chapel-lang/chapel","owner":{"login":"chapel-lang","id":7597261,"avatar_url":"https://avatars.githubusercontent.com/u/7597261?v=3","gravatar_id":"","url":"https://api.github.com/users/chapel-lang","html_url":"https://github.com/chapel-lang","followers_url":"https://api.github.com/users/chapel-lang/followers","following_url":"https://api.github.com/users/chapel-lang/following{/other_user}","gists_url":"https://api.github.com/users/chapel-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/chapel-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chapel-lang/subscriptions","organizations_url":"https://api.github.com/users/chapel-lang/orgs","repos_url":"https://api.github.com/users/chapel-lang/repos","events_url":"https://api.github.com/users/chapel-lang/events{/privacy}","received_events_url":"https://api.github.com/users/chapel-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/chapel-lang/chapel","description":"a Productive Parallel Programming Language","fork":false,"url":"https://api.github.com/repos/chapel-lang/chapel","forks_url":"https://api.github.com/repos/chapel-lang/chapel/forks","keys_url":"https://api.github.com/repos/chapel-lang/chapel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chapel-lang/chapel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chapel-lang/chapel/teams","hooks_url":"https://api.github.com/repos/chapel-lang/chapel/hooks","issue_events_url":"https://api.github.com/repos/chapel-lang/chapel/issues/events{/number}","events_url":"https://api.github.com/repos/chapel-lang/chapel/events","assignees_url":"https://api.github.com/repos/chapel-lang/chapel/assignees{/user}","branches_url":"https://api.github.com/repos/chapel-lang/chapel/branches{/branch}","tags_url":"https://api.github.com/repos/chapel-lang/chapel/tags","blobs_url":"https://api.github.com/repos/chapel-lang/chapel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chapel-lang/chapel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chapel-lang/chapel/git/refs{/sha}","trees_url":"https://api.github.com/repos/chapel-lang/chapel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chapel-lang/chapel/statuses/{sha}","languages_url":"https://api.github.com/repos/chapel-lang/chapel/languages","stargazers_url":"https://api.github.com/repos/chapel-lang/chapel/stargazers","contributors_url":"https://api.github.com/repos/chapel-lang/chapel/contributors","subscribers_url":"https://api.github.com/repos/chapel-lang/chapel/subscribers","subscription_url":"https://api.github.com/repos/chapel-lang/chapel/subscription","commits_url":"https://api.github.com/repos/chapel-lang/chapel/commits{/sha}","git_commits_url":"https://api.github.com/repos/chapel-lang/chapel/git/commits{/sha}","comments_url":"https://api.github.com/repos/chapel-lang/chapel/comments{/number}","issue_comment_url":"https://api.github.com/repos/chapel-lang/chapel/issues/comments{/number}","contents_url":"https://api.github.com/repos/chapel-lang/chapel/contents/{+path}","compare_url":"https://api.github.com/repos/chapel-lang/chapel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chapel-lang/chapel/merges","archive_url":"https://api.github.com/repos/chapel-lang/chapel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chapel-lang/chapel/downloads","issues_url":"https://api.github.com/repos/chapel-lang/chapel/issues{/number}","pulls_url":"https://api.github.com/repos/chapel-lang/chapel/pulls{/number}","milestones_url":"https://api.github.com/repos/chapel-lang/chapel/milestones{/number}","notifications_url":"https://api.github.com/repos/chapel-lang/chapel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chapel-lang/chapel/labels{/name}","releases_url":"https://api.github.com/repos/chapel-lang/chapel/releases{/id}","created_at":"2014-07-09T18:15:54Z","updated_at":"2015-10-08T17:07:33Z","pushed_at":"2015-10-09T19:58:50Z","git_url":"git://github.com/chapel-lang/chapel.git","ssh_url":"git@github.com:chapel-lang/chapel.git","clone_url":"https://github.com/chapel-lang/chapel.git","svn_url":"https://github.com/chapel-lang/chapel","homepage":"http://chapel.cray.com/","size":489447,"stargazers_count":146,"watchers_count":146,"language":"Chapel","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":53,"mirror_url":null,"open_issues_count":12,"forks":53,"open_issues":12,"watchers":146,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/2752"},"html":{"href":"https://github.com/chapel-lang/chapel/pull/2752"},"issue":{"href":"https://api.github.com/repos/chapel-lang/chapel/issues/2752"},"comments":{"href":"https://api.github.com/repos/chapel-lang/chapel/issues/2752/comments"},"review_comments":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/2752/comments"},"review_comment":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/2752/commits"},"statuses":{"href":"https://api.github.com/repos/chapel-lang/chapel/statuses/d4031072dbb97f9720e4dcb9d29dbe9bfad710d1"}}}}