diff options
| author | bors <bors@rust-lang.org> | 2020-04-11 15:31:54 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-04-11 15:31:54 +0000 |
| commit | e82734e56b2a50d38e0937d08f559d15dbe8e46b (patch) | |
| tree | 0a466bbbf764ae05b172f937e2cf3e642be4fb08 /src/librustc_codegen_llvm | |
| parent | 76882666eba15a186402a911c227f8e9c1682186 (diff) | |
| parent | 802c0be3a225ff13826288ee7030899ff21bec33 (diff) | |
Auto merge of #70161 - cjgillot:query-arena, r=nikomatsakis
Allocate some query results on an arena This avoids a cloning few `Lrc` and `Vec`s in the queries.
Diffstat (limited to 'src/librustc_codegen_llvm')
| -rw-r--r-- | src/librustc_codegen_llvm/context.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs index 99a825823c3..daa723495f6 100644 --- a/src/librustc_codegen_llvm/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -26,7 +26,6 @@ use rustc_target::spec::{HasTargetSpec, Target}; use std::cell::{Cell, RefCell}; use std::ffi::CStr; use std::str; -use std::sync::Arc; /// There is one `CodegenCx` per compilation unit. Each one has its own LLVM /// `llvm::Context` so that several compilation units may be optimized in parallel. @@ -39,7 +38,7 @@ pub struct CodegenCx<'ll, 'tcx> { pub llmod: &'ll llvm::Module, pub llcx: &'ll llvm::Context, - pub codegen_unit: Arc<CodegenUnit<'tcx>>, + pub codegen_unit: &'tcx CodegenUnit<'tcx>, /// Cache instances of monomorphic and polymorphic items pub instances: RefCell<FxHashMap<Instance<'tcx>, &'ll Value>>, @@ -232,7 +231,7 @@ pub unsafe fn create_module( impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { crate fn new( tcx: TyCtxt<'tcx>, - codegen_unit: Arc<CodegenUnit<'tcx>>, + codegen_unit: &'tcx CodegenUnit<'tcx>, llvm_module: &'ll crate::ModuleLlvm, ) -> Self { // An interesting part of Windows which MSVC forces our hand on (and @@ -402,8 +401,8 @@ impl MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> { self.check_overflow } - fn codegen_unit(&self) -> &Arc<CodegenUnit<'tcx>> { - &self.codegen_unit + fn codegen_unit(&self) -> &'tcx CodegenUnit<'tcx> { + self.codegen_unit } fn used_statics(&self) -> &RefCell<Vec<&'ll Value>> { |
