{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/34786","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/34786/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/34786/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/34786/events","html_url":"https://github.com/rust-lang/rust/issues/34786","id":165136394,"number":34786,"title":"Use only one personality function instead of 2 on Unix","user":{"login":"alexcrichton","id":64996,"avatar_url":"https://avatars.githubusercontent.com/u/64996?v=3","gravatar_id":"","url":"https://api.github.com/users/alexcrichton","html_url":"https://github.com/alexcrichton","followers_url":"https://api.github.com/users/alexcrichton/followers","following_url":"https://api.github.com/users/alexcrichton/following{/other_user}","gists_url":"https://api.github.com/users/alexcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcrichton/subscriptions","organizations_url":"https://api.github.com/users/alexcrichton/orgs","repos_url":"https://api.github.com/users/alexcrichton/repos","events_url":"https://api.github.com/users/alexcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/alexcrichton/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-12T17:38:23Z","updated_at":"2016-07-12T19:47:22Z","closed_at":null,"body":"Right now we have two personality functions:\r\n\r\n* `rust_eh_personality`\r\n* `rust_eh_personality_catch`\r\n\r\nThe rationale is described in length [here](https://github.com/rust-lang/rust/blob/3085ec78487712ed77a506d9cba8d69cd3a44684/src/libpanic_unwind/gcc.rs#L11), but the gist is that we're currently \"too lazy\" to parse DWARF metadata, so we use `rust_eh_personality` for \"all Rust functions in the world\" and `rust_eh_personality_catch` for the one function allowed to catch a panic. The former personality simply runs all cleanups, and the latter personality simply catches all Rust exceptions.\r\n\r\nThis split makes it easy for us to define, but when a personality is run it should also have access to DWARF metadata about the call site it's running for. This metadata *should* indicate whether it's intended to catch or not, so we should in theory be able to read out the DWARF metadata and figure out what to do, allowing us to have one personality function instead of two.\r\n\r\nThe major downside of having two personality functions is that LLVM is unable to inline two functions that have different personalities. This unfortunately means that `catch_unwind` can have [performance problems](https://github.com/rust-lang/rust/issues/34727) if we don't inline enough. We're currently using zero-cost exceptions on Unix, but what we're actually doing unfortunately isn't zero cost!\r\n\r\nThis is only one piece of the puzzle towards fixing the [performance issues mentioned](https://github.com/rust-lang/rust/issues/34727), but it's an important one!\r\n\r\ncc @vadimcn "},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/232158171","html_url":"https://github.com/rust-lang/rust/issues/34786#issuecomment-232158171","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/34786","id":232158171,"user":{"login":"alexcrichton","id":64996,"avatar_url":"https://avatars.githubusercontent.com/u/64996?v=3","gravatar_id":"","url":"https://api.github.com/users/alexcrichton","html_url":"https://github.com/alexcrichton","followers_url":"https://api.github.com/users/alexcrichton/followers","following_url":"https://api.github.com/users/alexcrichton/following{/other_user}","gists_url":"https://api.github.com/users/alexcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcrichton/subscriptions","organizations_url":"https://api.github.com/users/alexcrichton/orgs","repos_url":"https://api.github.com/users/alexcrichton/repos","events_url":"https://api.github.com/users/alexcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/alexcrichton/received_events","type":"User","site_admin":false},"created_at":"2016-07-12T19:47:22Z","updated_at":"2016-07-12T19:47:22Z","body":"I think it'd be also fine to slowly bring platforms online with this strategy, for example we could test it out on 64-bit Linux first and then start doing the same change for other platforms and architectures."}}
{"actor":{"display_login":"alexcrichton"}}