Skip to content

Commit fb5b990

Browse files
committed
Remove unused upcalls
The main one removed is rust_upcall_reset_stack_limit (continuation of #10156), and this also removes the upcall_trace function. The was hidden behind a `-Z trace` flag, but if you attempt to use this now you'll get a linker error because there is no implementation of the 'upcall_trace' function. Due to this no longer working, I decided to remove it entirely from the compiler (I'm also a little unsure on what it did in the first place). Closes #10156
1 parent 90d06ec commit fb5b990

File tree

7 files changed

+27
-121
lines changed

7 files changed

+27
-121
lines changed

src/librustc/back/upcall.rs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,10 @@ use middle::trans::type_::Type;
1515
use lib::llvm::{ModuleRef, ValueRef};
1616

1717
pub struct Upcalls {
18-
trace: ValueRef,
1918
rust_personality: ValueRef,
20-
reset_stack_limit: ValueRef
2119
}
2220

2321
macro_rules! upcall (
24-
(fn $name:ident($($arg:expr),+) -> $ret:expr) => ({
25-
let fn_ty = Type::func([ $($arg),* ], &$ret);
26-
base::decl_cdecl_fn(llmod, ~"upcall_" + stringify!($name), fn_ty)
27-
});
28-
(nothrow fn $name:ident($($arg:expr),+) -> $ret:expr) => ({
29-
let fn_ty = Type::func([ $($arg),* ], &$ret);
30-
let decl = base::decl_cdecl_fn(llmod, ~"upcall_" + stringify!($name), fn_ty);
31-
base::set_no_unwind(decl);
32-
decl
33-
});
3422
(nothrow fn $name:ident -> $ret:expr) => ({
3523
let fn_ty = Type::func([], &$ret);
3624
let decl = base::decl_cdecl_fn(llmod, ~"upcall_" + stringify!($name), fn_ty);
@@ -39,13 +27,9 @@ macro_rules! upcall (
3927
})
4028
)
4129

42-
pub fn declare_upcalls(targ_cfg: @session::config, llmod: ModuleRef) -> @Upcalls {
43-
let opaque_ptr = Type::i8().ptr_to();
44-
let int_ty = Type::int(targ_cfg.arch);
45-
30+
pub fn declare_upcalls(_targ_cfg: @session::config,
31+
llmod: ModuleRef) -> @Upcalls {
4632
@Upcalls {
47-
trace: upcall!(fn trace(opaque_ptr, opaque_ptr, int_ty) -> Type::void()),
4833
rust_personality: upcall!(nothrow fn rust_personality -> Type::i32()),
49-
reset_stack_limit: upcall!(nothrow fn reset_stack_limit -> Type::void())
5034
}
5135
}

src/librustc/driver/session.rs

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -52,30 +52,29 @@ pub static time_llvm_passes: uint = 1 << 3;
5252
pub static trans_stats: uint = 1 << 4;
5353
pub static asm_comments: uint = 1 << 5;
5454
pub static no_verify: uint = 1 << 6;
55-
pub static trace: uint = 1 << 7;
56-
pub static coherence: uint = 1 << 8;
57-
pub static borrowck_stats: uint = 1 << 9;
58-
pub static borrowck_note_pure: uint = 1 << 10;
59-
pub static borrowck_note_loan: uint = 1 << 11;
60-
pub static no_landing_pads: uint = 1 << 12;
61-
pub static debug_llvm: uint = 1 << 13;
62-
pub static count_type_sizes: uint = 1 << 14;
63-
pub static meta_stats: uint = 1 << 15;
64-
pub static no_opt: uint = 1 << 16;
65-
pub static gc: uint = 1 << 17;
66-
pub static jit: uint = 1 << 18;
67-
pub static debug_info: uint = 1 << 19;
68-
pub static extra_debug_info: uint = 1 << 20;
69-
pub static statik: uint = 1 << 21;
70-
pub static print_link_args: uint = 1 << 22;
71-
pub static no_debug_borrows: uint = 1 << 23;
72-
pub static lint_llvm: uint = 1 << 24;
73-
pub static print_llvm_passes: uint = 1 << 25;
74-
pub static no_vectorize_loops: uint = 1 << 26;
75-
pub static no_vectorize_slp: uint = 1 << 27;
76-
pub static no_prepopulate_passes: uint = 1 << 28;
77-
pub static use_softfp: uint = 1 << 29;
78-
pub static gen_crate_map: uint = 1 << 30;
55+
pub static coherence: uint = 1 << 7;
56+
pub static borrowck_stats: uint = 1 << 8;
57+
pub static borrowck_note_pure: uint = 1 << 9;
58+
pub static borrowck_note_loan: uint = 1 << 10;
59+
pub static no_landing_pads: uint = 1 << 11;
60+
pub static debug_llvm: uint = 1 << 12;
61+
pub static count_type_sizes: uint = 1 << 13;
62+
pub static meta_stats: uint = 1 << 14;
63+
pub static no_opt: uint = 1 << 15;
64+
pub static gc: uint = 1 << 16;
65+
pub static jit: uint = 1 << 17;
66+
pub static debug_info: uint = 1 << 18;
67+
pub static extra_debug_info: uint = 1 << 19;
68+
pub static statik: uint = 1 << 20;
69+
pub static print_link_args: uint = 1 << 21;
70+
pub static no_debug_borrows: uint = 1 << 22;
71+
pub static lint_llvm: uint = 1 << 23;
72+
pub static print_llvm_passes: uint = 1 << 24;
73+
pub static no_vectorize_loops: uint = 1 << 25;
74+
pub static no_vectorize_slp: uint = 1 << 26;
75+
pub static no_prepopulate_passes: uint = 1 << 27;
76+
pub static use_softfp: uint = 1 << 28;
77+
pub static gen_crate_map: uint = 1 << 29;
7978

8079
pub fn debugging_opts_map() -> ~[(&'static str, &'static str, uint)] {
8180
~[("verbose", "in general, enable more debug printouts", verbose),
@@ -87,7 +86,6 @@ pub fn debugging_opts_map() -> ~[(&'static str, &'static str, uint)] {
8786
("trans-stats", "gather trans statistics", trans_stats),
8887
("asm-comments", "generate comments into the assembly (may change behavior)", asm_comments),
8988
("no-verify", "skip LLVM verification", no_verify),
90-
("trace", "emit trace logs", trace),
9189
("coherence", "perform coherence checking", coherence),
9290
("borrowck-stats", "gather borrowck statistics", borrowck_stats),
9391
("borrowck-note-pure", "note where purity is req'd",
@@ -310,7 +308,6 @@ impl Session_ {
310308
pub fn asm_comments(&self) -> bool { self.debugging_opt(asm_comments) }
311309
pub fn no_verify(&self) -> bool { self.debugging_opt(no_verify) }
312310
pub fn lint_llvm(&self) -> bool { self.debugging_opt(lint_llvm) }
313-
pub fn trace(&self) -> bool { self.debugging_opt(trace) }
314311
pub fn coherence(&self) -> bool { self.debugging_opt(coherence) }
315312
pub fn borrowck_stats(&self) -> bool { self.debugging_opt(borrowck_stats) }
316313
pub fn borrowck_note_pure(&self) -> bool {

src/librustc/middle/trans/base.rs

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,11 +1018,6 @@ pub fn get_landing_pad(bcx: @mut Block) -> BasicBlockRef {
10181018
// The landing pad block is a cleanup
10191019
SetCleanup(pad_bcx, llretval);
10201020

1021-
// Because we may have unwound across a stack boundary, we must call into
1022-
// the runtime to figure out which stack segment we are on and place the
1023-
// stack limit back into the TLS.
1024-
Call(pad_bcx, bcx.ccx().upcalls.reset_stack_limit, [], []);
1025-
10261021
// We store the retval in a function-central alloca, so that calls to
10271022
// Resume can find it.
10281023
match bcx.fcx.personality {
@@ -1097,28 +1092,6 @@ pub fn load_if_immediate(cx: @mut Block, v: ValueRef, t: ty::t) -> ValueRef {
10971092
return v;
10981093
}
10991094

1100-
pub fn trans_trace(bcx: @mut Block, sp_opt: Option<Span>, trace_str: @str) {
1101-
if !bcx.sess().trace() { return; }
1102-
let _icx = push_ctxt("trans_trace");
1103-
add_comment(bcx, trace_str);
1104-
let V_trace_str = C_cstr(bcx.ccx(), trace_str);
1105-
let (V_filename, V_line) = match sp_opt {
1106-
Some(sp) => {
1107-
let sess = bcx.sess();
1108-
let loc = sess.parse_sess.cm.lookup_char_pos(sp.lo);
1109-
(C_cstr(bcx.ccx(), loc.file.name), loc.line as int)
1110-
}
1111-
None => {
1112-
(C_cstr(bcx.ccx(), @"<runtime>"), 0)
1113-
}
1114-
};
1115-
let ccx = bcx.ccx();
1116-
let V_trace_str = PointerCast(bcx, V_trace_str, Type::i8p());
1117-
let V_filename = PointerCast(bcx, V_filename, Type::i8p());
1118-
let args = ~[V_trace_str, V_filename, C_int(ccx, V_line)];
1119-
Call(bcx, ccx.upcalls.trace, args, []);
1120-
}
1121-
11221095
pub fn ignore_lhs(_bcx: @mut Block, local: &ast::Local) -> bool {
11231096
match local.pat.node {
11241097
ast::PatWild => true, _ => false
@@ -1313,12 +1286,6 @@ pub fn cleanup_and_leave(bcx: @mut Block,
13131286
loop {
13141287
debug!("cleanup_and_leave: leaving {}", cur.to_str());
13151288

1316-
if bcx.sess().trace() {
1317-
trans_trace(
1318-
bcx, None,
1319-
(format!("cleanup_and_leave({})", cur.to_str())).to_managed());
1320-
}
1321-
13221289
let mut cur_scope = cur.scope;
13231290
loop {
13241291
cur_scope = match cur_scope {
@@ -1387,12 +1354,6 @@ pub fn cleanup_block(bcx: @mut Block, upto: Option<BasicBlockRef>) -> @mut Block
13871354
loop {
13881355
debug!("cleanup_block: {}", cur.to_str());
13891356

1390-
if bcx.sess().trace() {
1391-
trans_trace(
1392-
bcx, None,
1393-
(format!("cleanup_block({})", cur.to_str())).to_managed());
1394-
}
1395-
13961357
let mut cur_scope = cur.scope;
13971358
loop {
13981359
cur_scope = match cur_scope {

src/librustc/middle/trans/expr.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,6 @@ fn trans_to_datum_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
567567
fn trans_rvalue_datum_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
568568
let _icx = push_ctxt("trans_rvalue_datum_unadjusted");
569569

570-
trace_span!(bcx, expr.span, shorten(bcx.expr_to_str(expr)));
571-
572570
match expr.node {
573571
ast::ExprPath(_) | ast::ExprSelf => {
574572
return trans_def_datum_unadjusted(bcx, expr, bcx.def(expr.id));
@@ -625,8 +623,6 @@ fn trans_rvalue_stmt_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> @mut Block
625623
return bcx;
626624
}
627625

628-
trace_span!(bcx, expr.span, shorten(bcx.expr_to_str(expr)));
629-
630626
match expr.node {
631627
ast::ExprBreak(label_opt) => {
632628
return controlflow::trans_break(bcx, label_opt);
@@ -676,8 +672,6 @@ fn trans_rvalue_dps_unadjusted(bcx: @mut Block, expr: &ast::Expr,
676672
let _icx = push_ctxt("trans_rvalue_dps_unadjusted");
677673
let tcx = bcx.tcx();
678674

679-
trace_span!(bcx, expr.span, shorten(bcx.expr_to_str(expr)));
680-
681675
match expr.node {
682676
ast::ExprParen(e) => {
683677
return trans_rvalue_dps_unadjusted(bcx, e, dest);
@@ -895,8 +889,6 @@ fn trans_lvalue_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
895889
debug!("trans_lvalue(expr={})", bcx.expr_to_str(expr));
896890
let _indenter = indenter();
897891

898-
trace_span!(bcx, expr.span, shorten(bcx.expr_to_str(expr)));
899-
900892
return match expr.node {
901893
ast::ExprParen(e) => {
902894
trans_lvalue_unadjusted(bcx, e)

src/librustc/middle/trans/macros.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,3 @@ macro_rules! unpack_result(
2929
}
3030
)
3131
)
32-
33-
macro_rules! trace_span(
34-
($bcx: ident, $sp: expr, $str: expr) => (
35-
{
36-
let bcx = $bcx;
37-
if bcx.sess().trace() {
38-
trans_trace(bcx, Some($sp), $str);
39-
}
40-
}
41-
)
42-
)
43-
44-
macro_rules! trace(
45-
($bcx: ident, $str: expr) => (
46-
{
47-
let bcx = $bcx;
48-
if bcx.sess().trace() {
49-
trans_trace(bcx, None, $str);
50-
}
51-
}
52-
)
53-
)

src/librustc/middle/trans/write_guard.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,6 @@ fn root(datum: &Datum,
114114
debug!("write_guard::root(root_key={:?}, root_info={:?}, datum={:?})",
115115
root_key, root_info, datum.to_str(bcx.ccx()));
116116

117-
if bcx.sess().trace() {
118-
trans_trace(
119-
bcx, None,
120-
(format!("preserving until end of scope {}",
121-
root_info.scope)).to_managed());
122-
}
123-
124117
// First, root the datum. Note that we must zero this value,
125118
// because sometimes we root on one path but not another.
126119
// See e.g. #4904.

src/rt/rust_upcall.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct s_rust_personality_args {
5151
struct _Unwind_Context *context;
5252
};
5353

54-
void
54+
static void
5555
upcall_s_rust_personality(struct s_rust_personality_args *args) {
5656
args->retval = PERSONALITY_FUNC(args->version,
5757
args->actions,
@@ -78,6 +78,7 @@ upcall_rust_personality(int version,
7878
return args.retval;
7979
}
8080

81+
// NOTE: remove after stage0
8182
// Landing pads need to call this to insert the
8283
// correct limit into TLS.
8384
// NB: This must run on the Rust stack because it

0 commit comments

Comments
 (0)