@@ -81,7 +81,7 @@ impl Drop for SpanGuard {
81
81
}
82
82
83
83
/// A stack frame.
84
- pub struct Frame < ' mir , ' tcx , Tag : Provenance = AllocId , Extra = ( ) > {
84
+ pub struct Frame < ' mir , ' tcx , Prov : Provenance = AllocId , Extra = ( ) > {
85
85
////////////////////////////////////////////////////////////////////////////////
86
86
// Function and callsite information
87
87
////////////////////////////////////////////////////////////////////////////////
@@ -102,7 +102,7 @@ pub struct Frame<'mir, 'tcx, Tag: Provenance = AllocId, Extra = ()> {
102
102
103
103
/// The location where the result of the current stack frame should be written to,
104
104
/// and its layout in the caller.
105
- pub return_place : PlaceTy < ' tcx , Tag > ,
105
+ pub return_place : PlaceTy < ' tcx , Prov > ,
106
106
107
107
/// The list of locals for this stack frame, stored in order as
108
108
/// `[return_ptr, arguments..., variables..., temporaries...]`.
@@ -111,7 +111,7 @@ pub struct Frame<'mir, 'tcx, Tag: Provenance = AllocId, Extra = ()> {
111
111
/// can either directly contain `Scalar` or refer to some part of an `Allocation`.
112
112
///
113
113
/// Do *not* access this directly; always go through the machine hook!
114
- pub locals : IndexVec < mir:: Local , LocalState < ' tcx , Tag > > ,
114
+ pub locals : IndexVec < mir:: Local , LocalState < ' tcx , Prov > > ,
115
115
116
116
/// The span of the `tracing` crate is stored here.
117
117
/// When the guard is dropped, the span is exited. This gives us
@@ -166,32 +166,32 @@ pub enum StackPopCleanup {
166
166
167
167
/// State of a local variable including a memoized layout
168
168
#[ derive( Clone , Debug ) ]
169
- pub struct LocalState < ' tcx , Tag : Provenance = AllocId > {
170
- pub value : LocalValue < Tag > ,
169
+ pub struct LocalState < ' tcx , Prov : Provenance = AllocId > {
170
+ pub value : LocalValue < Prov > ,
171
171
/// Don't modify if `Some`, this is only used to prevent computing the layout twice
172
172
pub layout : Cell < Option < TyAndLayout < ' tcx > > > ,
173
173
}
174
174
175
175
/// Current value of a local variable
176
176
#[ derive( Copy , Clone , Debug ) ] // Miri debug-prints these
177
- pub enum LocalValue < Tag : Provenance = AllocId > {
177
+ pub enum LocalValue < Prov : Provenance = AllocId > {
178
178
/// This local is not currently alive, and cannot be used at all.
179
179
Dead ,
180
180
/// A normal, live local.
181
181
/// Mostly for convenience, we re-use the `Operand` type here.
182
182
/// This is an optimization over just always having a pointer here;
183
183
/// we can thus avoid doing an allocation when the local just stores
184
184
/// immediate values *and* never has its address taken.
185
- Live ( Operand < Tag > ) ,
185
+ Live ( Operand < Prov > ) ,
186
186
}
187
187
188
- impl < ' tcx , Tag : Provenance + ' static > LocalState < ' tcx , Tag > {
188
+ impl < ' tcx , Prov : Provenance + ' static > LocalState < ' tcx , Prov > {
189
189
/// Read the local's value or error if the local is not yet live or not live anymore.
190
190
///
191
191
/// Note: This may only be invoked from the `Machine::access_local` hook and not from
192
192
/// anywhere else. You may be invalidating machine invariants if you do!
193
193
#[ inline]
194
- pub fn access ( & self ) -> InterpResult < ' tcx , & Operand < Tag > > {
194
+ pub fn access ( & self ) -> InterpResult < ' tcx , & Operand < Prov > > {
195
195
match & self . value {
196
196
LocalValue :: Dead => throw_ub ! ( DeadLocal ) , // could even be "invalid program"?
197
197
LocalValue :: Live ( val) => Ok ( val) ,
@@ -204,16 +204,16 @@ impl<'tcx, Tag: Provenance + 'static> LocalState<'tcx, Tag> {
204
204
/// Note: This may only be invoked from the `Machine::access_local_mut` hook and not from
205
205
/// anywhere else. You may be invalidating machine invariants if you do!
206
206
#[ inline]
207
- pub fn access_mut ( & mut self ) -> InterpResult < ' tcx , & mut Operand < Tag > > {
207
+ pub fn access_mut ( & mut self ) -> InterpResult < ' tcx , & mut Operand < Prov > > {
208
208
match & mut self . value {
209
209
LocalValue :: Dead => throw_ub ! ( DeadLocal ) , // could even be "invalid program"?
210
210
LocalValue :: Live ( val) => Ok ( val) ,
211
211
}
212
212
}
213
213
}
214
214
215
- impl < ' mir , ' tcx , Tag : Provenance > Frame < ' mir , ' tcx , Tag > {
216
- pub fn with_extra < Extra > ( self , extra : Extra ) -> Frame < ' mir , ' tcx , Tag , Extra > {
215
+ impl < ' mir , ' tcx , Prov : Provenance > Frame < ' mir , ' tcx , Prov > {
216
+ pub fn with_extra < Extra > ( self , extra : Extra ) -> Frame < ' mir , ' tcx , Prov , Extra > {
217
217
Frame {
218
218
body : self . body ,
219
219
instance : self . instance ,
@@ -227,7 +227,7 @@ impl<'mir, 'tcx, Tag: Provenance> Frame<'mir, 'tcx, Tag> {
227
227
}
228
228
}
229
229
230
- impl < ' mir , ' tcx , Tag : Provenance , Extra > Frame < ' mir , ' tcx , Tag , Extra > {
230
+ impl < ' mir , ' tcx , Prov : Provenance , Extra > Frame < ' mir , ' tcx , Prov , Extra > {
231
231
/// Get the current location within the Frame.
232
232
///
233
233
/// If this is `Err`, we are not currently executing any particular statement in
@@ -422,14 +422,14 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
422
422
}
423
423
424
424
#[ inline( always) ]
425
- pub ( crate ) fn stack ( & self ) -> & [ Frame < ' mir , ' tcx , M :: PointerTag , M :: FrameExtra > ] {
425
+ pub ( crate ) fn stack ( & self ) -> & [ Frame < ' mir , ' tcx , M :: Provenance , M :: FrameExtra > ] {
426
426
M :: stack ( self )
427
427
}
428
428
429
429
#[ inline( always) ]
430
430
pub ( crate ) fn stack_mut (
431
431
& mut self ,
432
- ) -> & mut Vec < Frame < ' mir , ' tcx , M :: PointerTag , M :: FrameExtra > > {
432
+ ) -> & mut Vec < Frame < ' mir , ' tcx , M :: Provenance , M :: FrameExtra > > {
433
433
M :: stack_mut ( self )
434
434
}
435
435
@@ -441,12 +441,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
441
441
}
442
442
443
443
#[ inline( always) ]
444
- pub fn frame ( & self ) -> & Frame < ' mir , ' tcx , M :: PointerTag , M :: FrameExtra > {
444
+ pub fn frame ( & self ) -> & Frame < ' mir , ' tcx , M :: Provenance , M :: FrameExtra > {
445
445
self . stack ( ) . last ( ) . expect ( "no call frames exist" )
446
446
}
447
447
448
448
#[ inline( always) ]
449
- pub fn frame_mut ( & mut self ) -> & mut Frame < ' mir , ' tcx , M :: PointerTag , M :: FrameExtra > {
449
+ pub fn frame_mut ( & mut self ) -> & mut Frame < ' mir , ' tcx , M :: Provenance , M :: FrameExtra > {
450
450
self . stack_mut ( ) . last_mut ( ) . expect ( "no call frames exist" )
451
451
}
452
452
@@ -503,7 +503,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
503
503
/// stack frame), to bring it into the proper environment for this interpreter.
504
504
pub ( super ) fn subst_from_frame_and_normalize_erasing_regions < T : TypeFoldable < ' tcx > > (
505
505
& self ,
506
- frame : & Frame < ' mir , ' tcx , M :: PointerTag , M :: FrameExtra > ,
506
+ frame : & Frame < ' mir , ' tcx , M :: Provenance , M :: FrameExtra > ,
507
507
value : T ,
508
508
) -> Result < T , InterpError < ' tcx > > {
509
509
frame
@@ -540,7 +540,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
540
540
#[ inline( always) ]
541
541
pub fn layout_of_local (
542
542
& self ,
543
- frame : & Frame < ' mir , ' tcx , M :: PointerTag , M :: FrameExtra > ,
543
+ frame : & Frame < ' mir , ' tcx , M :: Provenance , M :: FrameExtra > ,
544
544
local : mir:: Local ,
545
545
layout : Option < TyAndLayout < ' tcx > > ,
546
546
) -> InterpResult < ' tcx , TyAndLayout < ' tcx > > {
@@ -569,7 +569,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
569
569
/// This can fail to provide an answer for extern types.
570
570
pub ( super ) fn size_and_align_of (
571
571
& self ,
572
- metadata : & MemPlaceMeta < M :: PointerTag > ,
572
+ metadata : & MemPlaceMeta < M :: Provenance > ,
573
573
layout : & TyAndLayout < ' tcx > ,
574
574
) -> InterpResult < ' tcx , Option < ( Size , Align ) > > {
575
575
if !layout. is_unsized ( ) {
@@ -655,7 +655,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
655
655
#[ inline]
656
656
pub fn size_and_align_of_mplace (
657
657
& self ,
658
- mplace : & MPlaceTy < ' tcx , M :: PointerTag > ,
658
+ mplace : & MPlaceTy < ' tcx , M :: Provenance > ,
659
659
) -> InterpResult < ' tcx , Option < ( Size , Align ) > > {
660
660
self . size_and_align_of ( & mplace. meta , & mplace. layout )
661
661
}
@@ -665,7 +665,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
665
665
& mut self ,
666
666
instance : ty:: Instance < ' tcx > ,
667
667
body : & ' mir mir:: Body < ' tcx > ,
668
- return_place : & PlaceTy < ' tcx , M :: PointerTag > ,
668
+ return_place : & PlaceTy < ' tcx , M :: Provenance > ,
669
669
return_to_block : StackPopCleanup ,
670
670
) -> InterpResult < ' tcx > {
671
671
trace ! ( "body: {:#?}" , body) ;
@@ -891,7 +891,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
891
891
}
892
892
893
893
#[ instrument( skip( self ) , level = "debug" ) ]
894
- fn deallocate_local ( & mut self , local : LocalValue < M :: PointerTag > ) -> InterpResult < ' tcx > {
894
+ fn deallocate_local ( & mut self , local : LocalValue < M :: Provenance > ) -> InterpResult < ' tcx > {
895
895
if let LocalValue :: Live ( Operand :: Indirect ( MemPlace { ptr, .. } ) ) = local {
896
896
// All locals have a backing allocation, even if the allocation is empty
897
897
// due to the local having ZST type. Hence we can `unwrap`.
@@ -909,7 +909,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
909
909
pub fn eval_to_allocation (
910
910
& self ,
911
911
gid : GlobalId < ' tcx > ,
912
- ) -> InterpResult < ' tcx , MPlaceTy < ' tcx , M :: PointerTag > > {
912
+ ) -> InterpResult < ' tcx , MPlaceTy < ' tcx , M :: Provenance > > {
913
913
// For statics we pick `ParamEnv::reveal_all`, because statics don't have generics
914
914
// and thus don't care about the parameter environment. While we could just use
915
915
// `self.param_env`, that would mean we invoke the query to evaluate the static
@@ -927,7 +927,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
927
927
}
928
928
929
929
#[ must_use]
930
- pub fn dump_place ( & self , place : Place < M :: PointerTag > ) -> PlacePrinter < ' _ , ' mir , ' tcx , M > {
930
+ pub fn dump_place ( & self , place : Place < M :: Provenance > ) -> PlacePrinter < ' _ , ' mir , ' tcx , M > {
931
931
PlacePrinter { ecx : self , place }
932
932
}
933
933
@@ -956,7 +956,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
956
956
/// Helper struct for the `dump_place` function.
957
957
pub struct PlacePrinter < ' a , ' mir , ' tcx , M : Machine < ' mir , ' tcx > > {
958
958
ecx : & ' a InterpCx < ' mir , ' tcx , M > ,
959
- place : Place < M :: PointerTag > ,
959
+ place : Place < M :: Provenance > ,
960
960
}
961
961
962
962
impl < ' a , ' mir , ' tcx : ' mir , M : Machine < ' mir , ' tcx > > std:: fmt:: Debug
0 commit comments