diff options
| author | bors <bors@rust-lang.org> | 2020-05-01 01:38:05 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-05-01 01:38:05 +0000 |
| commit | e94eaa6dce468928b4e1326b2f0054f3075681ff (patch) | |
| tree | 833cc1402e3e700a5cda3385d79f08c7bc4b3591 /src/librustc_codegen_ssa | |
| parent | 614f273e9388ddd7804d5cbc80b8865068a3744e (diff) | |
| parent | d7d2185607280e143ea25b1cf688cb6f27f2db45 (diff) | |
Auto merge of #70674 - cjgillot:query-arena-all, r=matthewjasper
Have the per-query caches store the results on arenas This PR leverages the cache for each query to serve as storage area for the query results. It introduces a new cache `ArenaCache`, which moves the result to an arena, and only stores the reference in the hash map. This allows to remove a sizeable part of the usage of the global `TyCtxt` arena. I only migrated queries that already used arenas before.
Diffstat (limited to 'src/librustc_codegen_ssa')
| -rw-r--r-- | src/librustc_codegen_ssa/back/symbol_export.rs | 13 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/base.rs | 2 |
2 files changed, 6 insertions, 9 deletions
diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs index 9faddf254d7..338211ca11f 100644 --- a/src/librustc_codegen_ssa/back/symbol_export.rs +++ b/src/librustc_codegen_ssa/back/symbol_export.rs @@ -42,14 +42,11 @@ pub fn crates_export_threshold(crate_types: &[config::CrateType]) -> SymbolExpor } } -fn reachable_non_generics_provider( - tcx: TyCtxt<'_>, - cnum: CrateNum, -) -> &DefIdMap<SymbolExportLevel> { +fn reachable_non_generics_provider(tcx: TyCtxt<'_>, cnum: CrateNum) -> DefIdMap<SymbolExportLevel> { assert_eq!(cnum, LOCAL_CRATE); if !tcx.sess.opts.output_types.should_codegen() { - return tcx.arena.alloc(Default::default()); + return Default::default(); } // Check to see if this crate is a "special runtime crate". These @@ -145,7 +142,7 @@ fn reachable_non_generics_provider( reachable_non_generics.insert(id, SymbolExportLevel::C); } - tcx.arena.alloc(reachable_non_generics) + reachable_non_generics } fn is_reachable_non_generic_provider_local(tcx: TyCtxt<'_>, def_id: DefId) -> bool { @@ -281,7 +278,7 @@ fn exported_symbols_provider_local( fn upstream_monomorphizations_provider( tcx: TyCtxt<'_>, cnum: CrateNum, -) -> &DefIdMap<FxHashMap<SubstsRef<'_>, CrateNum>> { +) -> DefIdMap<FxHashMap<SubstsRef<'_>, CrateNum>> { debug_assert!(cnum == LOCAL_CRATE); let cnums = tcx.all_crate_nums(LOCAL_CRATE); @@ -338,7 +335,7 @@ fn upstream_monomorphizations_provider( } } - tcx.arena.alloc(instances) + instances } fn upstream_monomorphizations_for_provider( diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index cd43ca8257e..fc6b547c5e7 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -908,7 +908,7 @@ pub fn provide_both(providers: &mut Providers<'_>) { .map(|id| &module_map[&id]) .flat_map(|module| module.foreign_items.iter().cloned()) .collect(); - tcx.arena.alloc(dllimports) + dllimports }; providers.is_dllimport_foreign_item = |
