-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specify unwinding #638
Specify unwinding #638
Conversation
unsafe when used incorrectly) can be used to mark functions as specifically not unwinding. This is | ||
primarily for performance reasons in cases where the function cannot be inferred to not unwind. The | ||
primary use case for this attribute is the `oom` function that aborts the process in the case of a | ||
out-of-memory condition. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, I think I remember hearing that code size benefited from this change, do you have some examples or numbers that this could cite to show the benefits that it reaps?
cc me |
Instead of The semantics of
Because |
@dgrunwald I think that the In general the semantics of @Aatch could you update this RFC with some of the feedback in this thread? There hasn't been much discussion on this but I think that it may be ready for merging soon. |
AFAIK the only optimizations that For example, I'd expect that With my I was under the impression that this corresponds to the Example:
When the index 5 is out-of-range, by my |
Back to the main part of the RFC: catching panics and converting them to error codes. The mechanism suggested by this RFC is unsafe, because catching panics is unsafe in the presence of TLS. Moreover, one cannot easily wrap the mechanism behind a safe API, because reasoning about the safety requires global knowledge about the usage of TLS in the program. In my mind, this makes the |
@dgrunwald Why would |
@carllerche if you can assume a lack of panic, all panics become unreachable markers. And bounds check failures panic. As a result, the compiler is able to assume that all of the bounds checks succeed. As to |
This was one of the points you mentioned for |
I had hoped that it would be possible to get the unwinding implementation to abort the process when a function is marked in some way in the unwinding tables (or even simpler: if the function is not present in the unwinding tables). Unfortunately it looks like LLVM has no good way to do this, and indeed needs a try/catch block: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-May/036960.html |
ping @alexcrichton |
Unassigning myself as I believe this has now moved under the T-lang umbrella |
We discussed this RFC today in the language subteam meeting, and decided that it ought to be closed in favor of RFC #1236, which covered roughly the same ground. Thanks @Aatch nonetheless. There are also a few bits in here that may be worth pulling out for a later RFC, such as the annotations for functions that govern whether landing pads are created or not. |
Specifies behaviour around unwinding. Especially with respect to non-Rust code.
Rendered