]> git.lizzy.rs Git - rust.git/commitdiff
Remove unused upcalls
authorAlex Crichton <alex@alexcrichton.com>
Thu, 28 Nov 2013 22:16:17 +0000 (14:16 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Fri, 6 Dec 2013 00:29:16 +0000 (16:29 -0800)
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).

mk/llvm.mk
src/librustc/back/link.rs
src/librustc/back/upcall.rs
src/librustc/driver/session.rs
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/expr.rs
src/librustc/middle/trans/macros.rs
src/librustc/middle/trans/write_guard.rs
src/llvm
src/rt/rust_upcall.c
src/rustllvm/llvm-auto-clean-trigger

index efaa109c29e91c2da37c065fa45faf90e0c28ab3..42b1a551805aff93816a3e76b94d20e74f68f1b7 100644 (file)
@@ -37,7 +37,9 @@ endif
 # dependencies. In these cases, commit a change that touches
 # the stamp in the source dir.
 $$(LLVM_STAMP_$(1)): $(S)src/rustllvm/llvm-auto-clean-trigger
+       @$$(call E, make: cleaning llvm)
        $(Q)$(MAKE) clean-llvm
+       @$$(call E, make: done cleaning llvm)
        touch $$@
 
 endef
index 2bebadc2ef2bc69bdb2f46297eec5e7e4ed3190e..1cb10d59e59c9f35f25136697bf24f69b3be5648 100644 (file)
@@ -598,8 +598,8 @@ pub fn sanitize(s: &str) -> ~str {
             ',' => result.push_str("$C$"),
 
             // '.' doesn't occur in types and functions, so reuse it
-            // for ':'
-            ':' => result.push_char('.'),
+            // for ':' and '-'
+            '-' | ':' => result.push_char('.'),
 
             // These are legal symbols
             'a' .. 'z'
index 0ad53c4d49c1a14ed20222222d42d296bf89163b..730ceba12c786808231c70224556247abfcd1056 100644 (file)
 use lib::llvm::{ModuleRef, ValueRef};
 
 pub struct Upcalls {
-    trace: ValueRef,
     rust_personality: ValueRef,
-    reset_stack_limit: ValueRef
 }
 
 macro_rules! upcall (
-    (fn $name:ident($($arg:expr),+) -> $ret:expr) => ({
-        let fn_ty = Type::func([ $($arg),* ], &$ret);
-        base::decl_cdecl_fn(llmod, ~"upcall_" + stringify!($name), fn_ty)
-    });
-    (nothrow fn $name:ident($($arg:expr),+) -> $ret:expr) => ({
-        let fn_ty = Type::func([ $($arg),* ], &$ret);
-        let decl = base::decl_cdecl_fn(llmod, ~"upcall_" + stringify!($name), fn_ty);
-        base::set_no_unwind(decl);
-        decl
-    });
     (nothrow fn $name:ident -> $ret:expr) => ({
         let fn_ty = Type::func([], &$ret);
         let decl = base::decl_cdecl_fn(llmod, ~"upcall_" + stringify!($name), fn_ty);
@@ -39,13 +27,9 @@ macro_rules! upcall (
     })
 )
 
-pub fn declare_upcalls(targ_cfg: @session::config, llmod: ModuleRef) -> @Upcalls {
-    let opaque_ptr = Type::i8().ptr_to();
-    let int_ty = Type::int(targ_cfg.arch);
-
+pub fn declare_upcalls(_targ_cfg: @session::config,
+                       llmod: ModuleRef) -> @Upcalls {
     @Upcalls {
-        trace: upcall!(fn trace(opaque_ptr, opaque_ptr, int_ty) -> Type::void()),
         rust_personality: upcall!(nothrow fn rust_personality -> Type::i32()),
-        reset_stack_limit: upcall!(nothrow fn reset_stack_limit -> Type::void())
     }
 }
index 2c41cf00e6b8292f94135055eaedaabee1405330..6a4755344eff45241c2d49c6c1296256aecca0ef 100644 (file)
@@ -44,29 +44,28 @@ pub struct config {
 pub static trans_stats:             uint = 1 <<  4;
 pub static asm_comments:            uint = 1 <<  5;
 pub static no_verify:               uint = 1 <<  6;
-pub static trace:                   uint = 1 <<  7;
-pub static coherence:               uint = 1 <<  8;
-pub static borrowck_stats:          uint = 1 <<  9;
-pub static borrowck_note_pure:      uint = 1 << 10;
-pub static borrowck_note_loan:      uint = 1 << 11;
-pub static no_landing_pads:         uint = 1 << 12;
-pub static debug_llvm:              uint = 1 << 13;
-pub static count_type_sizes:        uint = 1 << 14;
-pub static meta_stats:              uint = 1 << 15;
-pub static no_opt:                  uint = 1 << 16;
-pub static gc:                      uint = 1 << 17;
-pub static debug_info:              uint = 1 << 18;
-pub static extra_debug_info:        uint = 1 << 19;
-pub static print_link_args:         uint = 1 << 20;
-pub static no_debug_borrows:        uint = 1 << 21;
-pub static lint_llvm:               uint = 1 << 22;
-pub static print_llvm_passes:       uint = 1 << 23;
-pub static no_vectorize_loops:      uint = 1 << 24;
-pub static no_vectorize_slp:        uint = 1 << 25;
-pub static no_prepopulate_passes:   uint = 1 << 26;
-pub static use_softfp:              uint = 1 << 27;
-pub static gen_crate_map:           uint = 1 << 28;
-pub static prefer_dynamic:          uint = 1 << 29;
+pub static coherence:               uint = 1 <<  7;
+pub static borrowck_stats:          uint = 1 <<  8;
+pub static borrowck_note_pure:      uint = 1 <<  9;
+pub static borrowck_note_loan:      uint = 1 << 10;
+pub static no_landing_pads:         uint = 1 << 11;
+pub static debug_llvm:              uint = 1 << 12;
+pub static count_type_sizes:        uint = 1 << 13;
+pub static meta_stats:              uint = 1 << 14;
+pub static no_opt:                  uint = 1 << 15;
+pub static gc:                      uint = 1 << 16;
+pub static debug_info:              uint = 1 << 17;
+pub static extra_debug_info:        uint = 1 << 18;
+pub static print_link_args:         uint = 1 << 19;
+pub static no_debug_borrows:        uint = 1 << 20;
+pub static lint_llvm:               uint = 1 << 21;
+pub static print_llvm_passes:       uint = 1 << 22;
+pub static no_vectorize_loops:      uint = 1 << 23;
+pub static no_vectorize_slp:        uint = 1 << 24;
+pub static no_prepopulate_passes:   uint = 1 << 25;
+pub static use_softfp:              uint = 1 << 26;
+pub static gen_crate_map:           uint = 1 << 27;
+pub static prefer_dynamic:          uint = 1 << 28;
 
 pub fn debugging_opts_map() -> ~[(&'static str, &'static str, uint)] {
     ~[("verbose", "in general, enable more debug printouts", verbose),
@@ -78,7 +77,6 @@ pub fn debugging_opts_map() -> ~[(&'static str, &'static str, uint)] {
      ("trans-stats", "gather trans statistics", trans_stats),
      ("asm-comments", "generate comments into the assembly (may change behavior)", asm_comments),
      ("no-verify", "skip LLVM verification", no_verify),
-     ("trace", "emit trace logs", trace),
      ("coherence", "perform coherence checking", coherence),
      ("borrowck-stats", "gather borrowck statistics",  borrowck_stats),
      ("borrowck-note-pure", "note where purity is req'd",
@@ -308,7 +306,6 @@ pub fn meta_stats(&self) -> bool { self.debugging_opt(meta_stats) }
     pub fn asm_comments(&self) -> bool { self.debugging_opt(asm_comments) }
     pub fn no_verify(&self) -> bool { self.debugging_opt(no_verify) }
     pub fn lint_llvm(&self) -> bool { self.debugging_opt(lint_llvm) }
-    pub fn trace(&self) -> bool { self.debugging_opt(trace) }
     pub fn coherence(&self) -> bool { self.debugging_opt(coherence) }
     pub fn borrowck_stats(&self) -> bool { self.debugging_opt(borrowck_stats) }
     pub fn borrowck_note_pure(&self) -> bool {
index d4586fc59905bd0244655da3ca6084f949dc7e50..72b9fc83c4ab881fa8ee23db287b3451abff79fa 100644 (file)
@@ -1018,11 +1018,6 @@ pub fn get_landing_pad(bcx: @mut Block) -> BasicBlockRef {
     // The landing pad block is a cleanup
     SetCleanup(pad_bcx, llretval);
 
-    // Because we may have unwound across a stack boundary, we must call into
-    // the runtime to figure out which stack segment we are on and place the
-    // stack limit back into the TLS.
-    Call(pad_bcx, bcx.ccx().upcalls.reset_stack_limit, [], []);
-
     // We store the retval in a function-central alloca, so that calls to
     // Resume can find it.
     match bcx.fcx.personality {
@@ -1097,28 +1092,6 @@ pub fn load_if_immediate(cx: @mut Block, v: ValueRef, t: ty::t) -> ValueRef {
     return v;
 }
 
-pub fn trans_trace(bcx: @mut Block, sp_opt: Option<Span>, trace_str: @str) {
-    if !bcx.sess().trace() { return; }
-    let _icx = push_ctxt("trans_trace");
-    add_comment(bcx, trace_str);
-    let V_trace_str = C_cstr(bcx.ccx(), trace_str);
-    let (V_filename, V_line) = match sp_opt {
-      Some(sp) => {
-        let sess = bcx.sess();
-        let loc = sess.parse_sess.cm.lookup_char_pos(sp.lo);
-        (C_cstr(bcx.ccx(), loc.file.name), loc.line as int)
-      }
-      None => {
-        (C_cstr(bcx.ccx(), @"<runtime>"), 0)
-      }
-    };
-    let ccx = bcx.ccx();
-    let V_trace_str = PointerCast(bcx, V_trace_str, Type::i8p());
-    let V_filename = PointerCast(bcx, V_filename, Type::i8p());
-    let args = ~[V_trace_str, V_filename, C_int(ccx, V_line)];
-    Call(bcx, ccx.upcalls.trace, args, []);
-}
-
 pub fn ignore_lhs(_bcx: @mut Block, local: &ast::Local) -> bool {
     match local.pat.node {
         ast::PatWild => true, _ => false
@@ -1313,12 +1286,6 @@ pub fn cleanup_and_leave(bcx: @mut Block,
     loop {
         debug!("cleanup_and_leave: leaving {}", cur.to_str());
 
-        if bcx.sess().trace() {
-            trans_trace(
-                bcx, None,
-                (format!("cleanup_and_leave({})", cur.to_str())).to_managed());
-        }
-
         let mut cur_scope = cur.scope;
         loop {
             cur_scope = match cur_scope {
@@ -1387,12 +1354,6 @@ pub fn cleanup_block(bcx: @mut Block, upto: Option<BasicBlockRef>) -> @mut Block
     loop {
         debug!("cleanup_block: {}", cur.to_str());
 
-        if bcx.sess().trace() {
-            trans_trace(
-                bcx, None,
-                (format!("cleanup_block({})", cur.to_str())).to_managed());
-        }
-
         let mut cur_scope = cur.scope;
         loop {
             cur_scope = match cur_scope {
@@ -2961,6 +2922,11 @@ pub fn create_module_map(ccx: &mut CrateContext) -> (ValueRef, uint) {
     return (map, keys.len())
 }
 
+pub fn symname(sess: session::Session, name: &str,
+               hash: &str, vers: &str) -> ~str {
+    let elt = path_name(sess.ident_of(name));
+    link::exported_name(sess, ~[elt], hash, vers)
+}
 
 pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
                       llmod: ModuleRef) -> ValueRef {
@@ -2969,13 +2935,14 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
     let mut n_subcrates = 1;
     let cstore = sess.cstore;
     while cstore::have_crate_data(cstore, n_subcrates) { n_subcrates += 1; }
-    let mapname = if *sess.building_library && !sess.gen_crate_map() {
-        format!("{}_{}_{}", mapmeta.name, mapmeta.vers, mapmeta.extras_hash)
+    let is_top = !*sess.building_library || sess.gen_crate_map();
+    let sym_name = if is_top {
+        ~"_rust_crate_map_toplevel"
     } else {
-        ~"toplevel"
+        symname(sess, "_rust_crate_map_" + mapmeta.name, mapmeta.extras_hash,
+                mapmeta.vers)
     };
 
-    let sym_name = ~"_rust_crate_map_" + mapname;
     let slicetype = Type::struct_([int_type, int_type], false);
     let maptype = Type::struct_([
         Type::i32(),        // version
@@ -2990,7 +2957,7 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
     });
     // On windows we'd like to export the toplevel cratemap
     // such that we can find it from libstd.
-    if targ_cfg.os == OsWin32 && "toplevel" == mapname {
+    if targ_cfg.os == OsWin32 && is_top {
         lib::llvm::SetLinkage(map, lib::llvm::DLLExportLinkage);
     } else {
         lib::llvm::SetLinkage(map, lib::llvm::ExternalLinkage);
@@ -3005,10 +2972,9 @@ pub fn fill_crate_map(ccx: @mut CrateContext, map: ValueRef) {
     let cstore = ccx.sess.cstore;
     while cstore::have_crate_data(cstore, i) {
         let cdata = cstore::get_crate_data(cstore, i);
-        let nm = format!("_rust_crate_map_{}_{}_{}",
-                      cdata.name,
-                      cstore::get_crate_vers(cstore, i),
-                      cstore::get_crate_hash(cstore, i));
+        let nm = symname(ccx.sess, format!("_rust_crate_map_{}", cdata.name),
+                         cstore::get_crate_hash(cstore, i),
+                         cstore::get_crate_vers(cstore, i));
         let cr = nm.with_c_str(|buf| {
             unsafe {
                 llvm::LLVMAddGlobal(ccx.llmod, ccx.int_type.to_ref(), buf)
index 09218b53424934f36e8131c6f4665b982bb8d84f..2c3a9e040c95949846c2cb3ec15b3e4349f8b577 100644 (file)
@@ -567,8 +567,6 @@ fn nil(bcx: @mut Block, ty: ty::t) -> DatumBlock {
 fn trans_rvalue_datum_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
     let _icx = push_ctxt("trans_rvalue_datum_unadjusted");
 
-    trace_span!(bcx, expr.span, shorten(bcx.expr_to_str(expr)));
-
     match expr.node {
         ast::ExprPath(_) | ast::ExprSelf => {
             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
         return bcx;
     }
 
-    trace_span!(bcx, expr.span, shorten(bcx.expr_to_str(expr)));
-
     match expr.node {
         ast::ExprBreak(label_opt) => {
             return controlflow::trans_break(bcx, label_opt);
@@ -676,8 +672,6 @@ fn trans_rvalue_dps_unadjusted(bcx: @mut Block, expr: &ast::Expr,
     let _icx = push_ctxt("trans_rvalue_dps_unadjusted");
     let tcx = bcx.tcx();
 
-    trace_span!(bcx, expr.span, shorten(bcx.expr_to_str(expr)));
-
     match expr.node {
         ast::ExprParen(e) => {
             return trans_rvalue_dps_unadjusted(bcx, e, dest);
@@ -895,8 +889,6 @@ fn trans_lvalue_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
     debug!("trans_lvalue(expr={})", bcx.expr_to_str(expr));
     let _indenter = indenter();
 
-    trace_span!(bcx, expr.span, shorten(bcx.expr_to_str(expr)));
-
     return match expr.node {
         ast::ExprParen(e) => {
             trans_lvalue_unadjusted(bcx, e)
index 43cc66c55686714e70a83392b86eb7ee388c1077..938484fd44cebfb3cf925086efabc4a8d5fcb25b 100644 (file)
@@ -29,25 +29,3 @@ macro_rules! unpack_result(
         }
     )
 )
-
-macro_rules! trace_span(
-    ($bcx: ident, $sp: expr, $str: expr) => (
-        {
-            let bcx = $bcx;
-            if bcx.sess().trace() {
-                trans_trace(bcx, Some($sp), $str);
-            }
-        }
-    )
-)
-
-macro_rules! trace(
-    ($bcx: ident, $str: expr) => (
-        {
-            let bcx = $bcx;
-            if bcx.sess().trace() {
-                trans_trace(bcx, None, $str);
-            }
-        }
-    )
-)
index 577e0a28105f293533fed5322ef27170ef5591ba..2da2da80fdd6a9a144f69514dc852dbca0cd9a94 100644 (file)
@@ -114,13 +114,6 @@ fn root(datum: &Datum,
     debug!("write_guard::root(root_key={:?}, root_info={:?}, datum={:?})",
            root_key, root_info, datum.to_str(bcx.ccx()));
 
-    if bcx.sess().trace() {
-        trans_trace(
-            bcx, None,
-            (format!("preserving until end of scope {}",
-                  root_info.scope)).to_managed());
-    }
-
     // First, root the datum. Note that we must zero this value,
     // because sometimes we root on one path but not another.
     // See e.g. #4904.
index 9e85884132d277efeb507d0aeaa160ba201d054f..eac6ff795c40778683e42b0c6ab6f6adaceb391d 160000 (submodule)
--- a/src/llvm
+++ b/src/llvm
@@ -1 +1 @@
-Subproject commit 9e85884132d277efeb507d0aeaa160ba201d054f
+Subproject commit eac6ff795c40778683e42b0c6ab6f6adaceb391d
index 9740fdea82c962081437896c939ab722a54b6697..18b71fbb1790812b0110244dbf36a66881174b19 100644 (file)
@@ -51,7 +51,7 @@ struct s_rust_personality_args {
     struct _Unwind_Context *context;
 };
 
-void
+static void
 upcall_s_rust_personality(struct s_rust_personality_args *args) {
     args->retval = PERSONALITY_FUNC(args->version,
                                     args->actions,
@@ -78,6 +78,7 @@ upcall_rust_personality(int version,
     return args.retval;
 }
 
+// NOTE: remove after stage0
 // Landing pads need to call this to insert the
 // correct limit into TLS.
 // NB: This must run on the Rust stack because it
index a72e585355480df7b8e221876478231bd8c8463b..bae0ad8fbc6c198e1e5ba0e426d9d317d70acf38 100644 (file)
@@ -1,4 +1,4 @@
 # If this file is modified, then llvm will be forcibly cleaned and then rebuilt.
 # The actual contents of this file do not matter, but to trigger a change on the
 # build bots then the contents should be changed so git updates the mtime.
-2013-11-19
+2013-12-05