{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/11714","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/11714/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/11714/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/11714/events","html_url":"https://github.com/JuliaLang/julia/issues/11714","id":88490674,"number":11714,"title":"conservative stack scanning?","user":{"login":"StefanKarpinski","id":153596,"avatar_url":"https://avatars.githubusercontent.com/u/153596?v=3","gravatar_id":"","url":"https://api.github.com/users/StefanKarpinski","html_url":"https://github.com/StefanKarpinski","followers_url":"https://api.github.com/users/StefanKarpinski/followers","following_url":"https://api.github.com/users/StefanKarpinski/following{/other_user}","gists_url":"https://api.github.com/users/StefanKarpinski/gists{/gist_id}","starred_url":"https://api.github.com/users/StefanKarpinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StefanKarpinski/subscriptions","organizations_url":"https://api.github.com/users/StefanKarpinski/orgs","repos_url":"https://api.github.com/users/StefanKarpinski/repos","events_url":"https://api.github.com/users/StefanKarpinski/events{/privacy}","received_events_url":"https://api.github.com/users/StefanKarpinski/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JuliaLang/julia/labels/decision","name":"decision","color":"F08000"},{"url":"https://api.github.com/repos/JuliaLang/julia/labels/GC","name":"GC","color":"009800"},{"url":"https://api.github.com/repos/JuliaLang/julia/labels/performance","name":"performance","color":"d7e102"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":34,"created_at":"2015-06-15T17:32:13Z","updated_at":"2015-07-02T15:58:27Z","closed_at":null,"body":"Instead of maintaining our own GC stack frames – which is slow and easy to mess up, likely accounting for a large portion of our tough-to-track-down core Julia bugs in the past years – we've occasionally talked about doing conservative stack scanning. That is, scanning the stack and conservatively assuming that anything that happens to look like a pointer to a valid heap-allocated Julia object actually is.\r\n\r\n##### Pros:\r\n\r\n- much simpler\r\n- faster (https://github.com/JuliaLang/julia/pull/11508, https://github.com/JuliaLang/julia/pull/11284)\r\n- makes stack allocation much easier (https://github.com/JuliaLang/julia/pull/8134)\r\n- immutables with references trivially become as efficient as reference-free immutables\r\n- fewer segfaults\r\n\r\n##### Cons:\r\n\r\n- might retain objects that should be freed\r\n- pointers passed into C code could still expect objects to live but not point to the head of the object\r\n- performance of stack scanning\r\n\r\nThe second con seems like it can be avoided with the same kind of rooting we do now, except only needed at the ccall entry point. The chances of the first con happening – i.e. random values in the stack pointing valid heap objects – seems pretty slim. There might be situations like when you take a pointer to an array and then use it – but in that case you probably *want* the array to remain rooted while someone has a pointer to it. Are there other potential cons that I'm not seeing?\r\n\r\nRelated: https://github.com/JuliaLang/julia/pull/10725, https://github.com/JuliaLang/julia/issues/10317.\r\n\r\ncc: @carnaval, @vtjnash, @JeffBezanson "},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/118077111","html_url":"https://github.com/JuliaLang/julia/issues/11714#issuecomment-118077111","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/11714","id":118077111,"user":{"login":"carnaval","id":5307791,"avatar_url":"https://avatars.githubusercontent.com/u/5307791?v=3","gravatar_id":"","url":"https://api.github.com/users/carnaval","html_url":"https://github.com/carnaval","followers_url":"https://api.github.com/users/carnaval/followers","following_url":"https://api.github.com/users/carnaval/following{/other_user}","gists_url":"https://api.github.com/users/carnaval/gists{/gist_id}","starred_url":"https://api.github.com/users/carnaval/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carnaval/subscriptions","organizations_url":"https://api.github.com/users/carnaval/orgs","repos_url":"https://api.github.com/users/carnaval/repos","events_url":"https://api.github.com/users/carnaval/events{/privacy}","received_events_url":"https://api.github.com/users/carnaval/received_events","type":"User","site_admin":false},"created_at":"2015-07-02T15:58:27Z","updated_at":"2015-07-02T15:58:27Z","body":"Just so that we don't forget : @vtjnash stumbled upon the dual stack (\"safe stack\") support in LLVM while scrolling LangRef. We could hack this to have it use the safe stack only for gc pointers (and spills of gc pointers in registers) so that we have a conservative scanner which is almost not conservative. Don't know how crazy this is."}}