{"action":"created","comment":{"url":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments/62884945","id":62884945,"diff_hunk":"@@ -583,6 +589,9 @@ const char* intentDescrString(IntentTag intent);\n // pass-by-reference intents are used.\n bool argMustUseCPtr(Type* t);\n \n+void substituteVarargTupleRefs(BlockStmt* ast, int numArgs, ArgSymbol* formal,","path":"compiler/include/symbol.h","position":21,"original_position":21,"commit_id":"20b76cba1018c724ee2d739174a99cfcfbb22a17","original_commit_id":"20b76cba1018c724ee2d739174a99cfcfbb22a17","user":{"login":"noakesmichael","id":2167206,"avatar_url":"https://avatars.githubusercontent.com/u/2167206?v=3","gravatar_id":"","url":"https://api.github.com/users/noakesmichael","html_url":"https://github.com/noakesmichael","followers_url":"https://api.github.com/users/noakesmichael/followers","following_url":"https://api.github.com/users/noakesmichael/following{/other_user}","gists_url":"https://api.github.com/users/noakesmichael/gists{/gist_id}","starred_url":"https://api.github.com/users/noakesmichael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noakesmichael/subscriptions","organizations_url":"https://api.github.com/users/noakesmichael/orgs","repos_url":"https://api.github.com/users/noakesmichael/repos","events_url":"https://api.github.com/users/noakesmichael/events{/privacy}","received_events_url":"https://api.github.com/users/noakesmichael/received_events","type":"User","site_admin":false},"body":"This function is defined in resolution/functionResolution.cpp and so the prototype should be in\r\ninclude/resolution.h.\r\n\r\nWhen you move the signature please update the formatting to better handle the wrap.  As a general\r\nrule, which is readily applied in this case, formals should either (1) fit on a single line or (2) be on\r\nindividual lines.\r\n\r\n","created_at":"2016-05-11T16:55:02Z","updated_at":"2016-05-11T16:55:02Z","html_url":"https://github.com/chapel-lang/chapel/pull/3838#discussion_r62884945","pull_request_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/3838","_links":{"self":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments/62884945"},"html":{"href":"https://github.com/chapel-lang/chapel/pull/3838#discussion_r62884945"},"pull_request":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/3838"}}},"pull_request":{"url":"https://api.github.com/repos/chapel-lang/chapel/pulls/3838","id":69095293,"html_url":"https://github.com/chapel-lang/chapel/pull/3838","diff_url":"https://github.com/chapel-lang/chapel/pull/3838.diff","patch_url":"https://github.com/chapel-lang/chapel/pull/3838.patch","issue_url":"https://api.github.com/repos/chapel-lang/chapel/issues/3838","number":3838,"state":"open","locked":false,"title":"Avoid creating a tuple for varargs in some cases","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":"WE USED TO\r\n\r\ncombine varargs into a tuple the first thing in a function.\r\nE.g when this function:\r\n\r\n  proc test(args...) {\r\n    BODY;\r\n  }\r\n\r\nis invoked with two formals, the compiler instantiates it into:\r\n\r\n  proc test(_e0_args, _e1_args) {\r\n    var args = _build_tuple(2, _e0_args, _e1_args);\r\n    BODY;\r\n  }\r\n\r\nIndeed the vararg tuple is created in the callee, not the caller.\r\n\r\nWITH THIS COMMIT,\r\n\r\nthe compiler no longer inserts the _build_tuple() call or creates\r\nthe local 'args' tuple when:\r\n\r\n(A) BODY does not need 'args' as a whole tuple (see below), and\r\n(B) the \"args...\" formal's intent is not 'out' or 'inout'.\r\n\r\nThis results in simpler generated code. Also, as the primary motivation\r\nfor this change, if the args formal has a param or type intent, then\r\n(...args) consists of params or types, resp. This latter was not the case\r\nprior to this change.\r\n\r\n(A) details: the compiler considers (A) to hold when the only uses\r\nof 'args' in the body, if any, are these:\r\n\r\n  (A1) (...args)           --> replaced with _e0_args, _e1_args\r\n  (A2) args(i) for param i --> replaced with _e0_args or _e1_args\r\n  (A3) args.size           --> replaced with 2\r\n\r\nThe replacements shown are for the test() example above.\r\n\r\n(B) details: supporting out/inout intent is left as future work.\r\nThese intents require formal temps. So instead of the 'args' tuple\r\nwe'd have to create individual temps. Maybe this wouldn't be\r\nmuch savings to begin with?\r\n\r\nIMPLEMENTATION NOTES\r\n\r\nWhen the function whose varargs are being instantiated\r\nhad FLAG_PARTIAL_COPY, the replacements needed to be done\r\nseparately. The necessary information is passed through\r\nthe fields I added on FnSymbol.\r\n\r\nWhile there, I added a missing SET_LINENO and in a different\r\nspot set a node's astloc manually, which is more lightweight\r\nthan SET_LINENO.\r\n\r\nALSO ADDED TESTS\r\n\r\nthat exercise varargs in various ways.","created_at":"2016-05-06T01:41:45Z","updated_at":"2016-05-11T16:55:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"46862138dab32d939d8fb72aaf06c35b20e8075e","assignee":{"login":"noakesmichael","id":2167206,"avatar_url":"https://avatars.githubusercontent.com/u/2167206?v=3","gravatar_id":"","url":"https://api.github.com/users/noakesmichael","html_url":"https://github.com/noakesmichael","followers_url":"https://api.github.com/users/noakesmichael/followers","following_url":"https://api.github.com/users/noakesmichael/following{/other_user}","gists_url":"https://api.github.com/users/noakesmichael/gists{/gist_id}","starred_url":"https://api.github.com/users/noakesmichael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noakesmichael/subscriptions","organizations_url":"https://api.github.com/users/noakesmichael/orgs","repos_url":"https://api.github.com/users/noakesmichael/repos","events_url":"https://api.github.com/users/noakesmichael/events{/privacy}","received_events_url":"https://api.github.com/users/noakesmichael/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/3838/commits","review_comments_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/3838/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/3838/comments","statuses_url":"https://api.github.com/repos/chapel-lang/chapel/statuses/20b76cba1018c724ee2d739174a99cfcfbb22a17","head":{"label":"vasslitvinov:avoid-creating-vararg-tuples","ref":"avoid-creating-vararg-tuples","sha":"20b76cba1018c724ee2d739174a99cfcfbb22a17","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},"repo":{"id":21914674,"name":"chapel","full_name":"vasslitvinov/chapel","owner":{"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},"private":false,"html_url":"https://github.com/vasslitvinov/chapel","description":"a Productive Parallel Programming Language","fork":true,"url":"https://api.github.com/repos/vasslitvinov/chapel","forks_url":"https://api.github.com/repos/vasslitvinov/chapel/forks","keys_url":"https://api.github.com/repos/vasslitvinov/chapel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vasslitvinov/chapel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vasslitvinov/chapel/teams","hooks_url":"https://api.github.com/repos/vasslitvinov/chapel/hooks","issue_events_url":"https://api.github.com/repos/vasslitvinov/chapel/issues/events{/number}","events_url":"https://api.github.com/repos/vasslitvinov/chapel/events","assignees_url":"https://api.github.com/repos/vasslitvinov/chapel/assignees{/user}","branches_url":"https://api.github.com/repos/vasslitvinov/chapel/branches{/branch}","tags_url":"https://api.github.com/repos/vasslitvinov/chapel/tags","blobs_url":"https://api.github.com/repos/vasslitvinov/chapel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vasslitvinov/chapel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vasslitvinov/chapel/git/refs{/sha}","trees_url":"https://api.github.com/repos/vasslitvinov/chapel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vasslitvinov/chapel/statuses/{sha}","languages_url":"https://api.github.com/repos/vasslitvinov/chapel/languages","stargazers_url":"https://api.github.com/repos/vasslitvinov/chapel/stargazers","contributors_url":"https://api.github.com/repos/vasslitvinov/chapel/contributors","subscribers_url":"https://api.github.com/repos/vasslitvinov/chapel/subscribers","subscription_url":"https://api.github.com/repos/vasslitvinov/chapel/subscription","commits_url":"https://api.github.com/repos/vasslitvinov/chapel/commits{/sha}","git_commits_url":"https://api.github.com/repos/vasslitvinov/chapel/git/commits{/sha}","comments_url":"https://api.github.com/repos/vasslitvinov/chapel/comments{/number}","issue_comment_url":"https://api.github.com/repos/vasslitvinov/chapel/issues/comments{/number}","contents_url":"https://api.github.com/repos/vasslitvinov/chapel/contents/{+path}","compare_url":"https://api.github.com/repos/vasslitvinov/chapel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vasslitvinov/chapel/merges","archive_url":"https://api.github.com/repos/vasslitvinov/chapel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vasslitvinov/chapel/downloads","issues_url":"https://api.github.com/repos/vasslitvinov/chapel/issues{/number}","pulls_url":"https://api.github.com/repos/vasslitvinov/chapel/pulls{/number}","milestones_url":"https://api.github.com/repos/vasslitvinov/chapel/milestones{/number}","notifications_url":"https://api.github.com/repos/vasslitvinov/chapel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vasslitvinov/chapel/labels{/name}","releases_url":"https://api.github.com/repos/vasslitvinov/chapel/releases{/id}","deployments_url":"https://api.github.com/repos/vasslitvinov/chapel/deployments","created_at":"2014-07-16T19:46:44Z","updated_at":"2016-03-08T21:35:20Z","pushed_at":"2016-05-10T23:48:34Z","git_url":"git://github.com/vasslitvinov/chapel.git","ssh_url":"git@github.com:vasslitvinov/chapel.git","clone_url":"https://github.com/vasslitvinov/chapel.git","svn_url":"https://github.com/vasslitvinov/chapel","homepage":"http://chapel.cray.com/","size":359994,"stargazers_count":1,"watchers_count":1,"language":"Chapel","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"chapel-lang:master","ref":"master","sha":"73581b23a360d7d0e6085d87533a7ebba0341e84","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}","deployments_url":"https://api.github.com/repos/chapel-lang/chapel/deployments","created_at":"2014-07-09T18:15:54Z","updated_at":"2016-05-10T23:38:01Z","pushed_at":"2016-05-11T16:19:41Z","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":470784,"stargazers_count":258,"watchers_count":258,"language":"Chapel","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":100,"mirror_url":null,"open_issues_count":17,"forks":100,"open_issues":17,"watchers":258,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/3838"},"html":{"href":"https://github.com/chapel-lang/chapel/pull/3838"},"issue":{"href":"https://api.github.com/repos/chapel-lang/chapel/issues/3838"},"comments":{"href":"https://api.github.com/repos/chapel-lang/chapel/issues/3838/comments"},"review_comments":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/3838/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/3838/commits"},"statuses":{"href":"https://api.github.com/repos/chapel-lang/chapel/statuses/20b76cba1018c724ee2d739174a99cfcfbb22a17"}}}}