Skip to content

Commit 2aff762

Browse files
authored
Merge pull request #4661 from michaliskok/genmc-url
Use Github URL to fetch GenMC
2 parents 97c9bc2 + a47726f commit 2aff762

File tree

4 files changed

+20
-18
lines changed

4 files changed

+20
-18
lines changed

src/tools/miri/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://gitlab.inf.ethz.ch/public-plf/genmc.git";
29+
pub(crate) const GENMC_GITHUB_URL: &str = "https://github.com/MPI-SWS/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 = "ce775ccd7866db820fa12ffca66463087a11dd96";
31+
pub(crate) const GENMC_COMMIT: &str = "d9527280bb99f1cef64326b1803ffd952e3880df";
3232

3333
/// Ensure that a local GenMC repo is present and set to the correct commit.
3434
/// Return the path of the GenMC repo and whether the checked out commit was changed.

src/tools/miri/genmc-sys/cpp/include/MiriInterface.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,27 +261,27 @@ namespace GenmcScalarExt {
261261
inline GenmcScalar uninit() {
262262
return GenmcScalar {
263263
.value = 0,
264-
.extra = 0,
264+
.provenance = 0,
265265
.is_init = false,
266266
};
267267
}
268268

269269
inline GenmcScalar from_sval(SVal sval) {
270270
return GenmcScalar {
271271
.value = sval.get(),
272-
.extra = sval.getExtra(),
272+
.provenance = sval.getProvenance(),
273273
.is_init = true,
274274
};
275275
}
276276

277277
inline SVal to_sval(GenmcScalar scalar) {
278278
ERROR_ON(!scalar.is_init, "Cannot convert an uninitialized `GenmcScalar` into an `SVal`\n");
279-
return SVal(scalar.value, scalar.extra);
279+
return SVal(scalar.value, scalar.provenance);
280280
}
281281

282282
inline std::optional<SVal> try_to_sval(GenmcScalar scalar) {
283283
if (scalar.is_init)
284-
return { SVal(scalar.value, scalar.extra) };
284+
return { SVal(scalar.value, scalar.provenance) };
285285
return std::nullopt;
286286
}
287287
} // namespace GenmcScalarExt

src/tools/miri/genmc-sys/src/lib.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ pub fn create_genmc_driver_handle(
4545
}
4646

4747
impl GenmcScalar {
48-
pub const UNINIT: Self = Self { value: 0, extra: 0, is_init: false };
48+
pub const UNINIT: Self = Self { value: 0, provenance: 0, is_init: false };
4949

5050
pub const fn from_u64(value: u64) -> Self {
51-
Self { value, extra: 0, is_init: true }
51+
Self { value, provenance: 0, is_init: true }
5252
}
5353

5454
pub const fn has_provenance(&self) -> bool {
55-
self.extra != 0
55+
self.provenance != 0
5656
}
5757
}
5858

@@ -172,8 +172,9 @@ mod ffi {
172172
value: u64,
173173
/// This is zero for integer values. For pointers, this encodes the provenance by
174174
/// storing the base address of the allocation that this pointer belongs to.
175-
/// Operations on `SVal` in GenMC (e.g., `fetch_add`) preserve the `extra` of the left argument (`left.fetch_add(right, ...)`).
176-
extra: u64,
175+
/// Operations on `SVal` in GenMC (e.g., `fetch_add`) preserve the `provenance` of the left
176+
/// argument (`left.fetch_add(right, ...)`).
177+
provenance: u64,
177178
/// Indicates whether this value is initialized. If this is `false`, the other fields do not matter.
178179
/// (Ideally we'd use `std::optional` but CXX does not support that.)
179180
is_init: bool,

src/tools/miri/src/concurrency/genmc/helper.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub fn scalar_to_genmc_scalar<'tcx>(
5555
rustc_const_eval::interpret::Scalar::Int(scalar_int) => {
5656
// FIXME(genmc): Add u128 support once GenMC supports it.
5757
let value: u64 = scalar_int.to_uint(scalar_int.size()).try_into().unwrap();
58-
GenmcScalar { value, extra: 0, is_init: true }
58+
GenmcScalar { value, provenance: 0, is_init: true }
5959
}
6060
rustc_const_eval::interpret::Scalar::Ptr(pointer, size) => {
6161
// FIXME(genmc,borrow tracking): Borrow tracking information is lost.
@@ -69,7 +69,7 @@ pub fn scalar_to_genmc_scalar<'tcx>(
6969
let base_addr = ecx.addr_from_alloc_id(alloc_id, None)?;
7070
// Add the base_addr alloc_id pair to the map.
7171
genmc_ctx.exec_state.genmc_shared_allocs_map.borrow_mut().insert(base_addr, alloc_id);
72-
GenmcScalar { value: addr.bytes(), extra: base_addr, is_init: true }
72+
GenmcScalar { value: addr.bytes(), provenance: base_addr, is_init: true }
7373
}
7474
})
7575
}
@@ -84,16 +84,17 @@ pub fn genmc_scalar_to_scalar<'tcx>(
8484
scalar: GenmcScalar,
8585
size: Size,
8686
) -> InterpResult<'tcx, Scalar> {
87-
// If `extra` is zero, we have a regular integer.
88-
if scalar.extra == 0 {
87+
// If `provenance` is zero, we have a regular integer.
88+
if scalar.provenance == 0 {
8989
// NOTE: GenMC always returns 64 bit values, and the upper bits are not yet truncated.
9090
// FIXME(genmc): GenMC should be doing the truncation, not Miri.
9191
let (value_scalar_int, _got_truncated) = ScalarInt::truncate_from_uint(scalar.value, size);
9292
return interp_ok(Scalar::from(value_scalar_int));
9393
}
94-
// `extra` is non-zero, we have a pointer.
95-
// When we get a pointer from GenMC, then we must have sent it to GenMC before in the same execution (since the reads-from relation is always respected).
96-
let alloc_id = genmc_ctx.exec_state.genmc_shared_allocs_map.borrow()[&scalar.extra];
94+
// `provenance` is non-zero, we have a pointer.
95+
// When we get a pointer from GenMC, then we must have sent it to GenMC before in the same
96+
// execution (since the reads-from relation is always respected).
97+
let alloc_id = genmc_ctx.exec_state.genmc_shared_allocs_map.borrow()[&scalar.provenance];
9798
// FIXME(genmc,borrow tracking): Borrow tracking not yet supported.
9899
let provenance = machine::Provenance::Concrete { alloc_id, tag: BorTag::default() };
99100
let ptr = interpret::Pointer::new(provenance, Size::from_bytes(scalar.value));

0 commit comments

Comments
 (0)