-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Open code the __fastfail intrinsic for rtabort! on windows #33814
Conversation
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
033d005
to
ac8b0ea
Compare
cc @retep998 |
// debateable; see https://github.com/rust-lang/rust/pull/31519 for details. | ||
#[cfg(not(unix))] | ||
// On windows, use the processor-specific __fastfail mechanism | ||
// https://msdn.microsoft.com/en-us/library/dn774154.aspx |
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.
Could this elaborate on why we're using this? For example mention that exception handlers are removed and such, and also that on Windows 7 and prior we do not see this behavior but it largely equates to the same semantics.
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.
Added an expanded explanation.
ac8b0ea
to
368e84f
Compare
As described https://msdn.microsoft.com/en-us/library/dn774154.aspx This is a Windows 8+ mechanism for terminating the process quickly, which degrades to either an access violation or bugcheck in older versions. I'm not sure this is better the the current mechanism of terminating with an illegal instruction, but we recently converted unix to terminate more correctly with SIGABORT, and this *seems* more correct for windows. [breaking-change]
368e84f
to
696a570
Compare
What does "open code" mean, btw? Is it a synonym for "hard code"? |
Open-code is compiler terminology for directly generating the instructions to perform a primitive operation rather than calling a function to do so. See this exercise in SICP for example. I think "inline the assembly" might be a better translation than "hard code". |
⌛ Testing commit 696a570 with merge 13dbf51... |
💔 Test failed - auto-win-gnu-32-opt-rustbuild |
Again with the spurious failure due to arguments to Command being too long. @alexcrichton Should I submit a PR that makes rustc print out the linker arguments whenever it hits error 206 on Windows? |
⌛ Testing commit 696a570 with merge 2ec427b... |
💔 Test failed - auto-linux-64-cross-netbsd |
Test failure is #33778 |
@bors: retry On Tue, May 31, 2016 at 3:28 AM, Peter Atashian notifications@github.com
|
⌛ Testing commit 696a570 with merge a287eec... |
💔 Test failed - auto-linux-64-opt-rustbuild |
@bors: retry |
⌛ Testing commit 696a570 with merge 42fcc92... |
⛄ The build was interrupted to prioritize another pull request. |
⌛ Testing commit 696a570 with merge 7161ade... |
⛄ The build was interrupted to prioritize another pull request. |
Open code the __fastfail intrinsic for rtabort! on windows As described https://msdn.microsoft.com/en-us/library/dn774154.aspx This is a Windows 8+ mechanism for terminating the process quickly, which degrades to either an access violation or bugcheck in older versions. I'm not sure this is better the the current mechanism of terminating with an illegal instruction, but we recently converted unix to terminate more correctly with SIGABORT, and this *seems* more correct for windows. [breaking-change]
In Windows 7 this is just a regular continuable exception, so it can be catched, suppressed or recovered (for example, by SEH/VEH directly or undirectly). |
@pravic The previous solution of generating an illegal instruction exception was also a regular continuable exception, so there is no regression here on Windows 7, but there is an improvement on newer versions. |
So why not to raise a noncontinuable exception? Or no. Why not to reuse the ucrt behavior? Looks hastily. |
@pravic By all means feel free to submit a PR that raises a noncontinuable exception on Windows 7 and older. This PR does not prevent such a change being made later on, and is simply a step in the right direction. |
As described https://msdn.microsoft.com/en-us/library/dn774154.aspx
This is a Windows 8+ mechanism for terminating the process quickly,
which degrades to either an access violation or bugcheck in older versions.
I'm not sure this is better the the current mechanism of terminating
with an illegal instruction, but we recently converted unix to
terminate more correctly with SIGABORT, and this seems more correct
for windows.
[breaking-change]