mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 19:58:32 +00:00
mv CachingCodemapView CachingSourceMapView
This commit is contained in:
parent
062bfbf39b
commit
a2ff845f3a
@ -23,14 +23,14 @@ struct CacheEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct CachingCodemapView<'cm> {
|
pub struct CachingSourceMapView<'cm> {
|
||||||
source_map: &'cm SourceMap,
|
source_map: &'cm SourceMap,
|
||||||
line_cache: [CacheEntry; 3],
|
line_cache: [CacheEntry; 3],
|
||||||
time_stamp: usize,
|
time_stamp: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'cm> CachingCodemapView<'cm> {
|
impl<'cm> CachingSourceMapView<'cm> {
|
||||||
pub fn new(source_map: &'cm SourceMap) -> CachingCodemapView<'cm> {
|
pub fn new(source_map: &'cm SourceMap) -> CachingSourceMapView<'cm> {
|
||||||
let files = source_map.files();
|
let files = source_map.files();
|
||||||
let first_file = files[0].clone();
|
let first_file = files[0].clone();
|
||||||
let entry = CacheEntry {
|
let entry = CacheEntry {
|
||||||
@ -42,7 +42,7 @@ impl<'cm> CachingCodemapView<'cm> {
|
|||||||
file_index: 0,
|
file_index: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
CachingCodemapView {
|
CachingSourceMapView {
|
||||||
source_map,
|
source_map,
|
||||||
line_cache: [entry.clone(), entry.clone(), entry.clone()],
|
line_cache: [entry.clone(), entry.clone(), entry.clone()],
|
||||||
time_stamp: 0,
|
time_stamp: 0,
|
||||||
|
@ -12,7 +12,7 @@ use hir;
|
|||||||
use hir::def_id::{DefId, DefIndex};
|
use hir::def_id::{DefId, DefIndex};
|
||||||
use hir::map::DefPathHash;
|
use hir::map::DefPathHash;
|
||||||
use hir::map::definitions::Definitions;
|
use hir::map::definitions::Definitions;
|
||||||
use ich::{self, CachingCodemapView, Fingerprint};
|
use ich::{self, CachingSourceMapView, Fingerprint};
|
||||||
use middle::cstore::CrateStore;
|
use middle::cstore::CrateStore;
|
||||||
use ty::{TyCtxt, fast_reject};
|
use ty::{TyCtxt, fast_reject};
|
||||||
use mir::interpret::AllocId;
|
use mir::interpret::AllocId;
|
||||||
@ -57,9 +57,9 @@ pub struct StableHashingContext<'a> {
|
|||||||
node_id_hashing_mode: NodeIdHashingMode,
|
node_id_hashing_mode: NodeIdHashingMode,
|
||||||
|
|
||||||
// Very often, we are hashing something that does not need the
|
// Very often, we are hashing something that does not need the
|
||||||
// CachingCodemapView, so we initialize it lazily.
|
// CachingSourceMapView, so we initialize it lazily.
|
||||||
raw_source_map: &'a SourceMap,
|
raw_source_map: &'a SourceMap,
|
||||||
caching_source_map: Option<CachingCodemapView<'a>>,
|
caching_source_map: Option<CachingSourceMapView<'a>>,
|
||||||
|
|
||||||
pub(super) alloc_id_recursion_tracker: FxHashSet<AllocId>,
|
pub(super) alloc_id_recursion_tracker: FxHashSet<AllocId>,
|
||||||
}
|
}
|
||||||
@ -169,13 +169,13 @@ impl<'a> StableHashingContext<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn source_map(&mut self) -> &mut CachingCodemapView<'a> {
|
pub fn source_map(&mut self) -> &mut CachingSourceMapView<'a> {
|
||||||
match self.caching_source_map {
|
match self.caching_source_map {
|
||||||
Some(ref mut cm) => {
|
Some(ref mut cm) => {
|
||||||
cm
|
cm
|
||||||
}
|
}
|
||||||
ref mut none => {
|
ref mut none => {
|
||||||
*none = Some(CachingCodemapView::new(self.raw_source_map));
|
*none = Some(CachingSourceMapView::new(self.raw_source_map));
|
||||||
none.as_mut().unwrap()
|
none.as_mut().unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
//! ICH - Incremental Compilation Hash
|
//! ICH - Incremental Compilation Hash
|
||||||
|
|
||||||
crate use rustc_data_structures::fingerprint::Fingerprint;
|
crate use rustc_data_structures::fingerprint::Fingerprint;
|
||||||
pub use self::caching_codemap_view::CachingCodemapView;
|
pub use self::caching_codemap_view::CachingSourceMapView;
|
||||||
pub use self::hcx::{StableHashingContextProvider, StableHashingContext, NodeIdHashingMode,
|
pub use self::hcx::{StableHashingContextProvider, StableHashingContext, NodeIdHashingMode,
|
||||||
hash_stable_trait_impls};
|
hash_stable_trait_impls};
|
||||||
mod caching_codemap_view;
|
mod caching_codemap_view;
|
||||||
|
@ -14,7 +14,7 @@ use hir;
|
|||||||
use hir::def_id::{CrateNum, DefIndex, DefId, LocalDefId,
|
use hir::def_id::{CrateNum, DefIndex, DefId, LocalDefId,
|
||||||
RESERVED_FOR_INCR_COMP_CACHE, LOCAL_CRATE};
|
RESERVED_FOR_INCR_COMP_CACHE, LOCAL_CRATE};
|
||||||
use hir::map::definitions::DefPathHash;
|
use hir::map::definitions::DefPathHash;
|
||||||
use ich::{CachingCodemapView, Fingerprint};
|
use ich::{CachingSourceMapView, Fingerprint};
|
||||||
use mir::{self, interpret};
|
use mir::{self, interpret};
|
||||||
use mir::interpret::{AllocDecodingSession, AllocDecodingState};
|
use mir::interpret::{AllocDecodingSession, AllocDecodingState};
|
||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
@ -196,7 +196,7 @@ impl<'sess> OnDiskCache<'sess> {
|
|||||||
expn_info_shorthands: FxHashMap(),
|
expn_info_shorthands: FxHashMap(),
|
||||||
interpret_allocs: FxHashMap(),
|
interpret_allocs: FxHashMap(),
|
||||||
interpret_allocs_inverse: Vec::new(),
|
interpret_allocs_inverse: Vec::new(),
|
||||||
source_map: CachingCodemapView::new(tcx.sess.source_map()),
|
source_map: CachingSourceMapView::new(tcx.sess.source_map()),
|
||||||
file_to_file_index,
|
file_to_file_index,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -770,7 +770,7 @@ struct CacheEncoder<'enc, 'a, 'tcx, E>
|
|||||||
expn_info_shorthands: FxHashMap<Mark, AbsoluteBytePos>,
|
expn_info_shorthands: FxHashMap<Mark, AbsoluteBytePos>,
|
||||||
interpret_allocs: FxHashMap<interpret::AllocId, usize>,
|
interpret_allocs: FxHashMap<interpret::AllocId, usize>,
|
||||||
interpret_allocs_inverse: Vec<interpret::AllocId>,
|
interpret_allocs_inverse: Vec<interpret::AllocId>,
|
||||||
source_map: CachingCodemapView<'tcx>,
|
source_map: CachingSourceMapView<'tcx>,
|
||||||
file_to_file_index: FxHashMap<*const SourceFile, SourceFileIndex>,
|
file_to_file_index: FxHashMap<*const SourceFile, SourceFileIndex>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user