From b2c3a413b955ac89be06367f4db7706cbd88dc9c Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Wed, 2 Aug 2017 11:56:23 +0200 Subject: [PATCH] incr.comp.: Properly incorporate symbol linkage and visibility into CGU hash. --- src/librustc_trans/base.rs | 2 +- src/librustc_trans/partitioning.rs | 21 ++++----------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/librustc_trans/base.rs b/src/librustc_trans/base.rs index 14c73de64bc79..49a2885747f6d 100644 --- a/src/librustc_trans/base.rs +++ b/src/librustc_trans/base.rs @@ -1172,7 +1172,7 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let cgu_name = String::from(cgu.name()); let cgu_id = cgu.work_product_id(); - let symbol_name_hash = cgu.compute_symbol_name_hash(scx, &exported_symbols); + let symbol_name_hash = cgu.compute_symbol_name_hash(scx); // Check whether there is a previous work-product we can // re-use. Not only must the file exist, and the inputs not diff --git a/src/librustc_trans/partitioning.rs b/src/librustc_trans/partitioning.rs index 904cfb2acd741..cff0eca02c60e 100644 --- a/src/librustc_trans/partitioning.rs +++ b/src/librustc_trans/partitioning.rs @@ -174,29 +174,16 @@ impl<'tcx> CodegenUnit<'tcx> { } pub fn compute_symbol_name_hash<'a>(&self, - scx: &SharedCrateContext<'a, 'tcx>, - exported_symbols: &ExportedSymbols) + scx: &SharedCrateContext<'a, 'tcx>) -> u64 { let mut state = IchHasher::new(); - let exported_symbols = exported_symbols.local_exports(); let all_items = self.items_in_deterministic_order(scx.tcx()); - for (item, _) in all_items { + for (item, (linkage, visibility)) in all_items { let symbol_name = item.symbol_name(scx.tcx()); symbol_name.len().hash(&mut state); symbol_name.hash(&mut state); - let exported = match item { - TransItem::Fn(ref instance) => { - let node_id = - scx.tcx().hir.as_local_node_id(instance.def_id()); - node_id.map(|node_id| exported_symbols.contains(&node_id)) - .unwrap_or(false) - } - TransItem::Static(node_id) => { - exported_symbols.contains(&node_id) - } - TransItem::GlobalAsm(..) => true, - }; - exported.hash(&mut state); + linkage.hash(&mut state); + visibility.hash(&mut state); } state.finish().to_smaller_hash() }