Skip to content

Commit 8b31a70

Browse files
committed
---
yaml --- r: 223612 b: refs/heads/beta c: 3e26e56 h: refs/heads/master v: v3
1 parent 6eb4e9d commit 8b31a70

File tree

4 files changed

+58
-7
lines changed

4 files changed

+58
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 83ee47b054deb5939be20d7d6ce03ad33d005424
26+
refs/heads/beta: 3e26e56a79ae33dfc8f2f4d0123b5080fd0a7853
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 938f5d7af401e2d8238522fed4a612943b6e77fd
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/librustc_trans/trans/base.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,14 @@ pub fn invoke<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
752752

753753
pub fn need_invoke(bcx: Block) -> bool {
754754
if bcx.sess().no_landing_pads() {
755-
return false;
755+
return false
756+
}
757+
758+
// Currently 32-bit MSVC unwinding is not super well implemented in LLVM, so
759+
// we avoid it entirely.
760+
if bcx.sess().target.target.options.is_like_msvc &&
761+
bcx.sess().target.target.arch == "x86" {
762+
return false
756763
}
757764

758765
// Avoid using invoke if we are already inside a landing pad.

branches/beta/src/librustc_trans/trans/cleanup.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -851,8 +851,8 @@ impl<'blk, 'tcx> CleanupHelperMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx
851851
// an "exception", but for MSVC we want to force SEH. This means that we
852852
// can't actually have the personality function be our standard
853853
// `rust_eh_personality` function, but rather we wired it up to the
854-
// CRT's custom `__C_specific_handler` personality funciton, which
855-
// forces LLVM to consider landing pads as "landing pads for SEH".
854+
// CRT's custom personality function, which forces LLVM to consider
855+
// landing pads as "landing pads for SEH".
856856
let target = &self.ccx.sess().target.target;
857857
let llpersonality = match pad_bcx.tcx().lang_items.eh_personality() {
858858
Some(def_id) if !target.options.is_like_msvc => {
@@ -864,10 +864,12 @@ impl<'blk, 'tcx> CleanupHelperMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx
864864
match *personality {
865865
Some(llpersonality) => llpersonality,
866866
None => {
867-
let name = if target.options.is_like_msvc {
868-
"__C_specific_handler"
869-
} else {
867+
let name = if !target.options.is_like_msvc {
870868
"rust_eh_personality"
869+
} else if target.arch == "x86" {
870+
"_except_handler3"
871+
} else {
872+
"__C_specific_handler"
871873
};
872874
let fty = Type::variadic_func(&[], &Type::i32(self.ccx));
873875
let f = declare::declare_cfn(self.ccx, name, fty,
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
; Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
; file at the top-level directory of this distribution and at
3+
; http://rust-lang.org/COPYRIGHT.
4+
;
5+
; Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
; http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
; <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
; option. This file may not be copied, modified, or distributed
9+
; except according to those terms.
10+
11+
; For more comments about what's going on here see rust_try_msvc_64.ll. The only
12+
; difference between that and this file is the personality function used as it's
13+
; different for 32-bit MSVC than it is for 64-bit.
14+
15+
define i8* @rust_try(void (i8*)* %f, i8* %env)
16+
personality i8* bitcast (i32 (...)* @_except_handler3 to i8*)
17+
{
18+
invoke void %f(i8* %env)
19+
to label %normal
20+
unwind label %catch
21+
22+
normal:
23+
ret i8* null
24+
catch:
25+
%vals = landingpad { i8*, i32 }
26+
catch i8* bitcast (i32 (i8*, i8*)* @__rust_try_filter to i8*)
27+
%ehptr = extractvalue { i8*, i32 } %vals, 0
28+
%sel = extractvalue { i8*, i32 } %vals, 1
29+
%filter_sel = call i32 @llvm.eh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @__rust_try_filter to i8*))
30+
%is_filter = icmp eq i32 %sel, %filter_sel
31+
br i1 %is_filter, label %catch-return, label %catch-resume
32+
33+
catch-return:
34+
ret i8* %ehptr
35+
36+
catch-resume:
37+
resume { i8*, i32 } %vals
38+
}
39+
40+
declare i32 @_except_handler3(...)
41+
declare i32 @__rust_try_filter(i8*, i8*)
42+
declare i32 @llvm.eh.typeid.for(i8*) readnone nounwind

0 commit comments

Comments
 (0)