@@ -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;
@@ -853,7 +852,7 @@ impl GenmcCtx {
853
852
854
853
/**** Scheduling functionality ****/
855
854
856
- fn schedule_thread < ' tcx > (
855
+ pub fn schedule_thread < ' tcx > (
857
856
& self ,
858
857
ecx : & InterpCx < ' tcx , MiriMachine < ' tcx > > ,
859
858
) -> InterpResult < ' tcx , ThreadId > {
@@ -920,49 +919,6 @@ impl GenmcCtx {
920
919
}
921
920
}
922
921
923
- /// Other functionality not directly related to event handling
924
- impl < ' tcx > EvalContextExt < ' tcx > for crate :: MiriInterpCx < ' tcx > { }
925
- pub trait EvalContextExt < ' tcx > : crate :: MiriInterpCxExt < ' tcx > {
926
- /**** Scheduling functionality ****/
927
-
928
- /// Ask for a scheduling decision. This should be called before every MIR instruction.
929
- ///
930
- /// GenMC may realize that the execution is blocked, then this function will return a `InterpErrorKind::MachineStop` with error kind `TerminationInfo::GenmcBlockedExecution`).
931
- ///
932
- /// 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.
933
- fn genmc_schedule_thread ( & mut self ) -> InterpResult < ' tcx , ThreadId > {
934
- let this = self . eval_context_mut ( ) ;
935
- loop {
936
- let genmc_ctx = this. machine . data_race . as_genmc_ref ( ) . unwrap ( ) ;
937
- let next_thread_id = genmc_ctx. schedule_thread ( this) ?;
938
-
939
- match this. machine . threads . threads_ref ( ) [ next_thread_id] . get_state ( ) {
940
- ThreadState :: Blocked {
941
- reason : block_reason @ ( BlockReason :: Mutex | BlockReason :: GenmcAssume ) ,
942
- ..
943
- } => {
944
- info ! (
945
- "GenMC: schedule returned thread {next_thread_id:?}, which is blocked, so we unblock it now."
946
- ) ;
947
- this. unblock_thread ( next_thread_id, * block_reason) ?;
948
-
949
- // In some cases, like waiting on a Mutex::lock, the thread might still be blocked here:
950
- if this. machine . threads . threads_ref ( ) [ next_thread_id]
951
- . get_state ( )
952
- . is_blocked_on ( crate :: BlockReason :: Mutex )
953
- {
954
- info ! ( "GenMC: Unblocked thread is blocked on a Mutex again!" ) ;
955
- continue ;
956
- }
957
- }
958
- _ => { }
959
- }
960
-
961
- return interp_ok ( next_thread_id) ;
962
- }
963
- }
964
- }
965
-
966
922
impl VisitProvenance for GenmcCtx {
967
923
fn visit_provenance ( & self , _visit : & mut VisitWith < ' _ > ) {
968
924
// We don't have any tags.
0 commit comments