Skip to content

Commit e3e5824

Browse files
committed
Rollup merge of rust-lang#32469 - nikomatsakis:shared-cgu, r=eddyb
make available monomorphizations shared by CGU The current setup means that all generics are local to a codegen-unit, which means massive duplication.
2 parents 6710278 + 13877ac commit e3e5824

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/librustc_trans/trans/context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ pub struct SharedCrateContext<'a, 'tcx: 'a> {
8080
mir_map: &'a MirMap<'tcx>,
8181
mir_cache: RefCell<DefIdMap<Rc<mir::Mir<'tcx>>>>,
8282

83+
available_monomorphizations: RefCell<FnvHashSet<String>>,
8384
available_drop_glues: RefCell<FnvHashMap<DropGlueKind<'tcx>, String>>,
8485
use_dll_storage_attrs: bool,
8586

@@ -105,7 +106,6 @@ pub struct LocalCrateContext<'tcx> {
105106
/// Cache instances of monomorphic and polymorphic items
106107
instances: RefCell<FnvHashMap<Instance<'tcx>, ValueRef>>,
107108
monomorphizing: RefCell<DefIdMap<usize>>,
108-
available_monomorphizations: RefCell<FnvHashSet<String>>,
109109
/// Cache generated vtables
110110
vtables: RefCell<FnvHashMap<ty::PolyTraitRef<'tcx>, ValueRef>>,
111111
/// Cache of constant strings,
@@ -357,6 +357,7 @@ impl<'b, 'tcx> SharedCrateContext<'b, 'tcx> {
357357
},
358358
check_overflow: check_overflow,
359359
check_drop_flag_for_sanity: check_drop_flag_for_sanity,
360+
available_monomorphizations: RefCell::new(FnvHashSet()),
360361
available_drop_glues: RefCell::new(FnvHashMap()),
361362
use_dll_storage_attrs: use_dll_storage_attrs,
362363
translation_items: RefCell::new(FnvHashMap()),
@@ -474,7 +475,6 @@ impl<'tcx> LocalCrateContext<'tcx> {
474475
external_srcs: RefCell::new(NodeMap()),
475476
instances: RefCell::new(FnvHashMap()),
476477
monomorphizing: RefCell::new(DefIdMap()),
477-
available_monomorphizations: RefCell::new(FnvHashSet()),
478478
vtables: RefCell::new(FnvHashMap()),
479479
const_cstr_cache: RefCell::new(FnvHashMap()),
480480
const_unsized: RefCell::new(FnvHashMap()),
@@ -723,7 +723,7 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
723723
}
724724

725725
pub fn available_monomorphizations<'a>(&'a self) -> &'a RefCell<FnvHashSet<String>> {
726-
&self.local.available_monomorphizations
726+
&self.shared.available_monomorphizations
727727
}
728728

729729
pub fn available_drop_glues(&self) -> &RefCell<FnvHashMap<DropGlueKind<'tcx>, String>> {

0 commit comments

Comments
 (0)