@@ -260,6 +260,7 @@ impl GlobalStateInner {
260260 kind : MemoryKind ,
261261 machine : & MiriMachine < ' _ > ,
262262 ) -> AllocState {
263+ let _span = enter_trace_span ! ( borrow_tracker:: new_allocation, ?id, ?alloc_size, ?kind) ;
263264 match self . borrow_tracker_method {
264265 BorrowTrackerMethod :: StackedBorrows =>
265266 AllocState :: StackedBorrows ( Box :: new ( RefCell :: new ( Stacks :: new_allocation (
@@ -280,6 +281,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
280281 kind : RetagKind ,
281282 val : & ImmTy < ' tcx > ,
282283 ) -> InterpResult < ' tcx , ImmTy < ' tcx > > {
284+ let _span = enter_trace_span ! ( borrow_tracker:: retag_ptr_value, ?kind, ?val. layout) ;
283285 let this = self . eval_context_mut ( ) ;
284286 let method = this. machine . borrow_tracker . as_ref ( ) . unwrap ( ) . borrow ( ) . borrow_tracker_method ;
285287 match method {
@@ -293,6 +295,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
293295 kind : RetagKind ,
294296 place : & PlaceTy < ' tcx > ,
295297 ) -> InterpResult < ' tcx > {
298+ let _span = enter_trace_span ! ( borrow_tracker:: retag_place_contents, ?kind, ?place) ;
296299 let this = self . eval_context_mut ( ) ;
297300 let method = this. machine . borrow_tracker . as_ref ( ) . unwrap ( ) . borrow ( ) . borrow_tracker_method ;
298301 match method {
@@ -302,6 +305,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
302305 }
303306
304307 fn protect_place ( & mut self , place : & MPlaceTy < ' tcx > ) -> InterpResult < ' tcx , MPlaceTy < ' tcx > > {
308+ let _span = enter_trace_span ! ( borrow_tracker:: protect_place, ?place) ;
305309 let this = self . eval_context_mut ( ) ;
306310 let method = this. machine . borrow_tracker . as_ref ( ) . unwrap ( ) . borrow ( ) . borrow_tracker_method ;
307311 match method {
@@ -311,6 +315,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
311315 }
312316
313317 fn expose_tag ( & self , alloc_id : AllocId , tag : BorTag ) -> InterpResult < ' tcx > {
318+ let _span =
319+ enter_trace_span ! ( borrow_tracker:: expose_tag, alloc_id = alloc_id. 0 , tag = tag. 0 ) ;
314320 let this = self . eval_context_ref ( ) ;
315321 let method = this. machine . borrow_tracker . as_ref ( ) . unwrap ( ) . borrow ( ) . borrow_tracker_method ;
316322 match method {
@@ -354,6 +360,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
354360 & self ,
355361 frame : & Frame < ' tcx , Provenance , FrameExtra < ' tcx > > ,
356362 ) -> InterpResult < ' tcx > {
363+ let _span = enter_trace_span ! ( borrow_tracker:: on_stack_pop) ;
357364 let this = self . eval_context_ref ( ) ;
358365 let borrow_tracker = this. machine . borrow_tracker . as_ref ( ) . unwrap ( ) ;
359366 // The body of this loop needs `borrow_tracker` immutably
@@ -431,6 +438,7 @@ impl AllocState {
431438 range : AllocRange ,
432439 machine : & MiriMachine < ' tcx > ,
433440 ) -> InterpResult < ' tcx > {
441+ let _span = enter_trace_span ! ( borrow_tracker:: before_memory_read, alloc_id = alloc_id. 0 ) ;
434442 match self {
435443 AllocState :: StackedBorrows ( sb) =>
436444 sb. borrow_mut ( ) . before_memory_read ( alloc_id, prov_extra, range, machine) ,
@@ -452,6 +460,7 @@ impl AllocState {
452460 range : AllocRange ,
453461 machine : & MiriMachine < ' tcx > ,
454462 ) -> InterpResult < ' tcx > {
463+ let _span = enter_trace_span ! ( borrow_tracker:: before_memory_write, alloc_id = alloc_id. 0 ) ;
455464 match self {
456465 AllocState :: StackedBorrows ( sb) =>
457466 sb. get_mut ( ) . before_memory_write ( alloc_id, prov_extra, range, machine) ,
@@ -473,6 +482,8 @@ impl AllocState {
473482 size : Size ,
474483 machine : & MiriMachine < ' tcx > ,
475484 ) -> InterpResult < ' tcx > {
485+ let _span =
486+ enter_trace_span ! ( borrow_tracker:: before_memory_deallocation, alloc_id = alloc_id. 0 ) ;
476487 match self {
477488 AllocState :: StackedBorrows ( sb) =>
478489 sb. get_mut ( ) . before_memory_deallocation ( alloc_id, prov_extra, size, machine) ,
@@ -482,6 +493,7 @@ impl AllocState {
482493 }
483494
484495 pub fn remove_unreachable_tags ( & self , tags : & FxHashSet < BorTag > ) {
496+ let _span = enter_trace_span ! ( borrow_tracker:: remove_unreachable_tags) ;
485497 match self {
486498 AllocState :: StackedBorrows ( sb) => sb. borrow_mut ( ) . remove_unreachable_tags ( tags) ,
487499 AllocState :: TreeBorrows ( tb) => tb. borrow_mut ( ) . remove_unreachable_tags ( tags) ,
@@ -496,6 +508,11 @@ impl AllocState {
496508 tag : BorTag ,
497509 alloc_id : AllocId , // diagnostics
498510 ) -> InterpResult < ' tcx > {
511+ let _span = enter_trace_span ! (
512+ borrow_tracker:: release_protector,
513+ alloc_id = alloc_id. 0 ,
514+ tag = tag. 0
515+ ) ;
499516 match self {
500517 AllocState :: StackedBorrows ( _sb) => interp_ok ( ( ) ) ,
501518 AllocState :: TreeBorrows ( tb) =>
@@ -506,6 +523,7 @@ impl AllocState {
506523
507524impl VisitProvenance for AllocState {
508525 fn visit_provenance ( & self , visit : & mut VisitWith < ' _ > ) {
526+ let _span = enter_trace_span ! ( borrow_tracker:: visit_provenance) ;
509527 match self {
510528 AllocState :: StackedBorrows ( sb) => sb. visit_provenance ( visit) ,
511529 AllocState :: TreeBorrows ( tb) => tb. visit_provenance ( visit) ,
0 commit comments