Skip to content

Commit

Permalink
Move AtomicU64 usage to AtomicUsize
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Dec 17, 2019
1 parent 47bb760 commit c0dbd99
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/librustc/dep_graph/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_index::vec::{Idx, IndexVec};
use smallvec::SmallVec;
use rustc_data_structures::sync::{Lrc, Lock, AtomicU32, AtomicU64, Ordering};
use rustc_data_structures::sync::{Lrc, Lock, AtomicU32, AtomicUsize, Ordering};
use rustc_data_structures::sharded::{self, Sharded};
use std::sync::atomic::Ordering::SeqCst;
use std::env;
Expand Down Expand Up @@ -485,8 +485,8 @@ impl DepGraph {
if cfg!(debug_assertions) {
let current_dep_graph = &self.data.as_ref().unwrap().current;

Some((current_dep_graph.total_read_count.load(SeqCst),
current_dep_graph.total_duplicate_read_count.load(SeqCst)))
Some((current_dep_graph.total_read_count.load(SeqCst) as u64,
current_dep_graph.total_duplicate_read_count.load(SeqCst) as u64))
} else {
None
}
Expand Down Expand Up @@ -970,8 +970,8 @@ pub(super) struct CurrentDepGraph {

/// These are simple counters that are for profiling and
/// debugging and only active with `debug_assertions`.
total_read_count: AtomicU64,
total_duplicate_read_count: AtomicU64,
total_read_count: AtomicUsize,
total_duplicate_read_count: AtomicUsize,
}

impl CurrentDepGraph {
Expand Down Expand Up @@ -1012,8 +1012,8 @@ impl CurrentDepGraph {
)),
anon_id_seed: stable_hasher.finish(),
forbidden_edge,
total_read_count: AtomicU64::new(0),
total_duplicate_read_count: AtomicU64::new(0),
total_read_count: AtomicUsize::new(0),
total_duplicate_read_count: AtomicUsize::new(0),
}
}

Expand Down
1 change: 1 addition & 0 deletions src/librustc_data_structures/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#![feature(integer_atomics)]
#![feature(test)]
#![feature(associated_type_bounds)]
#![feature(cfg_target_has_atomic)]

#![cfg_attr(unix, feature(libc))]

Expand Down
4 changes: 3 additions & 1 deletion src/librustc_data_structures/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,9 @@ cfg_if! {
pub use parking_lot::MutexGuard as LockGuard;
pub use parking_lot::MappedMutexGuard as MappedLockGuard;

pub use std::sync::atomic::{AtomicBool, AtomicUsize, AtomicU32, AtomicU64};
pub use std::sync::atomic::{AtomicBool, AtomicUsize, AtomicU32};
#[cfg(target_has_atomic = "64")]
pub use std::sync::atomic::{AtomicU64};

pub use crossbeam_utils::atomic::AtomicCell;

Expand Down
6 changes: 3 additions & 3 deletions src/librustc_session/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use rustc_errors::ErrorReported;

use rustc_data_structures::base_n;
use rustc_data_structures::sync::{
self, Lrc, Lock, OneThread, Once, AtomicU64, AtomicUsize, Ordering,
self, Lrc, Lock, OneThread, Once, AtomicUsize, Ordering,
Ordering::SeqCst,
};
use rustc_data_structures::impl_stable_hash_via_hash;
Expand Down Expand Up @@ -119,7 +119,7 @@ pub struct Session {
/// If `-zprint-fuel=crate`, `Some(crate)`.
pub print_fuel_crate: Option<String>,
/// Always set to zero and incremented so that we can print fuel expended by a crate.
pub print_fuel: AtomicU64,
pub print_fuel: AtomicUsize,

/// Loaded up early on in the initialization of this `Session` to avoid
/// false positives about a job server in our environment.
Expand Down Expand Up @@ -1116,7 +1116,7 @@ fn build_session_(
out_of_fuel: false,
});
let print_fuel_crate = sopts.debugging_opts.print_fuel.clone();
let print_fuel = AtomicU64::new(0);
let print_fuel = AtomicUsize::new(0);

let working_dir = env::current_dir().unwrap_or_else(|e|
parse_sess.span_diagnostic
Expand Down

0 comments on commit c0dbd99

Please sign in to comment.