move vector_clock and sync into concurrency & make vector_clock private
move thread it back
This commit is contained in:
parent
ab88e64b15
commit
b073fe2537
@ -54,7 +54,10 @@
|
|||||||
|
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
use super::weak_memory::EvalContextExt as _;
|
use super::{
|
||||||
|
vector_clock::{VClock, VTimestamp, VectorIdx},
|
||||||
|
weak_memory::EvalContextExt as _,
|
||||||
|
};
|
||||||
|
|
||||||
pub type AllocExtra = VClockAlloc;
|
pub type AllocExtra = VClockAlloc;
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
pub mod data_race;
|
pub mod data_race;
|
||||||
mod range_object_map;
|
mod range_object_map;
|
||||||
|
pub mod sync;
|
||||||
|
mod vector_clock;
|
||||||
pub mod weak_memory;
|
pub mod weak_memory;
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
use rustc_index::vec::{Idx, IndexVec};
|
use rustc_index::vec::{Idx, IndexVec};
|
||||||
|
|
||||||
|
use super::vector_clock::VClock;
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
/// We cannot use the `newtype_index!` macro because we have to use 0 as a
|
/// We cannot use the `newtype_index!` macro because we have to use 0 as a
|
||||||
@ -150,7 +151,7 @@ struct FutexWaiter {
|
|||||||
|
|
||||||
/// The state of all synchronization variables.
|
/// The state of all synchronization variables.
|
||||||
#[derive(Default, Debug)]
|
#[derive(Default, Debug)]
|
||||||
pub(super) struct SynchronizationState {
|
pub(crate) struct SynchronizationState {
|
||||||
mutexes: IndexVec<MutexId, Mutex>,
|
mutexes: IndexVec<MutexId, Mutex>,
|
||||||
rwlocks: IndexVec<RwLockId, RwLock>,
|
rwlocks: IndexVec<RwLockId, RwLock>,
|
||||||
condvars: IndexVec<CondvarId, Condvar>,
|
condvars: IndexVec<CondvarId, Condvar>,
|
@ -87,6 +87,7 @@
|
|||||||
use super::{
|
use super::{
|
||||||
data_race::{GlobalState as DataRaceState, ThreadClockSet},
|
data_race::{GlobalState as DataRaceState, ThreadClockSet},
|
||||||
range_object_map::{AccessType, RangeObjectMap},
|
range_object_map::{AccessType, RangeObjectMap},
|
||||||
|
vector_clock::{VClock, VTimestamp, VectorIdx},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub type AllocExtra = StoreBufferAlloc;
|
pub type AllocExtra = StoreBufferAlloc;
|
||||||
|
16
src/lib.rs
16
src/lib.rs
@ -61,9 +61,7 @@
|
|||||||
mod range_map;
|
mod range_map;
|
||||||
mod shims;
|
mod shims;
|
||||||
mod stacked_borrows;
|
mod stacked_borrows;
|
||||||
mod sync;
|
pub mod thread;
|
||||||
mod thread;
|
|
||||||
mod vector_clock;
|
|
||||||
|
|
||||||
// Establish a "crate-wide prelude": we often import `crate::*`.
|
// Establish a "crate-wide prelude": we often import `crate::*`.
|
||||||
|
|
||||||
@ -87,17 +85,17 @@
|
|||||||
EvalContextExt as DataRaceEvalContextExt,
|
EvalContextExt as DataRaceEvalContextExt,
|
||||||
};
|
};
|
||||||
pub use crate::diagnostics::{
|
pub use crate::diagnostics::{
|
||||||
register_diagnostic, report_error, EvalContextExt as DiagnosticsEvalContextExt,
|
EvalContextExt as DiagnosticsEvalContextExt, NonHaltingDiagnostic, register_diagnostic,
|
||||||
NonHaltingDiagnostic, TerminationInfo,
|
report_error, TerminationInfo,
|
||||||
};
|
};
|
||||||
pub use crate::eval::{
|
pub use crate::eval::{
|
||||||
create_ecx, eval_entry, AlignmentCheck, BacktraceStyle, IsolatedOp, MiriConfig, RejectOpWith,
|
AlignmentCheck, BacktraceStyle, create_ecx, eval_entry, IsolatedOp, MiriConfig, RejectOpWith,
|
||||||
};
|
};
|
||||||
pub use crate::helpers::{CurrentSpan, EvalContextExt as HelpersEvalContextExt};
|
pub use crate::helpers::{CurrentSpan, EvalContextExt as HelpersEvalContextExt};
|
||||||
pub use crate::intptrcast::ProvenanceMode;
|
pub use crate::intptrcast::ProvenanceMode;
|
||||||
pub use crate::machine::{
|
pub use crate::machine::{
|
||||||
AllocExtra, Evaluator, FrameData, MiriEvalContext, MiriEvalContextExt, MiriMemoryKind,
|
AllocExtra, Evaluator, FrameData, MiriEvalContext, MiriEvalContextExt, MiriMemoryKind,
|
||||||
Provenance, ProvenanceExtra, NUM_CPUS, PAGE_SIZE, STACK_ADDR, STACK_SIZE,
|
NUM_CPUS, PAGE_SIZE, Provenance, ProvenanceExtra, STACK_ADDR, STACK_SIZE,
|
||||||
};
|
};
|
||||||
pub use crate::mono_hash_map::MonoHashMap;
|
pub use crate::mono_hash_map::MonoHashMap;
|
||||||
pub use crate::operator::EvalContextExt as OperatorEvalContextExt;
|
pub use crate::operator::EvalContextExt as OperatorEvalContextExt;
|
||||||
@ -105,12 +103,10 @@
|
|||||||
pub use crate::stacked_borrows::{
|
pub use crate::stacked_borrows::{
|
||||||
CallId, EvalContextExt as StackedBorEvalContextExt, Item, Permission, SbTag, Stack, Stacks,
|
CallId, EvalContextExt as StackedBorEvalContextExt, Item, Permission, SbTag, Stack, Stacks,
|
||||||
};
|
};
|
||||||
pub use crate::sync::{CondvarId, EvalContextExt as SyncEvalContextExt, MutexId, RwLockId};
|
pub use concurrency::sync::{CondvarId, EvalContextExt as SyncEvalContextExt, MutexId, RwLockId};
|
||||||
pub use crate::thread::{
|
pub use crate::thread::{
|
||||||
EvalContextExt as ThreadsEvalContextExt, SchedulingAction, ThreadId, ThreadManager, ThreadState,
|
EvalContextExt as ThreadsEvalContextExt, SchedulingAction, ThreadId, ThreadManager, ThreadState,
|
||||||
};
|
};
|
||||||
pub use crate::vector_clock::{VClock, VTimestamp, VectorIdx};
|
|
||||||
|
|
||||||
/// Insert rustc arguments at the beginning of the argument list that Miri wants to be
|
/// Insert rustc arguments at the beginning of the argument list that Miri wants to be
|
||||||
/// set per default, for maximal validation power.
|
/// set per default, for maximal validation power.
|
||||||
pub const MIRI_DEFAULT_ARGS: &[&str] = &[
|
pub const MIRI_DEFAULT_ARGS: &[&str] = &[
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use std::time::{Duration, Instant, SystemTime};
|
use std::time::{Duration, Instant, SystemTime};
|
||||||
|
|
||||||
|
use crate::thread::Time;
|
||||||
use crate::*;
|
use crate::*;
|
||||||
use thread::Time;
|
|
||||||
|
|
||||||
/// Returns the time elapsed between the provided time and the unix epoch as a `Duration`.
|
/// Returns the time elapsed between the provided time and the unix epoch as a `Duration`.
|
||||||
pub fn system_time_to_duration<'tcx>(time: &SystemTime) -> InterpResult<'tcx, Duration> {
|
pub fn system_time_to_duration<'tcx>(time: &SystemTime) -> InterpResult<'tcx, Duration> {
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
use rustc_hir::LangItem;
|
use rustc_hir::LangItem;
|
||||||
use rustc_middle::ty::{layout::TyAndLayout, query::TyCtxtAt, subst::Subst, Ty};
|
use rustc_middle::ty::{layout::TyAndLayout, query::TyCtxtAt, subst::Subst, Ty};
|
||||||
|
|
||||||
|
use crate::thread::Time;
|
||||||
use crate::*;
|
use crate::*;
|
||||||
use thread::Time;
|
|
||||||
|
|
||||||
// pthread_mutexattr_t is either 4 or 8 bytes, depending on the platform.
|
// pthread_mutexattr_t is either 4 or 8 bytes, depending on the platform.
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
use rustc_target::spec::abi::Abi;
|
use rustc_target::spec::abi::Abi;
|
||||||
|
|
||||||
use crate::concurrency::data_race;
|
use crate::concurrency::data_race;
|
||||||
use crate::sync::SynchronizationState;
|
use crate::concurrency::sync::SynchronizationState;
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
|
Loading…
Reference in New Issue
Block a user