Skip to content

Commit b12ce55

Browse files
committed
rename some more types for consistency
1 parent 595490e commit b12ce55

File tree

8 files changed

+26
-26
lines changed

8 files changed

+26
-26
lines changed

src/tools/miri/src/borrow_tracker/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl GlobalStateInner {
200200
FrameState { call_id, protected_tags: SmallVec::new() }
201201
}
202202

203-
pub fn end_call(&mut self, frame: &machine::FrameData<'_>) {
203+
pub fn end_call(&mut self, frame: &machine::FrameExtra<'_>) {
204204
for tag in &frame
205205
.borrow_tracker
206206
.as_ref()

src/tools/miri/src/concurrency/data_race.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ use super::{
5959
weak_memory::EvalContextExt as _,
6060
};
6161

62-
pub type AllocExtra = VClockAlloc;
62+
pub type AllocState = VClockAlloc;
6363

6464
/// Valid atomic read-write orderings, alias of atomic::Ordering (not non-exhaustive).
6565
#[derive(Copy, Clone, PartialEq, Eq, Debug)]

src/tools/miri/src/concurrency/thread.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub struct Thread<'mir, 'tcx> {
113113
thread_name: Option<Vec<u8>>,
114114

115115
/// The virtual call stack.
116-
stack: Vec<Frame<'mir, 'tcx, Provenance, FrameData<'tcx>>>,
116+
stack: Vec<Frame<'mir, 'tcx, Provenance, FrameExtra<'tcx>>>,
117117

118118
/// The function to call when the stack ran empty, to figure out what to do next.
119119
/// Conceptually, this is the interpreter implementation of the things that happen 'after' the
@@ -232,7 +232,7 @@ impl VisitTags for Thread<'_, '_> {
232232
}
233233
}
234234

235-
impl VisitTags for Frame<'_, '_, Provenance, FrameData<'_>> {
235+
impl VisitTags for Frame<'_, '_, Provenance, FrameExtra<'_>> {
236236
fn visit_tags(&self, visit: &mut dyn FnMut(BorTag)) {
237237
let Frame {
238238
return_place,
@@ -385,20 +385,20 @@ impl<'mir, 'tcx: 'mir> ThreadManager<'mir, 'tcx> {
385385
}
386386

387387
/// Borrow the stack of the active thread.
388-
pub fn active_thread_stack(&self) -> &[Frame<'mir, 'tcx, Provenance, FrameData<'tcx>>] {
388+
pub fn active_thread_stack(&self) -> &[Frame<'mir, 'tcx, Provenance, FrameExtra<'tcx>>] {
389389
&self.threads[self.active_thread].stack
390390
}
391391

392392
/// Mutably borrow the stack of the active thread.
393393
fn active_thread_stack_mut(
394394
&mut self,
395-
) -> &mut Vec<Frame<'mir, 'tcx, Provenance, FrameData<'tcx>>> {
395+
) -> &mut Vec<Frame<'mir, 'tcx, Provenance, FrameExtra<'tcx>>> {
396396
&mut self.threads[self.active_thread].stack
397397
}
398398

399399
pub fn all_stacks(
400400
&self,
401-
) -> impl Iterator<Item = &[Frame<'mir, 'tcx, Provenance, FrameData<'tcx>>]> {
401+
) -> impl Iterator<Item = &[Frame<'mir, 'tcx, Provenance, FrameExtra<'tcx>>]> {
402402
self.threads.iter().map(|t| &t.stack[..])
403403
}
404404

@@ -921,15 +921,15 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
921921
}
922922

923923
#[inline]
924-
fn active_thread_stack(&self) -> &[Frame<'mir, 'tcx, Provenance, FrameData<'tcx>>] {
924+
fn active_thread_stack(&self) -> &[Frame<'mir, 'tcx, Provenance, FrameExtra<'tcx>>] {
925925
let this = self.eval_context_ref();
926926
this.machine.threads.active_thread_stack()
927927
}
928928

929929
#[inline]
930930
fn active_thread_stack_mut(
931931
&mut self,
932-
) -> &mut Vec<Frame<'mir, 'tcx, Provenance, FrameData<'tcx>>> {
932+
) -> &mut Vec<Frame<'mir, 'tcx, Provenance, FrameExtra<'tcx>>> {
933933
let this = self.eval_context_mut();
934934
this.machine.threads.active_thread_stack_mut()
935935
}

src/tools/miri/src/concurrency/weak_memory.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ use super::{
9393
vector_clock::{VClock, VTimestamp, VectorIdx},
9494
};
9595

96-
pub type AllocExtra = StoreBufferAlloc;
96+
pub type AllocState = StoreBufferAlloc;
9797

9898
// Each store buffer must be bounded otherwise it will grow indefinitely.
9999
// However, bounding the store buffer means restricting the amount of weak

src/tools/miri/src/helpers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> {
988988
self.stack()[frame_idx].current_span()
989989
}
990990

991-
fn stack(&self) -> &[Frame<'mir, 'tcx, Provenance, machine::FrameData<'tcx>>] {
991+
fn stack(&self) -> &[Frame<'mir, 'tcx, Provenance, machine::FrameExtra<'tcx>>] {
992992
self.threads.active_thread_stack()
993993
}
994994

src/tools/miri/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ pub use crate::eval::{
106106
pub use crate::helpers::EvalContextExt as _;
107107
pub use crate::intptrcast::ProvenanceMode;
108108
pub use crate::machine::{
109-
AllocExtra, FrameData, MiriInterpCx, MiriInterpCxExt, MiriMachine, MiriMemoryKind,
109+
AllocExtra, FrameExtra, MiriInterpCx, MiriInterpCxExt, MiriMachine, MiriMemoryKind,
110110
PrimitiveLayouts, Provenance, ProvenanceExtra, PAGE_SIZE, STACK_ADDR, STACK_SIZE,
111111
};
112112
pub use crate::mono_hash_map::MonoHashMap;

src/tools/miri/src/machine.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub const STACK_ADDR: u64 = 32 * PAGE_SIZE; // not really about the "stack", but
3737
pub const STACK_SIZE: u64 = 16 * PAGE_SIZE; // whatever
3838

3939
/// Extra data stored with each stack frame
40-
pub struct FrameData<'tcx> {
40+
pub struct FrameExtra<'tcx> {
4141
/// Extra data for Stacked Borrows.
4242
pub borrow_tracker: Option<borrow_tracker::FrameState>,
4343

@@ -58,20 +58,20 @@ pub struct FrameData<'tcx> {
5858
pub is_user_relevant: bool,
5959
}
6060

61-
impl<'tcx> std::fmt::Debug for FrameData<'tcx> {
61+
impl<'tcx> std::fmt::Debug for FrameExtra<'tcx> {
6262
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6363
// Omitting `timing`, it does not support `Debug`.
64-
let FrameData { borrow_tracker, catch_unwind, timing: _, is_user_relevant: _ } = self;
64+
let FrameExtra { borrow_tracker, catch_unwind, timing: _, is_user_relevant: _ } = self;
6565
f.debug_struct("FrameData")
6666
.field("borrow_tracker", borrow_tracker)
6767
.field("catch_unwind", catch_unwind)
6868
.finish()
6969
}
7070
}
7171

72-
impl VisitTags for FrameData<'_> {
72+
impl VisitTags for FrameExtra<'_> {
7373
fn visit_tags(&self, visit: &mut dyn FnMut(BorTag)) {
74-
let FrameData { catch_unwind, borrow_tracker, timing: _, is_user_relevant: _ } = self;
74+
let FrameExtra { catch_unwind, borrow_tracker, timing: _, is_user_relevant: _ } = self;
7575

7676
catch_unwind.visit_tags(visit);
7777
borrow_tracker.visit_tags(visit);
@@ -258,10 +258,10 @@ pub struct AllocExtra {
258258
pub borrow_tracker: Option<borrow_tracker::AllocState>,
259259
/// Data race detection via the use of a vector-clock,
260260
/// this is only added if it is enabled.
261-
pub data_race: Option<data_race::AllocExtra>,
261+
pub data_race: Option<data_race::AllocState>,
262262
/// Weak memory emulation via the use of store buffers,
263263
/// this is only added if it is enabled.
264-
pub weak_memory: Option<weak_memory::AllocExtra>,
264+
pub weak_memory: Option<weak_memory::AllocState>,
265265
}
266266

267267
impl VisitTags for AllocExtra {
@@ -736,7 +736,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> {
736736
type MemoryKind = MiriMemoryKind;
737737
type ExtraFnVal = Dlsym;
738738

739-
type FrameExtra = FrameData<'tcx>;
739+
type FrameExtra = FrameExtra<'tcx>;
740740
type AllocExtra = AllocExtra;
741741

742742
type Provenance = Provenance;
@@ -908,14 +908,14 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> {
908908
.map(|bt| bt.borrow_mut().new_allocation(id, alloc.size(), kind, &ecx.machine));
909909

910910
let race_alloc = ecx.machine.data_race.as_ref().map(|data_race| {
911-
data_race::AllocExtra::new_allocation(
911+
data_race::AllocState::new_allocation(
912912
data_race,
913913
&ecx.machine.threads,
914914
alloc.size(),
915915
kind,
916916
)
917917
});
918-
let buffer_alloc = ecx.machine.weak_memory.then(weak_memory::AllocExtra::new_allocation);
918+
let buffer_alloc = ecx.machine.weak_memory.then(weak_memory::AllocState::new_allocation);
919919
let alloc: Allocation<Provenance, Self::AllocExtra> = alloc.adjust_from_tcx(
920920
&ecx.tcx,
921921
AllocExtra { borrow_tracker, data_race: race_alloc, weak_memory: buffer_alloc },
@@ -1070,7 +1070,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> {
10701070
fn init_frame_extra(
10711071
ecx: &mut InterpCx<'mir, 'tcx, Self>,
10721072
frame: Frame<'mir, 'tcx, Provenance>,
1073-
) -> InterpResult<'tcx, Frame<'mir, 'tcx, Provenance, FrameData<'tcx>>> {
1073+
) -> InterpResult<'tcx, Frame<'mir, 'tcx, Provenance, FrameExtra<'tcx>>> {
10741074
// Start recording our event before doing anything else
10751075
let timing = if let Some(profiler) = ecx.machine.profiler.as_ref() {
10761076
let fn_name = frame.instance.to_string();
@@ -1088,7 +1088,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> {
10881088

10891089
let borrow_tracker = ecx.machine.borrow_tracker.as_ref();
10901090

1091-
let extra = FrameData {
1091+
let extra = FrameExtra {
10921092
borrow_tracker: borrow_tracker.map(|bt| bt.borrow_mut().new_frame(&ecx.machine)),
10931093
catch_unwind: None,
10941094
timing,
@@ -1157,7 +1157,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> {
11571157
#[inline(always)]
11581158
fn after_stack_pop(
11591159
ecx: &mut InterpCx<'mir, 'tcx, Self>,
1160-
mut frame: Frame<'mir, 'tcx, Provenance, FrameData<'tcx>>,
1160+
mut frame: Frame<'mir, 'tcx, Provenance, FrameExtra<'tcx>>,
11611161
unwinding: bool,
11621162
) -> InterpResult<'tcx, StackPopJump> {
11631163
if frame.extra.is_user_relevant {

src/tools/miri/src/shims/panic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
125125

126126
fn handle_stack_pop_unwind(
127127
&mut self,
128-
mut extra: FrameData<'tcx>,
128+
mut extra: FrameExtra<'tcx>,
129129
unwinding: bool,
130130
) -> InterpResult<'tcx, StackPopJump> {
131131
let this = self.eval_context_mut();

0 commit comments

Comments
 (0)