@@ -18,11 +18,10 @@ use self::helper::{
18
18
use self :: mapping:: { min_max_to_genmc_rmw_op, to_genmc_rmw_op} ;
19
19
use self :: thread_info_manager:: ThreadInfoManager ;
20
20
use crate :: concurrency:: genmc:: helper:: { is_terminator_atomic, split_access} ;
21
- use crate :: concurrency:: thread:: { EvalContextExt as _, ThreadState } ;
22
21
use crate :: {
23
- AtomicFenceOrd , AtomicReadOrd , AtomicRwOrd , AtomicWriteOrd , BlockReason , MemoryKind ,
24
- MiriConfig , MiriMachine , MiriMemoryKind , Scalar , TerminationInfo , ThreadId , ThreadManager ,
25
- VisitProvenance , VisitWith ,
22
+ AtomicFenceOrd , AtomicReadOrd , AtomicRwOrd , AtomicWriteOrd , MemoryKind , MiriConfig ,
23
+ MiriMachine , MiriMemoryKind , Scalar , TerminationInfo , ThreadId , ThreadManager , VisitProvenance ,
24
+ VisitWith ,
26
25
} ;
27
26
28
27
mod config;
@@ -843,7 +842,7 @@ impl GenmcCtx {
843
842
844
843
/**** Scheduling functionality ****/
845
844
846
- fn schedule_thread < ' tcx > (
845
+ pub fn schedule_thread < ' tcx > (
847
846
& self ,
848
847
ecx : & InterpCx < ' tcx , MiriMachine < ' tcx > > ,
849
848
) -> InterpResult < ' tcx , ThreadId > {
@@ -910,49 +909,6 @@ impl GenmcCtx {
910
909
}
911
910
}
912
911
913
- /// Other functionality not directly related to event handling
914
- impl < ' tcx > EvalContextExt < ' tcx > for crate :: MiriInterpCx < ' tcx > { }
915
- pub trait EvalContextExt < ' tcx > : crate :: MiriInterpCxExt < ' tcx > {
916
- /**** Scheduling functionality ****/
917
-
918
- /// Ask for a scheduling decision. This should be called before every MIR instruction.
919
- ///
920
- /// GenMC may realize that the execution is blocked, then this function will return a `InterpErrorKind::MachineStop` with error kind `TerminationInfo::GenmcBlockedExecution`).
921
- ///
922
- /// This is **not** an error by iself! Treat this as if the program ended normally: `handle_execution_end` should be called next, which will determine if were are any actual errors.
923
- fn genmc_schedule_thread ( & mut self ) -> InterpResult < ' tcx , ThreadId > {
924
- let this = self . eval_context_mut ( ) ;
925
- loop {
926
- let genmc_ctx = this. machine . data_race . as_genmc_ref ( ) . unwrap ( ) ;
927
- let next_thread_id = genmc_ctx. schedule_thread ( this) ?;
928
-
929
- match this. machine . threads . threads_ref ( ) [ next_thread_id] . get_state ( ) {
930
- ThreadState :: Blocked {
931
- reason : block_reason @ ( BlockReason :: Mutex | BlockReason :: GenmcAssume ) ,
932
- ..
933
- } => {
934
- info ! (
935
- "GenMC: schedule returned thread {next_thread_id:?}, which is blocked, so we unblock it now."
936
- ) ;
937
- this. unblock_thread ( next_thread_id, * block_reason) ?;
938
-
939
- // In some cases, like waiting on a Mutex::lock, the thread might still be blocked here:
940
- if this. machine . threads . threads_ref ( ) [ next_thread_id]
941
- . get_state ( )
942
- . is_blocked_on ( crate :: BlockReason :: Mutex )
943
- {
944
- info ! ( "GenMC: Unblocked thread is blocked on a Mutex again!" ) ;
945
- continue ;
946
- }
947
- }
948
- _ => { }
949
- }
950
-
951
- return interp_ok ( next_thread_id) ;
952
- }
953
- }
954
- }
955
-
956
912
impl VisitProvenance for GenmcCtx {
957
913
fn visit_provenance ( & self , _visit : & mut VisitWith < ' _ > ) {
958
914
// We don't have any tags.
0 commit comments