Skip to content

Commit a42452b

Browse files
committed
Clean up TODOs and comments, improve error handling and remove accidental changes.
1 parent e112b22 commit a42452b

File tree

15 files changed

+59
-89
lines changed

15 files changed

+59
-89
lines changed

Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ name = "miri"
1717
test = false # we have no unit tests
1818
doctest = false # and no doc tests
1919

20-
[profile.bench]
21-
debug = true
22-
2320
[dependencies]
2421
getrandom = { version = "0.3", features = ["std"] }
2522
rand = "0.9"

genmc-sys/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
genmc-src*/
2-
genmc*/

genmc-sys/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ mod downloading {
2626
use super::GENMC_DOWNLOAD_PATH;
2727

2828
/// The GenMC repository the we get our commit from.
29-
pub(crate) const GENMC_GITHUB_URL: &str = "https://github.com/MPI-SWS/genmc.git";
29+
pub(crate) const GENMC_GITHUB_URL: &str = "https://github.com/Patrick-6/genmc.git";
3030
/// The GenMC commit we depend on. It must be available on the specified GenMC repository.
31-
pub(crate) const GENMC_COMMIT: &str = "3438dd2c1202cd4a47ed7881d099abf23e4167ab";
31+
pub(crate) const GENMC_COMMIT: &str = "56997d85fc9c07f75431570d49ce4892b22b8e6e";
3232

3333
pub(crate) fn download_genmc() -> PathBuf {
3434
let Ok(genmc_download_path) = PathBuf::from_str(GENMC_DOWNLOAD_PATH);

genmc-sys/src/lib.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pub use cxx::UniquePtr;
33
pub use self::ffi::*;
44

55
/// Defined in "genmc/src/Support/SAddr.hpp"
6-
/// FIXME: currently we use `getGlobalAllocStaticMask()` to ensure the constant is consistent between Miri and GenMC,
6+
/// FIXME(genmc): `getGlobalAllocStaticMask()` is used to ensure the constant is consistent between Miri and GenMC,
77
/// but if https://github.com/dtolnay/cxx/issues/1051 is fixed we could share the constant directly.
88
pub const GENMC_GLOBAL_ADDRESSES_MASK: u64 = 1 << 63;
99

@@ -36,9 +36,9 @@ mod ffi {
3636
/// (The fields of this struct are visible to both Rust and C++)
3737
#[derive(Clone, Debug)]
3838
struct GenmcParams {
39-
// pub genmc_seed: u64; // OR: Option<u64>
4039
pub print_random_schedule_seed: bool,
4140
pub do_symmetry_reduction: bool,
41+
// FIXME(GenMC): Add remaining parameters.
4242
}
4343

4444
#[derive(Debug)]
@@ -68,18 +68,20 @@ mod ffi {
6868

6969
/**** \/ Result & Error types \/ ****/
7070

71+
// FIXME(genmc): Rework error handling (likely requires changes on the GenMC side).
72+
7173
#[must_use]
7274
#[derive(Debug)]
7375
struct LoadResult {
7476
is_read_opt: bool,
75-
read_value: GenmcScalar, // TODO GENMC: handle bigger values
76-
error: UniquePtr<CxxString>, // TODO GENMC: pass more error info here
77+
read_value: GenmcScalar,
78+
error: UniquePtr<CxxString>,
7779
}
7880

7981
#[must_use]
8082
#[derive(Debug)]
8183
struct StoreResult {
82-
error: UniquePtr<CxxString>, // TODO GENMC: pass more error info here
84+
error: UniquePtr<CxxString>,
8385
isCoMaxWrite: bool,
8486
}
8587

genmc-sys/src_cpp/MiriInterface.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,13 @@ auto MiriGenMCShim::createHandle(const GenmcParams &config)
7777

7878
// FIXME(genmc): implement symmetry reduction.
7979
ERROR_ON(config.do_symmetry_reduction,
80-
"Symmetry reduction is currently unsupported in GenMC mode.");
80+
"Symmetry reduction is currently unsupported in GenMC mode.");
8181
conf->symmetryReduction = config.do_symmetry_reduction;
8282

8383
// FIXME(genmc): expose this setting to Miri (useful for testing Miri-GenMC).
8484
conf->schedulePolicy = SchedulePolicy::WF;
8585

86+
// FIXME(genmc): implement estimation mode.
8687
conf->estimate = false;
8788
const auto mode = GenMCDriver::Mode(GenMCDriver::VerificationMode{});
8889

genmc-sys/src_cpp/MiriInterface.hpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@ struct GenmcParams;
2424

2525
using ThreadId = int;
2626

27-
enum class StoreEventType : uint8_t
28-
{
29-
Normal,
30-
CompareExchange,
31-
};
32-
33-
// TODO GENMC: fix naming conventions
34-
3527
struct MiriGenMCShim : private GenMCDriver
3628
{
3729

@@ -52,7 +44,6 @@ struct MiriGenMCShim : private GenMCDriver
5244

5345
/**** Memory access handling ****/
5446

55-
///////////////////
5647
[[nodiscard]] LoadResult handleLoad(ThreadId thread_id, uint64_t address, uint64_t size,
5748
MemOrdering ord, GenmcScalar old_val);
5849
[[nodiscard]] StoreResult handleStore(ThreadId thread_id, uint64_t address, uint64_t size,
@@ -111,8 +102,7 @@ struct MiriGenMCShim : private GenMCDriver
111102

112103
/**** Functions available to Miri ****/
113104

114-
// NOTE: CXX doesn't seem to support exposing static methods to Rust, so we expose this
115-
// function instead
105+
// NOTE: CXX doesn't support exposing static methods to Rust currently, so we expose this function instead.
116106
std::unique_ptr<MiriGenMCShim> createGenmcHandle(const GenmcParams &config);
117107

118108
constexpr auto getGlobalAllocStaticMask() -> uint64_t { return SAddr::staticMask; }

miri-script/src/commands.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ impl Command {
112112
Command::Check { features, flags } => Self::check(features, flags),
113113
Command::Test { bless, target, coverage, features, flags } =>
114114
Self::test(bless, target, coverage, features, flags),
115-
Command::Run { dep, verbose, target, edition, features, flags, flamegraph } =>
116-
Self::run(dep, verbose, target, edition, features, flags, flamegraph),
115+
Command::Run { dep, verbose, target, edition, features, flags } =>
116+
Self::run(dep, verbose, target, edition, features, flags),
117117
Command::Doc { features, flags } => Self::doc(features, flags),
118118
Command::Fmt { flags } => Self::fmt(flags),
119119
Command::Clippy { features, flags } => Self::clippy(features, flags),
@@ -463,7 +463,6 @@ impl Command {
463463
edition: Option<String>,
464464
features: Vec<String>,
465465
flags: Vec<String>,
466-
flamegraph: bool,
467466
) -> Result<()> {
468467
let mut e = MiriEnv::new()?;
469468

@@ -499,18 +498,11 @@ impl Command {
499498
// The basic command that executes the Miri driver.
500499
let mut cmd = if dep {
501500
// We invoke the test suite as that has all the logic for running with dependencies.
502-
let cmd = e
503-
.cargo_cmd(".", "test", &features)
501+
e.cargo_cmd(".", "test", &features)
504502
.args(&["--test", "ui"])
505503
.args(quiet_flag)
506-
.arg("--");
507-
if flamegraph {
508-
cmd.args(&["--miri-run-dep-mode-flamegraph"])
509-
} else {
510-
cmd.args(&["--miri-run-dep-mode"])
511-
}
512-
} else if flamegraph {
513-
cmd!(e.sh, "flamegraph -- {miri_bin}")
504+
.arg("--")
505+
.args(&["--miri-run-dep-mode"])
514506
} else {
515507
cmd!(e.sh, "{miri_bin}")
516508
};

miri-script/src/main.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@ pub enum Command {
9696
/// The flags set in `MIRIFLAGS` are added in front of these flags.
9797
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
9898
flags: Vec<String>,
99-
/// Run with flamegraph (requires cargo-flamegraph to be installed)
100-
#[arg(long)]
101-
flamegraph: bool,
10299
},
103100
/// Build documentation.
104101
Doc {

src/alloc_addresses/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub struct GlobalStateInner {
3333
/// sorted by address. We cannot use a `HashMap` since we can be given an address that is offset
3434
/// from the base address, and we need to find the `AllocId` it belongs to. This is not the
3535
/// *full* inverse of `base_addr`; dead allocations have been removed.
36-
/// TODO GENMC: keep dead allocations in GenMC mode?
36+
/// FIXME(genmc,dead allocs): keep dead allocations in GenMC mode?
3737
int_to_ptr_map: Vec<(u64, AllocId)>,
3838
/// The base address for each allocation. We cannot put that into
3939
/// `AllocExtra` because function pointers also have a base address, and
@@ -510,7 +510,7 @@ impl<'tcx> MiriMachine<'tcx> {
510510
let pos =
511511
global_state.int_to_ptr_map.binary_search_by_key(&addr, |(addr, _)| *addr).unwrap();
512512

513-
// TODO GENMC(DOCUMENTATION):
513+
// FIXME(genmc,dead allocs): keep dead allocations in GenMC mode?
514514
if self.data_race.as_genmc_ref().is_none() {
515515
let removed = global_state.int_to_ptr_map.remove(pos);
516516
assert_eq!(removed, (addr, dead_id)); // double-check that we removed the right thing

src/concurrency/genmc/config.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,11 @@ impl GenmcConfig {
2727
if trimmed_arg.is_empty() {
2828
return Ok(()); // this corresponds to "-Zmiri-genmc"
2929
}
30-
let genmc_config = genmc_config.as_mut().unwrap();
30+
let _genmc_config = genmc_config.as_mut().unwrap();
3131
let Some(trimmed_arg) = trimmed_arg.strip_prefix("-") else {
3232
return Err(format!("Invalid GenMC argument \"-Zmiri-genmc{trimmed_arg}\""));
3333
};
34-
if trimmed_arg == "symmetry-reduction" {
35-
// TODO GENMC (PERFORMANCE): maybe make this the default, have an option to turn it off instead
36-
genmc_config.params.do_symmetry_reduction = true;
37-
} else {
38-
// TODO GENMC: how to properly handle this?
39-
return Err(format!("Invalid GenMC argument: \"-Zmiri-genmc-{trimmed_arg}\""));
40-
}
41-
Ok(())
34+
// FIXME(genmc): Add parsing for remaining parameters.
35+
Err(format!("Invalid GenMC argument: \"-Zmiri-genmc-{trimmed_arg}\""))
4236
}
4337
}

0 commit comments

Comments
 (0)