Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign uptrans: Move rust_try into the compiler #27176
Conversation
rust-highfive
assigned
pcwalton
Jul 21, 2015
This comment has been minimized.
This comment has been minimized.
|
r? @pcwalton (rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
|
r? @brson cc @rust-lang/compiler (my knowledge of trans is pretty bad and I may have done egregious things) |
rust-highfive
assigned
brson
and unassigned
pcwalton
Jul 21, 2015
Aatch
reviewed
Jul 21, 2015
| } | ||
|
|
||
| // MSVC's definition of the `rust_try` function. The exact implementation here | ||
| // is a little different than the GNU (standard) version below, not ony because |
This comment has been minimized.
This comment has been minimized.
alexcrichton
force-pushed the
alexcrichton:fix-stock-llvm
branch
2 times, most recently
from
51016bd
to
6046fb7
Jul 21, 2015
This comment has been minimized.
This comment has been minimized.
|
@bors r+ |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
Awesome patch. |
alexcrichton
force-pushed the
alexcrichton:fix-stock-llvm
branch
4 times, most recently
from
825860c
to
970a3ca
Jul 21, 2015
This comment has been minimized.
This comment has been minimized.
|
@bors: r=brson |
This comment has been minimized.
This comment has been minimized.
|
|
nagisa
reviewed
Jul 21, 2015
| false); | ||
|
|
||
| // Define the "inner try" shim | ||
| let rust_try_inner = declare::declare_internal_rust_fn(ccx, |
This comment has been minimized.
This comment has been minimized.
nagisa
Jul 21, 2015
Contributor
If you are “defining” the shim, declare::define_internal_rust_fn should be used.
nagisa
reviewed
Jul 21, 2015
| }); | ||
|
|
||
| // Define the "outer try" shim. | ||
| let rust_try = declare::declare_internal_rust_fn(ccx, "__rust_try", |
This comment has been minimized.
This comment has been minimized.
nagisa
reviewed
Jul 21, 2015
| @@ -120,7 +120,8 @@ extern "C" void LLVMAddDereferenceableCallSiteAttr(LLVMValueRef Instr, unsigned | |||
| idx, B))); | |||
| } | |||
|
|
|||
| extern "C" void LLVMAddFunctionAttribute(LLVMValueRef Fn, unsigned index, uint64_t Val) { | |||
| extern "C" void LLVMAddFunctionAttribute(LLVMValueRef Fn, unsigned index, | |||
This comment has been minimized.
This comment has been minimized.
alexcrichton
force-pushed the
alexcrichton:fix-stock-llvm
branch
from
970a3ca
to
c35b2bd
Jul 21, 2015
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Jul 22, 2015
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
@bors: retry On Tue, Jul 21, 2015 at 9:19 PM, bors notifications@github.com wrote:
|
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Jul 22, 2015
This comment has been minimized.
This comment has been minimized.
bors
merged commit c35b2bd
into
rust-lang:master
Jul 22, 2015
This was referenced Jul 22, 2015
alexcrichton
deleted the
alexcrichton:fix-stock-llvm
branch
Jul 22, 2015
This comment has been minimized.
This comment has been minimized.
|
:( |
This comment has been minimized.
This comment has been minimized.
|
In theory, yes, but that still requires the standard library to have |
This comment has been minimized.
This comment has been minimized.
I am not sure I understand this point. Didn't My concern with the new way is that:
|
This comment has been minimized.
This comment has been minimized.
|
(sorry for jumping in late - I was not aware of this change until bors told me that my PR collided with this one) |
This comment has been minimized.
This comment has been minimized.
Ah by this I just mean that the tool The other shims and such in
I don't disagree with this!
I'm not quite sure I follow this. Is this basically saying that it's easier to edit IR than it is to edit the compiler?
No worries! |
This comment has been minimized.
This comment has been minimized.
I meant that as a library function in rustrt_native, it could have been overridden. Not so much with it as compiler intrinsic. |
This comment has been minimized.
This comment has been minimized.
|
How do you override something in a native library? You mean avoiding The ABI of unwinding is very closely tied to the compiler itself, so even though it could be implemented in various locations it kinda makes sense to me to implement this as an intrinsic so the compiler has complete control over all ABI possibilities. |
This comment has been minimized.
This comment has been minimized.
I meant that when building rustrt_native for a new target, you could write a custom rust_try. |
This comment has been minimized.
This comment has been minimized.
|
That's true, but do you know if that's done often? From what I've seen the |
This comment has been minimized.
This comment has been minimized.
|
Was it known that this would break unwinding entirely on Individual |
This comment has been minimized.
This comment has been minimized.
|
Actually, scratch that, it's because the snapshot compiler doesn't have the |
This comment has been minimized.
This comment has been minimized.
|
@eddyb yes this was known. |
alexcrichton commentedJul 21, 2015
This commit moves the IR files in the distribution, rust_try.ll,
rust_try_msvc_64.ll, and rust_try_msvc_32.ll into the compiler from the main
distribution. There's a few reasons for this change:
have these files build across many LLVM versions simultaneously. We'll likely
want to retain this ability for quite some time into the future.
itself, so it makes sense to fold it into a location which can do more
platform-specific checks for various implementation details (such as MSVC 32
vs 64-bit).
end up becoming very useful if we move towards building the standard library
with Cargo.
In the immediate future, however, this commit should restore compatibility with
LLVM 3.5 and 3.6.