about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2018-11-05 18:27:10 +0100
committerbjorn3 <bjorn3@users.noreply.github.com>2018-11-05 18:27:10 +0100
commitf19f8e4b4961e279cfe389bb177b86ea97613dbc (patch)
treeae809fe94e5403878a682f248500372cbaadd411
parentd67fd1698286204e5491e4df9376b97e0e3392fe (diff)
downloadrust-f19f8e4b4961e279cfe389bb177b86ea97613dbc.tar.gz
rust-f19f8e4b4961e279cfe389bb177b86ea97613dbc.zip
Use tcx.collect_and_partition_mono_items
-rw-r--r--src/lib.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 28dd372ca65..c9ca758e55a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -178,9 +178,6 @@ impl CodegenBackend for CraneliftCodegenBackend {
             .unwrap()
             .finish(flags);
 
-        let mono_items =
-            collector::collect_crate_mono_items(tcx, collector::MonoItemCollectionMode::Lazy).0;
-
         // TODO: move to the end of this function when compiling libcore doesn't have unimplemented stuff anymore
         save_incremental(tcx);
         tcx.sess.warn("Saved incremental data");
@@ -189,7 +186,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
             let mut jit_module: Module<SimpleJITBackend> = Module::new(SimpleJITBuilder::new());
             assert_eq!(pointer_ty(tcx), jit_module.target_config().pointer_type());
 
-            codegen_mono_items(tcx, &mut jit_module, mono_items);
+            codegen_mono_items(tcx, &mut jit_module);
 
             tcx.sess.abort_if_errors();
             println!("Compiled everything");
@@ -230,7 +227,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
             );
             assert_eq!(pointer_ty(tcx), faerie_module.target_config().pointer_type());
 
-            codegen_mono_items(tcx, &mut faerie_module, mono_items);
+            codegen_mono_items(tcx, &mut faerie_module);
 
             tcx.sess.abort_if_errors();
 
@@ -334,7 +331,6 @@ impl CodegenBackend for CraneliftCodegenBackend {
 fn codegen_mono_items<'a, 'tcx: 'a>(
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
     module: &mut Module<impl Backend + 'static>,
-    mono_items: FxHashSet<MonoItem<'tcx>>,
 ) {
     use std::io::Write;
 
@@ -350,10 +346,15 @@ fn codegen_mono_items<'a, 'tcx: 'a>(
         None
     };
 
+    let (_, cgus) = tcx.collect_and_partition_mono_items(LOCAL_CRATE);
+    let mono_items = cgus.iter().map(|cgu| {
+        cgu.items().iter()
+    }).flatten().collect::<FxHashSet<(_, _)>>();
+
     let before = ::std::time::Instant::now();
     println!("[codegen mono items] start");
 
-    for mono_item in mono_items {
+    for (&mono_item, &(_linkage, _vis)) in mono_items {
         let res = ::std::panic::catch_unwind(::std::panic::AssertUnwindSafe(|| {
             base::trans_mono_item(tcx, module, &mut caches, &mut ccx, mono_item);
         }));