diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2021-03-29 11:18:52 +0200 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2021-03-30 18:57:03 +0200 |
| commit | 8331dbe6d023a168334a7a46f15731c6bc1baf1e (patch) | |
| tree | e322cb345ff131fc3120074956a48288871016e2 /compiler/rustc_codegen_ssa | |
| parent | 3aedcf06b73fc36feeebca3d579e1d2a6c40acc5 (diff) | |
| download | rust-8331dbe6d023a168334a7a46f15731c6bc1baf1e.tar.gz rust-8331dbe6d023a168334a7a46f15731c6bc1baf1e.zip | |
Add an Mmap wrapper to rustc_data_structures
This wrapper implements StableAddress and falls back to directly reading the file on wasm32
Diffstat (limited to 'compiler/rustc_codegen_ssa')
| -rw-r--r-- | compiler/rustc_codegen_ssa/Cargo.toml | 1 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/lto.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/write.rs | 3 |
3 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_ssa/Cargo.toml b/compiler/rustc_codegen_ssa/Cargo.toml index 15dbbbd49aa..7c1aaebb9ab 100644 --- a/compiler/rustc_codegen_ssa/Cargo.toml +++ b/compiler/rustc_codegen_ssa/Cargo.toml @@ -11,7 +11,6 @@ test = false bitflags = "1.2.1" cc = "1.0.1" itertools = "0.9" -memmap2 = "0.2.1" tracing = "0.1" libc = "0.2.50" jobserver = "0.1.11" diff --git a/compiler/rustc_codegen_ssa/src/back/lto.rs b/compiler/rustc_codegen_ssa/src/back/lto.rs index c6aea22a63e..0ff05229466 100644 --- a/compiler/rustc_codegen_ssa/src/back/lto.rs +++ b/compiler/rustc_codegen_ssa/src/back/lto.rs @@ -2,6 +2,7 @@ use super::write::CodegenContext; use crate::traits::*; use crate::ModuleCodegen; +use rustc_data_structures::memmap::Mmap; use rustc_errors::FatalError; use std::ffi::CString; @@ -93,7 +94,7 @@ impl<B: WriteBackendMethods> LtoModuleCodegen<B> { pub enum SerializedModule<M: ModuleBufferMethods> { Local(M), FromRlib(Vec<u8>), - FromUncompressedFile(memmap2::Mmap), + FromUncompressedFile(Mmap), } impl<M: ModuleBufferMethods> SerializedModule<M> { diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 7a8d8fb1304..44a055a092c 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -10,6 +10,7 @@ use crate::{ use crate::traits::*; use jobserver::{Acquired, Client}; use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::memmap::Mmap; use rustc_data_structures::profiling::SelfProfilerRef; use rustc_data_structures::profiling::TimingGuard; use rustc_data_structures::profiling::VerboseTimingGuard; @@ -1958,7 +1959,7 @@ pub fn submit_pre_lto_module_to_llvm<B: ExtraBackendMethods>( .unwrap_or_else(|e| panic!("failed to open bitcode file `{}`: {}", bc_path.display(), e)); let mmap = unsafe { - memmap2::Mmap::map(&file).unwrap_or_else(|e| { + Mmap::map(file).unwrap_or_else(|e| { panic!("failed to mmap bitcode file `{}`: {}", bc_path.display(), e) }) }; |
