Skip to content

Commit 458d2ff

Browse files
committed
Be a bit more cautious about marking things no-throw.
1 parent 753b683 commit 458d2ff

File tree

2 files changed

+26
-23
lines changed

2 files changed

+26
-23
lines changed

src/rustc/back/upcall.rs

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,10 @@ fn declare_upcalls(targ_cfg: @session::config,
3838
let mut arg_tys: [TypeRef] = [];
3939
for tys.each {|t| arg_tys += [t]; }
4040
let fn_ty = T_fn(arg_tys, rv);
41-
let f = base::decl_cdecl_fn(llmod, prefix + name, fn_ty);
42-
if name != "fail" {
43-
base::set_no_unwind(f);
44-
}
45-
ret f;
41+
ret base::decl_cdecl_fn(llmod, prefix + name, fn_ty);
42+
}
43+
fn nothrow(f: ValueRef) -> ValueRef {
44+
base::set_no_unwind(f); f
4645
}
4746
let d = bind decl(llmod, "upcall_", _, _, _);
4847
let dv = bind decl(llmod, "upcall_", _, _, T_void());
@@ -55,35 +54,42 @@ fn declare_upcalls(targ_cfg: @session::config,
5554
T_ptr(T_i8()),
5655
size_t]),
5756
malloc:
58-
d("malloc", [T_ptr(tydesc_type)], T_ptr(T_i8())),
57+
nothrow(d("malloc", [T_ptr(tydesc_type)],
58+
T_ptr(T_i8()))),
5959
free:
60-
dv("free", [T_ptr(T_i8())]),
60+
nothrow(dv("free", [T_ptr(T_i8())])),
6161
validate_box:
62-
dv("validate_box", [T_ptr(T_i8())]),
62+
nothrow(dv("validate_box", [T_ptr(T_i8())])),
6363
shared_malloc:
64-
d("shared_malloc", [size_t], T_ptr(T_i8())),
64+
nothrow(d("shared_malloc", [size_t], T_ptr(T_i8()))),
6565
shared_free:
66-
dv("shared_free", [T_ptr(T_i8())]),
66+
nothrow(dv("shared_free", [T_ptr(T_i8())])),
6767
shared_realloc:
68-
d("shared_realloc", [T_ptr(T_i8()), size_t], T_ptr(T_i8())),
68+
nothrow(d("shared_realloc", [T_ptr(T_i8()), size_t],
69+
T_ptr(T_i8()))),
6970
mark:
7071
d("mark", [T_ptr(T_i8())], int_t),
7172
vec_grow:
72-
dv("vec_grow", [T_ptr(T_ptr(opaque_vec_t)), int_t]),
73+
nothrow(dv("vec_grow", [T_ptr(T_ptr(opaque_vec_t)), int_t])),
7374
str_new_uniq:
74-
d("str_new_uniq", [T_ptr(T_i8()), int_t], T_ptr(opaque_vec_t)),
75+
nothrow(d("str_new_uniq", [T_ptr(T_i8()), int_t],
76+
T_ptr(opaque_vec_t))),
7577
str_new_shared:
76-
d("str_new_shared", [T_ptr(T_i8()), int_t], T_ptr(T_i8())),
78+
nothrow(d("str_new_shared", [T_ptr(T_i8()), int_t],
79+
T_ptr(T_i8()))),
7780
str_concat:
78-
d("str_concat", [T_ptr(opaque_vec_t), T_ptr(opaque_vec_t)],
79-
T_ptr(opaque_vec_t)),
81+
nothrow(d("str_concat", [T_ptr(opaque_vec_t),
82+
T_ptr(opaque_vec_t)],
83+
T_ptr(opaque_vec_t))),
8084
cmp_type:
8185
dv("cmp_type",
8286
[T_ptr(T_i1()), T_ptr(tydesc_type),
83-
T_ptr(T_ptr(tydesc_type)), T_ptr(T_i8()), T_ptr(T_i8()),
87+
T_ptr(T_ptr(tydesc_type)), T_ptr(T_i8()),
88+
T_ptr(T_i8()),
8489
T_i8()]),
8590
log_type:
86-
dv("log_type", [T_ptr(tydesc_type), T_ptr(T_i8()), T_i32()]),
91+
dv("log_type", [T_ptr(tydesc_type),
92+
T_ptr(T_i8()), T_i32()]),
8793
alloc_c_stack:
8894
d("alloc_c_stack", [size_t], T_ptr(T_i8())),
8995
call_shim_on_c_stack:
@@ -95,9 +101,9 @@ fn declare_upcalls(targ_cfg: @session::config,
95101
d("call_shim_on_rust_stack",
96102
[T_ptr(T_i8()), T_ptr(T_i8())], int_t),
97103
rust_personality:
98-
d("rust_personality", [], T_i32()),
104+
nothrow(d("rust_personality", [], T_i32())),
99105
reset_stack_limit:
100-
dv("reset_stack_limit", [])
106+
nothrow(dv("reset_stack_limit", []))
101107
};
102108
}
103109
//

src/rustc/middle/trans/base.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,6 @@ fn declare_generic_glue(ccx: @crate_ctxt, t: ty::t, llfnty: TypeRef,
488488
note_unique_llvm_symbol(ccx, fn_nm);
489489
let llfn = decl_cdecl_fn(ccx.llmod, fn_nm, llfnty);
490490
set_glue_inlining(llfn, t);
491-
if name != "drop" || !ty::type_has_resources(t) {
492-
set_no_unwind(llfn);
493-
}
494491
ret llfn;
495492
}
496493

0 commit comments

Comments
 (0)