Skip to content

Commit 5d8229e

Browse files
committed
Auto merge of #1259 - RalfJung:rustup, r=RalfJung
rustup, adjust for renames
2 parents a6d74a6 + 9b0e9de commit 5d8229e

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
342c5f33d097b2dc07a2dbc0ca45a37379d2ff60
1+
02046a5d402c789c006d0da7662f800fe3c45faf

src/machine.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ pub enum MiriMemoryKind {
5050
WinHeap,
5151
/// Memory for env vars and args, errno, extern statics and other parts of the machine-managed environment.
5252
Machine,
53-
/// Rust statics.
54-
Static,
53+
/// Globals copied from `tcx`.
54+
Global,
5555
}
5656

5757
impl Into<MemoryKind<MiriMemoryKind>> for MiriMemoryKind {
@@ -212,7 +212,7 @@ impl<'mir, 'tcx> MiriEvalContextExt<'mir, 'tcx> for MiriEvalContext<'mir, 'tcx>
212212

213213
/// Machine hook implementations.
214214
impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
215-
type MemoryKinds = MiriMemoryKind;
215+
type MemoryKind = MiriMemoryKind;
216216

217217
type FrameExtra = FrameData<'tcx>;
218218
type MemoryExtra = MemoryExtra;
@@ -223,7 +223,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
223223
type MemoryMap =
224224
MonoHashMap<AllocId, (MemoryKind<MiriMemoryKind>, Allocation<Tag, Self::AllocExtra>)>;
225225

226-
const STATIC_KIND: Option<MiriMemoryKind> = Some(MiriMemoryKind::Static);
226+
const GLOBAL_KIND: Option<MiriMemoryKind> = Some(MiriMemoryKind::Global);
227227

228228
const CHECK_ALIGN: bool = true;
229229

@@ -348,7 +348,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
348348
memory_extra: &MemoryExtra,
349349
id: AllocId,
350350
alloc: Cow<'b, Allocation>,
351-
kind: Option<MemoryKind<Self::MemoryKinds>>,
351+
kind: Option<MemoryKind<Self::MemoryKind>>,
352352
) -> (Cow<'b, Allocation<Self::PointerTag, Self::AllocExtra>>, Self::PointerTag) {
353353
if Some(id) == memory_extra.tracked_alloc_id {
354354
register_diagnostic(NonHaltingDiagnostic::CreatedAlloc(id));
@@ -369,9 +369,9 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
369369
let alloc: Allocation<Tag, Self::AllocExtra> = alloc.with_tags_and_extra(
370370
|alloc| {
371371
if let Some(stacked_borrows) = stacked_borrows.as_mut() {
372-
// Only statics may already contain pointers at this point
373-
assert_eq!(kind, MiriMemoryKind::Static.into());
374-
stacked_borrows.static_base_ptr(alloc)
372+
// Only globals may already contain pointers at this point
373+
assert_eq!(kind, MiriMemoryKind::Global.into());
374+
stacked_borrows.global_base_ptr(alloc)
375375
} else {
376376
Tag::Untagged
377377
}
@@ -382,9 +382,9 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
382382
}
383383

384384
#[inline(always)]
385-
fn tag_static_base_pointer(memory_extra: &MemoryExtra, id: AllocId) -> Self::PointerTag {
385+
fn tag_global_base_pointer(memory_extra: &MemoryExtra, id: AllocId) -> Self::PointerTag {
386386
if let Some(stacked_borrows) = memory_extra.stacked_borrows.as_ref() {
387-
stacked_borrows.borrow_mut().static_base_ptr(id)
387+
stacked_borrows.borrow_mut().global_base_ptr(id)
388388
} else {
389389
Tag::Untagged
390390
}
@@ -486,7 +486,7 @@ impl MayLeak for MiriMemoryKind {
486486
use self::MiriMemoryKind::*;
487487
match self {
488488
Rust | C | WinHeap => false,
489-
Machine | Static => true,
489+
Machine | Global => true,
490490
}
491491
}
492492
}

src/stacked_borrows.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ impl GlobalState {
182182
self.active_calls.contains(&id)
183183
}
184184

185-
pub fn static_base_ptr(&mut self, id: AllocId) -> Tag {
185+
pub fn global_base_ptr(&mut self, id: AllocId) -> Tag {
186186
self.base_ptr_ids.get(&id).copied().unwrap_or_else(|| {
187187
let tag = Tag::Tagged(self.new_ptr());
188188
trace!("New allocation {:?} has base tag {:?}", id, tag);
@@ -457,12 +457,12 @@ impl Stacks {
457457
// everything else off the stack, invalidating all previous pointers,
458458
// and in particular, *all* raw pointers.
459459
MemoryKind::Stack => (Tag::Tagged(extra.borrow_mut().new_ptr()), Permission::Unique),
460-
// Static memory can be referenced by "global" pointers from `tcx`.
461-
// Thus we call `static_base_ptr` such that the global pointers get the same tag
460+
// Global memory can be referenced by global pointers from `tcx`.
461+
// Thus we call `global_base_ptr` such that the global pointers get the same tag
462462
// as what we use here.
463463
// The base pointer is not unique, so the base permission is `SharedReadWrite`.
464-
MemoryKind::Machine(MiriMemoryKind::Static) | MemoryKind::Machine(MiriMemoryKind::Machine) =>
465-
(extra.borrow_mut().static_base_ptr(id), Permission::SharedReadWrite),
464+
MemoryKind::Machine(MiriMemoryKind::Global) | MemoryKind::Machine(MiriMemoryKind::Machine) =>
465+
(extra.borrow_mut().global_base_ptr(id), Permission::SharedReadWrite),
466466
// Everything else we handle entirely untagged for now.
467467
// FIXME: experiment with more precise tracking.
468468
_ => (Tag::Untagged, Permission::SharedReadWrite),

0 commit comments

Comments
 (0)