diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2016-03-24 14:56:02 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2016-03-24 14:56:02 -0400 |
| commit | 13877ac4428cc9cbf6b07ad98e0f0b152381fac7 (patch) | |
| tree | 52026e6f369e03731b73e887005aa17455a98b4d | |
| parent | 43843d06ea9598722b3af9019e8d0059c052382d (diff) | |
| download | rust-13877ac4428cc9cbf6b07ad98e0f0b152381fac7.tar.gz rust-13877ac4428cc9cbf6b07ad98e0f0b152381fac7.zip | |
make available monomorphizations shared by CGU
The current setup means that all generics are local to a codegen-unit, which means massive duplication.
| -rw-r--r-- | src/librustc_trans/trans/context.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustc_trans/trans/context.rs b/src/librustc_trans/trans/context.rs index 8f5572f5c4e..f232f1afea7 100644 --- a/src/librustc_trans/trans/context.rs +++ b/src/librustc_trans/trans/context.rs @@ -79,6 +79,7 @@ pub struct SharedCrateContext<'a, 'tcx: 'a> { mir_map: &'a MirMap<'tcx>, mir_cache: RefCell<DefIdMap<Rc<mir::Mir<'tcx>>>>, + available_monomorphizations: RefCell<FnvHashSet<String>>, available_drop_glues: RefCell<FnvHashMap<DropGlueKind<'tcx>, String>>, use_dll_storage_attrs: bool, @@ -104,7 +105,6 @@ pub struct LocalCrateContext<'tcx> { /// Cache instances of monomorphic and polymorphic items instances: RefCell<FnvHashMap<Instance<'tcx>, ValueRef>>, monomorphizing: RefCell<DefIdMap<usize>>, - available_monomorphizations: RefCell<FnvHashSet<String>>, /// Cache generated vtables vtables: RefCell<FnvHashMap<ty::PolyTraitRef<'tcx>, ValueRef>>, /// Cache of constant strings, @@ -356,6 +356,7 @@ impl<'b, 'tcx> SharedCrateContext<'b, 'tcx> { }, check_overflow: check_overflow, check_drop_flag_for_sanity: check_drop_flag_for_sanity, + available_monomorphizations: RefCell::new(FnvHashSet()), available_drop_glues: RefCell::new(FnvHashMap()), use_dll_storage_attrs: use_dll_storage_attrs, translation_items: RefCell::new(FnvHashMap()), @@ -473,7 +474,6 @@ impl<'tcx> LocalCrateContext<'tcx> { external_srcs: RefCell::new(NodeMap()), instances: RefCell::new(FnvHashMap()), monomorphizing: RefCell::new(DefIdMap()), - available_monomorphizations: RefCell::new(FnvHashSet()), vtables: RefCell::new(FnvHashMap()), const_cstr_cache: RefCell::new(FnvHashMap()), const_unsized: RefCell::new(FnvHashMap()), @@ -723,7 +723,7 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> { } pub fn available_monomorphizations<'a>(&'a self) -> &'a RefCell<FnvHashSet<String>> { - &self.local.available_monomorphizations + &self.shared.available_monomorphizations } pub fn available_drop_glues(&self) -> &RefCell<FnvHashMap<DropGlueKind<'tcx>, String>> { |
