{"action":"opened","number":855,"pull_request":{"url":"https://api.github.com/repos/ocaml/ocaml/pulls/855","id":89160904,"html_url":"https://github.com/ocaml/ocaml/pull/855","diff_url":"https://github.com/ocaml/ocaml/pull/855.diff","patch_url":"https://github.com/ocaml/ocaml/pull/855.patch","issue_url":"https://api.github.com/repos/ocaml/ocaml/issues/855","number":855,"state":"open","locked":false,"title":"Add \"phantom let\" support and provenance tracking to Flambda","user":{"login":"mshinwell","id":1315488,"avatar_url":"https://avatars.githubusercontent.com/u/1315488?v=3","gravatar_id":"","url":"https://api.github.com/users/mshinwell","html_url":"https://github.com/mshinwell","followers_url":"https://api.github.com/users/mshinwell/followers","following_url":"https://api.github.com/users/mshinwell/following{/other_user}","gists_url":"https://api.github.com/users/mshinwell/gists{/gist_id}","starred_url":"https://api.github.com/users/mshinwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mshinwell/subscriptions","organizations_url":"https://api.github.com/users/mshinwell/orgs","repos_url":"https://api.github.com/users/mshinwell/repos","events_url":"https://api.github.com/users/mshinwell/events{/privacy}","received_events_url":"https://api.github.com/users/mshinwell/received_events","type":"User","site_admin":false},"body":"This pull request deals with the addition of a new construction called \"phantom let\" to Flambda.  Phantom lets behave like normal lets except that they do not generate any code at runtime.  They are used as a way of encoding optimised-out parts of the program entirely within the language rather than using some kind of out-of-band mechanism.\r\n\r\nThis patch also adds support to Flambda for _provenance tracking_: identifying which variables in the Flambda code came from which variables (equipped with full module paths and locations of definitions) in the source program.  The tracking back to original `Ident.t` values is necessary so that their original stamps can be retrieved; these are used for lookup of types in `.cmt` files in libmonda.  The propagation of location information is required so that variables that do not have unique names can be properly disambiguated in the debugger.  This location information keeps track of inlined-out frames.\r\n\r\nIn order for it to compile this pull request has a couple of stubs on the Lambda side and a version of `Flambda_to_clambda` that does not deal with phantom lets.  This will be added via a subsequent pull request that adds support for them in Clambda and beyond.\r\n\r\nCode in this pull request scrapes Lambda expressions for location information.  It would probably be better in future to equip `Llet` with the necessary location information.  There will be another pull request coming in due course in this area, so let's save any discussion on this point for later.\r\n\r\nPhantom lets only permit certain kinds of defining expressions for simplicity.  @lpw25 suggested this might be a mistake (we may still gain more information about an optimised-out piece of code if it were subsequently inlined), but I think this should stay as-is for the moment.  It's probably actually good enough in any case.\r\n\r\nWhen the simplifier determines that a let binding is no longer required it will become eligible for phantomisation.  This uses both the structure of the redundant defining expression together with its approximation to try to construct a phantom let which will later be describable in DWARF.  The backend support permits the description in DWARF (using \"implicit pointers\") of structured values that have been optimised out even in the case where such values may reference values that were not optimised out.  For example, the structure of a pair may be described in the following manner: the pair was optimised out, but it had size 2 and tag 0, and its contents were the parameters `x` and `y` of the function, which may be found in some particular registers (also described).  At runtime, the debugger will reconstitute the structured value in the address space of the debugger (not the address space of the target program), and the libmonda library's value printers will be able to move seamlessly through the value, unaware that in fact part of it doesn't exist in the target program.\r\n\r\nOnce case that is not currently supported in the backend is the description of projections from variables known to represent blocks where those variables may in turn be phantom.  This problem, together with the fact that we end up generating aliases in the DWARF information between phantom lets (e.g `phantom_let x = y` where `y` is phantom), is planned to be solved in the future by making `Inline_and_simplify` simplify the defining expressions of phantom lets using the techniques it uses for normal lets.  This will eliminate aliases and enable us to avoid the case that is unsupported in the backend.  (The reason it is unsupported is due to restrictions in the DWARF language.)\r\n\r\nAlong the way this patch introduces a new module `Free_names` for tracking of the various free name sets that we now have.  There are some other minor cleanups (e.g. a record type for `Let_rec`).\r\n\r\n@chambart is on the hook to review this one :)","created_at":"2016-10-13T08:58:03Z","updated_at":"2016-10-13T08:58:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c9bda67b65b69dea8b6171cead442c232ad93581","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/ocaml/ocaml/milestones/5","html_url":"https://github.com/ocaml/ocaml/milestones/4.05-or-later","labels_url":"https://api.github.com/repos/ocaml/ocaml/milestones/5/labels","id":1628992,"number":5,"title":"4.05-or-later","description":"","creator":{"login":"damiendoligez","id":19104,"avatar_url":"https://avatars.githubusercontent.com/u/19104?v=3","gravatar_id":"","url":"https://api.github.com/users/damiendoligez","html_url":"https://github.com/damiendoligez","followers_url":"https://api.github.com/users/damiendoligez/followers","following_url":"https://api.github.com/users/damiendoligez/following{/other_user}","gists_url":"https://api.github.com/users/damiendoligez/gists{/gist_id}","starred_url":"https://api.github.com/users/damiendoligez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damiendoligez/subscriptions","organizations_url":"https://api.github.com/users/damiendoligez/orgs","repos_url":"https://api.github.com/users/damiendoligez/repos","events_url":"https://api.github.com/users/damiendoligez/events{/privacy}","received_events_url":"https://api.github.com/users/damiendoligez/received_events","type":"User","site_admin":false},"open_issues":20,"closed_issues":1,"state":"open","created_at":"2016-03-08T10:28:22Z","updated_at":"2016-10-13T08:58:03Z","due_on":"2017-01-15T23:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/ocaml/ocaml/pulls/855/commits","review_comments_url":"https://api.github.com/repos/ocaml/ocaml/pulls/855/comments","review_comment_url":"https://api.github.com/repos/ocaml/ocaml/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ocaml/ocaml/issues/855/comments","statuses_url":"https://api.github.com/repos/ocaml/ocaml/statuses/3750dae5e5aeeab1aa59150014d46fcc6cd8def0","head":{"label":"mshinwell:flambda_phantom","ref":"flambda_phantom","sha":"3750dae5e5aeeab1aa59150014d46fcc6cd8def0","user":{"login":"mshinwell","id":1315488,"avatar_url":"https://avatars.githubusercontent.com/u/1315488?v=3","gravatar_id":"","url":"https://api.github.com/users/mshinwell","html_url":"https://github.com/mshinwell","followers_url":"https://api.github.com/users/mshinwell/followers","following_url":"https://api.github.com/users/mshinwell/following{/other_user}","gists_url":"https://api.github.com/users/mshinwell/gists{/gist_id}","starred_url":"https://api.github.com/users/mshinwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mshinwell/subscriptions","organizations_url":"https://api.github.com/users/mshinwell/orgs","repos_url":"https://api.github.com/users/mshinwell/repos","events_url":"https://api.github.com/users/mshinwell/events{/privacy}","received_events_url":"https://api.github.com/users/mshinwell/received_events","type":"User","site_admin":false},"repo":{"id":8355887,"name":"ocaml","full_name":"mshinwell/ocaml","owner":{"login":"mshinwell","id":1315488,"avatar_url":"https://avatars.githubusercontent.com/u/1315488?v=3","gravatar_id":"","url":"https://api.github.com/users/mshinwell","html_url":"https://github.com/mshinwell","followers_url":"https://api.github.com/users/mshinwell/followers","following_url":"https://api.github.com/users/mshinwell/following{/other_user}","gists_url":"https://api.github.com/users/mshinwell/gists{/gist_id}","starred_url":"https://api.github.com/users/mshinwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mshinwell/subscriptions","organizations_url":"https://api.github.com/users/mshinwell/orgs","repos_url":"https://api.github.com/users/mshinwell/repos","events_url":"https://api.github.com/users/mshinwell/events{/privacy}","received_events_url":"https://api.github.com/users/mshinwell/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mshinwell/ocaml","description":"Read-only mirror of INRIA SVN","fork":true,"url":"https://api.github.com/repos/mshinwell/ocaml","forks_url":"https://api.github.com/repos/mshinwell/ocaml/forks","keys_url":"https://api.github.com/repos/mshinwell/ocaml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mshinwell/ocaml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mshinwell/ocaml/teams","hooks_url":"https://api.github.com/repos/mshinwell/ocaml/hooks","issue_events_url":"https://api.github.com/repos/mshinwell/ocaml/issues/events{/number}","events_url":"https://api.github.com/repos/mshinwell/ocaml/events","assignees_url":"https://api.github.com/repos/mshinwell/ocaml/assignees{/user}","branches_url":"https://api.github.com/repos/mshinwell/ocaml/branches{/branch}","tags_url":"https://api.github.com/repos/mshinwell/ocaml/tags","blobs_url":"https://api.github.com/repos/mshinwell/ocaml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mshinwell/ocaml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mshinwell/ocaml/git/refs{/sha}","trees_url":"https://api.github.com/repos/mshinwell/ocaml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mshinwell/ocaml/statuses/{sha}","languages_url":"https://api.github.com/repos/mshinwell/ocaml/languages","stargazers_url":"https://api.github.com/repos/mshinwell/ocaml/stargazers","contributors_url":"https://api.github.com/repos/mshinwell/ocaml/contributors","subscribers_url":"https://api.github.com/repos/mshinwell/ocaml/subscribers","subscription_url":"https://api.github.com/repos/mshinwell/ocaml/subscription","commits_url":"https://api.github.com/repos/mshinwell/ocaml/commits{/sha}","git_commits_url":"https://api.github.com/repos/mshinwell/ocaml/git/commits{/sha}","comments_url":"https://api.github.com/repos/mshinwell/ocaml/comments{/number}","issue_comment_url":"https://api.github.com/repos/mshinwell/ocaml/issues/comments{/number}","contents_url":"https://api.github.com/repos/mshinwell/ocaml/contents/{+path}","compare_url":"https://api.github.com/repos/mshinwell/ocaml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mshinwell/ocaml/merges","archive_url":"https://api.github.com/repos/mshinwell/ocaml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mshinwell/ocaml/downloads","issues_url":"https://api.github.com/repos/mshinwell/ocaml/issues{/number}","pulls_url":"https://api.github.com/repos/mshinwell/ocaml/pulls{/number}","milestones_url":"https://api.github.com/repos/mshinwell/ocaml/milestones{/number}","notifications_url":"https://api.github.com/repos/mshinwell/ocaml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mshinwell/ocaml/labels{/name}","releases_url":"https://api.github.com/repos/mshinwell/ocaml/releases{/id}","deployments_url":"https://api.github.com/repos/mshinwell/ocaml/deployments","created_at":"2013-02-22T11:07:50Z","updated_at":"2016-10-04T11:00:55Z","pushed_at":"2016-10-13T08:41:35Z","git_url":"git://github.com/mshinwell/ocaml.git","ssh_url":"git@github.com:mshinwell/ocaml.git","clone_url":"https://github.com/mshinwell/ocaml.git","svn_url":"https://github.com/mshinwell/ocaml","homepage":null,"size":223761,"stargazers_count":3,"watchers_count":3,"language":"OCaml","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":3,"default_branch":"trunk"}},"base":{"label":"ocaml:trunk","ref":"trunk","sha":"9b08f083e31c5cff56e2b1ec21654c2e5c45a56f","user":{"login":"ocaml","id":1841483,"avatar_url":"https://avatars.githubusercontent.com/u/1841483?v=3","gravatar_id":"","url":"https://api.github.com/users/ocaml","html_url":"https://github.com/ocaml","followers_url":"https://api.github.com/users/ocaml/followers","following_url":"https://api.github.com/users/ocaml/following{/other_user}","gists_url":"https://api.github.com/users/ocaml/gists{/gist_id}","starred_url":"https://api.github.com/users/ocaml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocaml/subscriptions","organizations_url":"https://api.github.com/users/ocaml/orgs","repos_url":"https://api.github.com/users/ocaml/repos","events_url":"https://api.github.com/users/ocaml/events{/privacy}","received_events_url":"https://api.github.com/users/ocaml/received_events","type":"Organization","site_admin":false},"repo":{"id":6786166,"name":"ocaml","full_name":"ocaml/ocaml","owner":{"login":"ocaml","id":1841483,"avatar_url":"https://avatars.githubusercontent.com/u/1841483?v=3","gravatar_id":"","url":"https://api.github.com/users/ocaml","html_url":"https://github.com/ocaml","followers_url":"https://api.github.com/users/ocaml/followers","following_url":"https://api.github.com/users/ocaml/following{/other_user}","gists_url":"https://api.github.com/users/ocaml/gists{/gist_id}","starred_url":"https://api.github.com/users/ocaml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocaml/subscriptions","organizations_url":"https://api.github.com/users/ocaml/orgs","repos_url":"https://api.github.com/users/ocaml/repos","events_url":"https://api.github.com/users/ocaml/events{/privacy}","received_events_url":"https://api.github.com/users/ocaml/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ocaml/ocaml","description":"The core OCaml system: compilers, runtime system, base libraries","fork":false,"url":"https://api.github.com/repos/ocaml/ocaml","forks_url":"https://api.github.com/repos/ocaml/ocaml/forks","keys_url":"https://api.github.com/repos/ocaml/ocaml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ocaml/ocaml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ocaml/ocaml/teams","hooks_url":"https://api.github.com/repos/ocaml/ocaml/hooks","issue_events_url":"https://api.github.com/repos/ocaml/ocaml/issues/events{/number}","events_url":"https://api.github.com/repos/ocaml/ocaml/events","assignees_url":"https://api.github.com/repos/ocaml/ocaml/assignees{/user}","branches_url":"https://api.github.com/repos/ocaml/ocaml/branches{/branch}","tags_url":"https://api.github.com/repos/ocaml/ocaml/tags","blobs_url":"https://api.github.com/repos/ocaml/ocaml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ocaml/ocaml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ocaml/ocaml/git/refs{/sha}","trees_url":"https://api.github.com/repos/ocaml/ocaml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ocaml/ocaml/statuses/{sha}","languages_url":"https://api.github.com/repos/ocaml/ocaml/languages","stargazers_url":"https://api.github.com/repos/ocaml/ocaml/stargazers","contributors_url":"https://api.github.com/repos/ocaml/ocaml/contributors","subscribers_url":"https://api.github.com/repos/ocaml/ocaml/subscribers","subscription_url":"https://api.github.com/repos/ocaml/ocaml/subscription","commits_url":"https://api.github.com/repos/ocaml/ocaml/commits{/sha}","git_commits_url":"https://api.github.com/repos/ocaml/ocaml/git/commits{/sha}","comments_url":"https://api.github.com/repos/ocaml/ocaml/comments{/number}","issue_comment_url":"https://api.github.com/repos/ocaml/ocaml/issues/comments{/number}","contents_url":"https://api.github.com/repos/ocaml/ocaml/contents/{+path}","compare_url":"https://api.github.com/repos/ocaml/ocaml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ocaml/ocaml/merges","archive_url":"https://api.github.com/repos/ocaml/ocaml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ocaml/ocaml/downloads","issues_url":"https://api.github.com/repos/ocaml/ocaml/issues{/number}","pulls_url":"https://api.github.com/repos/ocaml/ocaml/pulls{/number}","milestones_url":"https://api.github.com/repos/ocaml/ocaml/milestones{/number}","notifications_url":"https://api.github.com/repos/ocaml/ocaml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ocaml/ocaml/labels{/name}","releases_url":"https://api.github.com/repos/ocaml/ocaml/releases{/id}","deployments_url":"https://api.github.com/repos/ocaml/ocaml/deployments","created_at":"2012-11-20T22:18:22Z","updated_at":"2016-10-13T04:22:37Z","pushed_at":"2016-10-13T08:58:03Z","git_url":"git://github.com/ocaml/ocaml.git","ssh_url":"git@github.com:ocaml/ocaml.git","clone_url":"https://github.com/ocaml/ocaml.git","svn_url":"https://github.com/ocaml/ocaml","homepage":"","size":251256,"stargazers_count":959,"watchers_count":959,"language":"OCaml","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":294,"mirror_url":null,"open_issues_count":146,"forks":294,"open_issues":146,"watchers":959,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/ocaml/ocaml/pulls/855"},"html":{"href":"https://github.com/ocaml/ocaml/pull/855"},"issue":{"href":"https://api.github.com/repos/ocaml/ocaml/issues/855"},"comments":{"href":"https://api.github.com/repos/ocaml/ocaml/issues/855/comments"},"review_comments":{"href":"https://api.github.com/repos/ocaml/ocaml/pulls/855/comments"},"review_comment":{"href":"https://api.github.com/repos/ocaml/ocaml/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ocaml/ocaml/pulls/855/commits"},"statuses":{"href":"https://api.github.com/repos/ocaml/ocaml/statuses/3750dae5e5aeeab1aa59150014d46fcc6cd8def0"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":2822,"deletions":1119,"changed_files":52}}
{"actor":{"display_login":"mshinwell"}}