{"action":"created","issue":{"url":"https://api.github.com/repos/ldc-developers/ldc/issues/1577","repository_url":"https://api.github.com/repos/ldc-developers/ldc","labels_url":"https://api.github.com/repos/ldc-developers/ldc/issues/1577/labels{/name}","comments_url":"https://api.github.com/repos/ldc-developers/ldc/issues/1577/comments","events_url":"https://api.github.com/repos/ldc-developers/ldc/issues/1577/events","html_url":"https://github.com/ldc-developers/ldc/pull/1577","id":161740686,"number":1577,"title":"Implement cross-module inlining","user":{"login":"JohanEngelen","id":10983051,"avatar_url":"https://avatars.githubusercontent.com/u/10983051?v=3","gravatar_id":"","url":"https://api.github.com/users/JohanEngelen","html_url":"https://github.com/JohanEngelen","followers_url":"https://api.github.com/users/JohanEngelen/followers","following_url":"https://api.github.com/users/JohanEngelen/following{/other_user}","gists_url":"https://api.github.com/users/JohanEngelen/gists{/gist_id}","starred_url":"https://api.github.com/users/JohanEngelen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohanEngelen/subscriptions","organizations_url":"https://api.github.com/users/JohanEngelen/orgs","repos_url":"https://api.github.com/users/JohanEngelen/repos","events_url":"https://api.github.com/users/JohanEngelen/events{/privacy}","received_events_url":"https://api.github.com/users/JohanEngelen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-06-22T17:28:11Z","updated_at":"2016-07-02T15:10:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ldc-developers/ldc/pulls/1577","html_url":"https://github.com/ldc-developers/ldc/pull/1577","diff_url":"https://github.com/ldc-developers/ldc/pull/1577.diff","patch_url":"https://github.com/ldc-developers/ldc/pull/1577.patch"},"body":"An \"inlined\" function will be defined with the LLVM attribute `available_externally`, so that LLVM can decide to actually inline the function or not.\r\n\r\n`pragma(inline, false)` --> the function receives the `noinline` attribute.\r\n`pragma(inline, true)`  --> the function receives the `alwaysinline` attribute and cross-module inlining for this function is performed even at `-O0`.\r\n\r\nThe current heuristic for (defining available_externally functions to enable) inlining functions is: `true`  :-)\r\nVery aggressive indeed; good for testing :). Perhaps a simple statement count heuristic can be used . \r\n\r\nFunctions that have `__FILE__` as default _template_ parameter need to always be inlined `pragma(inline, true)`, otherwise it results in link errors. See the forum discussion:\r\nhttps://forum.dlang.org/thread/induraqegvpyomvzxwmf@forum.dlang.org\r\n\r\nTo inline a function, semantic analysis needs to be completed for that function (DMD does the same). Doing that however, may add new symbols to the module member list for codegenning. This means that the order of how modules are codegenned needs to be reversed (or, members[0] needs to be codegenned last, as that one receives all new symbols). This showed up while testing Weka's codebase and cost me a lot of time. Unfortunately, I have not managed to recreate this problem in a testcase.\r\n\r\nTested succesfully on Weka's codebase."},"comment":{"url":"https://api.github.com/repos/ldc-developers/ldc/issues/comments/230106346","html_url":"https://github.com/ldc-developers/ldc/pull/1577#issuecomment-230106346","issue_url":"https://api.github.com/repos/ldc-developers/ldc/issues/1577","id":230106346,"user":{"login":"JohanEngelen","id":10983051,"avatar_url":"https://avatars.githubusercontent.com/u/10983051?v=3","gravatar_id":"","url":"https://api.github.com/users/JohanEngelen","html_url":"https://github.com/JohanEngelen","followers_url":"https://api.github.com/users/JohanEngelen/followers","following_url":"https://api.github.com/users/JohanEngelen/following{/other_user}","gists_url":"https://api.github.com/users/JohanEngelen/gists{/gist_id}","starred_url":"https://api.github.com/users/JohanEngelen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohanEngelen/subscriptions","organizations_url":"https://api.github.com/users/JohanEngelen/orgs","repos_url":"https://api.github.com/users/JohanEngelen/repos","events_url":"https://api.github.com/users/JohanEngelen/events{/privacy}","received_events_url":"https://api.github.com/users/JohanEngelen/received_events","type":"User","site_admin":false},"created_at":"2016-07-02T15:10:15Z","updated_at":"2016-07-02T15:10:15Z","body":"no more \"WIP\" ! :)"}}
{"actor":{"display_login":"JohanEngelen"}}