Skip to content

Commit 152442a

Browse files
committed
Small cleanup
1 parent 6ada173 commit 152442a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/concurrency/genmc/global_allocations.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::cmp::max;
21
use std::collections::hash_map::Entry;
32
use std::sync::RwLock;
43

@@ -22,11 +21,12 @@ pub struct GlobalAllocationHandler {
2221
/// This contains more or less a subset of the functionality of `struct GlobalStateInner` in `alloc_addresses`.
2322
#[derive(Clone, Debug)]
2423
struct GlobalStateInner {
24+
// FIXME(genmc): Decide on an API for GenMC to access this (to check if access to global memory is valid), or decide we don't need that.
25+
#[allow(unused)]
2526
/// This is used as a map between the address of each allocation and its `AllocId`. It is always
2627
/// sorted by address. We cannot use a `HashMap` since we can be given an address that is offset
2728
/// from the base address, and we need to find the `AllocId` it belongs to. This is not the
2829
/// *full* inverse of `base_addr`; dead allocations have been removed.
29-
#[allow(unused)] // FIXME(GenMC): do we need this?
3030
int_to_ptr_map: Vec<(u64, AllocId)>,
3131
/// The base address for each allocation.
3232
/// This is the inverse of `int_to_ptr_map`.
@@ -35,7 +35,7 @@ struct GlobalStateInner {
3535
/// is always larger than any address that was previously made part of a block.
3636
next_base_addr: u64,
3737
/// To add some randomness to the allocations
38-
/// FIXME(GenMC): maybe seed this from the rng in MiriMachine?
38+
/// FIXME(genmc): maybe seed this from the rng in MiriMachine?
3939
rng: StdRng,
4040
}
4141

@@ -97,19 +97,19 @@ impl GlobalStateInner {
9797
// `alloc_id_from_addr` assumes unique addresses, and different function/vtable pointers
9898
// need to be distinguishable!)
9999
self.next_base_addr = base_addr
100-
.checked_add(max(info.size.bytes(), 1))
100+
.checked_add(info.size.bytes().max(1))
101101
.ok_or_else(|| err_exhaust!(AddressSpaceFull))?;
102102

103103
assert_ne!(0, base_addr & GENMC_GLOBAL_ADDRESSES_MASK);
104104
assert_ne!(0, self.next_base_addr & GENMC_GLOBAL_ADDRESSES_MASK);
105+
105106
// Cache the address for future use.
106107
entry.insert(base_addr);
107108

108109
interp_ok(base_addr)
109110
}
110111
}
111112

112-
// FIXME(GenMC): "ExtPriv" or "PrivExt"?
113113
impl<'tcx> EvalContextExtPriv<'tcx> for crate::MiriInterpCx<'tcx> {}
114114
pub(super) trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
115115
fn get_global_allocation_address(

0 commit comments

Comments
 (0)