Skip to content

Commit 0f5cd40

Browse files
committed
Remove __VERIFIER_assume
1 parent 59a72e9 commit 0f5cd40

File tree

6 files changed

+24
-117
lines changed

6 files changed

+24
-117
lines changed

src/concurrency/genmc/dummy.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,17 @@ impl GenmcCtx {
241241
) -> InterpResult<'tcx> {
242242
unreachable!()
243243
}
244+
245+
/**** Blocking instructions ****/
246+
247+
#[allow(unused)]
248+
pub(crate) fn handle_verifier_assume<'tcx>(
249+
&self,
250+
_machine: &MiriMachine<'tcx>,
251+
_condition: bool,
252+
) -> InterpResult<'tcx, ()> {
253+
unreachable!()
254+
}
244255
}
245256

246257
/// Other functionality not directly related to event handling
@@ -261,12 +272,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
261272
fn genmc_schedule_thread(&mut self) -> InterpResult<'tcx, ThreadId> {
262273
unreachable!()
263274
}
264-
265-
/**** Blocking instructions ****/
266-
267-
fn handle_genmc_verifier_assume(&mut self, _condition: &OpTy<'tcx>) -> InterpResult<'tcx> {
268-
unreachable!()
269-
}
270275
}
271276

272277
impl VisitProvenance for GenmcCtx {

src/concurrency/genmc/mod.rs

Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,17 @@ impl GenmcCtx {
696696
}
697697
interp_ok(())
698698
}
699+
700+
/**** Blocking instructions ****/
701+
702+
#[allow(unused)]
703+
pub(crate) fn handle_verifier_assume<'tcx>(
704+
&self,
705+
machine: &MiriMachine<'tcx>,
706+
condition: bool,
707+
) -> InterpResult<'tcx, ()> {
708+
if condition { interp_ok(()) } else { self.handle_user_block(machine) }
709+
}
699710
}
700711

701712
impl GenmcCtx {
@@ -923,17 +934,8 @@ impl GenmcCtx {
923934

924935
/**** Blocking functionality ****/
925936

926-
fn handle_user_block<'tcx>(&self, machine: &MiriMachine<'tcx>) -> InterpResult<'tcx> {
927-
let thread_infos = self.thread_infos.borrow();
928-
let curr_thread = machine.threads.active_thread();
929-
let genmc_curr_thread = thread_infos.get_info(curr_thread).genmc_tid;
930-
info!("GenMC: handle_user_block, blocking thread {curr_thread:?} ({genmc_curr_thread:?})");
931-
932-
let mut mc = self.handle.borrow_mut();
933-
let pinned_mc = mc.as_mut();
934-
pinned_mc.handleUserBlock(genmc_curr_thread.0);
935-
936-
interp_ok(())
937+
fn handle_user_block<'tcx>(&self, _machine: &MiriMachine<'tcx>) -> InterpResult<'tcx> {
938+
todo!()
937939
}
938940
}
939941

@@ -1122,40 +1124,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
11221124
return interp_ok(next_thread_id);
11231125
}
11241126
}
1125-
1126-
/**** Blocking instructions ****/
1127-
1128-
/// Handle an `assume` statement. This will tell GenMC to block the current thread if the `condition` is false.
1129-
/// Returns `true` if the current thread should be blocked in Miri too.
1130-
fn handle_genmc_verifier_assume(&mut self, condition: &OpTy<'tcx>) -> InterpResult<'tcx> {
1131-
let this = self.eval_context_mut();
1132-
let condition_bool = this.read_scalar(condition)?.to_bool()?;
1133-
info!("GenMC: handle_genmc_verifier_assume, condition: {condition:?} = {condition_bool}");
1134-
if condition_bool {
1135-
return interp_ok(());
1136-
}
1137-
let genmc_ctx = this.machine.data_race.as_genmc_ref().unwrap();
1138-
genmc_ctx.handle_user_block(&this.machine)?;
1139-
let condition = condition.clone();
1140-
this.block_thread(
1141-
BlockReason::GenmcAssume,
1142-
None,
1143-
callback!(
1144-
@capture<'tcx> {
1145-
condition: OpTy<'tcx>,
1146-
}
1147-
|this, unblock: UnblockKind| {
1148-
assert_eq!(unblock, UnblockKind::Ready);
1149-
1150-
let condition = this.run_for_validation_ref(|this| this.read_scalar(&condition))?.to_bool()?;
1151-
assert!(condition);
1152-
1153-
interp_ok(())
1154-
}
1155-
),
1156-
);
1157-
interp_ok(())
1158-
}
11591127
}
11601128

11611129
impl VisitProvenance for GenmcCtx {

src/shims/foreign_items.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use rustc_target::callconv::FnAbi;
1717
use self::helpers::{ToHost, ToSoft};
1818
use super::alloc::EvalContextExt as _;
1919
use super::backtrace::EvalContextExt as _;
20-
use crate::concurrency::GenmcEvalContextExt as _;
2120
use crate::*;
2221

2322
/// Type of dynamic symbols (for `dlsym` et al)
@@ -440,22 +439,6 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
440439
}
441440
}
442441

443-
/*** \/ GENMC VERIFIER CALLS \/ ****/
444-
"miri_genmc_verifier_assume" => {
445-
let [condition] =
446-
this.check_shim_sig_lenient(abi, CanonAbi::Rust, link_name, args)?;
447-
if this.machine.data_race.as_genmc_ref().is_some() {
448-
this.handle_genmc_verifier_assume(condition)?;
449-
} else {
450-
tracing::warn!(
451-
"GenMC: function `miri_genmc_verifier_assume` used, but GenMC mode is not active, skip ..."
452-
);
453-
}
454-
}
455-
456-
// TODO GENMC: add other genmc functions
457-
458-
/*** /\ GENMC VERIFIER CALLS /\ ****/
459442
// Aborting the process.
460443
"exit" => {
461444
let [code] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;

tests/genmc/pass/litmus/assume-ctrl/assume-ctrl.rs

Lines changed: 0 additions & 42 deletions
This file was deleted.

tests/genmc/pass/litmus/assume-ctrl/assume-ctrl.stderr

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/utils/miri_extern.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,4 @@ extern "Rust" {
147147
/// "symbolic" alignment checks. Will fail if the pointer is not actually aligned or `align` is
148148
/// not a power of two. Has no effect when alignment checks are concrete (which is the default).
149149
pub fn miri_promise_symbolic_alignment(ptr: *const (), align: usize);
150-
151-
/// Blocks the current execution if the argument is false
152-
pub fn miri_genmc_verifier_assume(condition: bool);
153150
}

0 commit comments

Comments
 (0)