@@ -260,6 +260,7 @@ impl GlobalStateInner {
260
260
kind : MemoryKind ,
261
261
machine : & MiriMachine < ' _ > ,
262
262
) -> AllocState {
263
+ let _span = enter_trace_span ! ( borrow_tracker:: new_allocation, ?id, ?alloc_size, ?kind) ;
263
264
match self . borrow_tracker_method {
264
265
BorrowTrackerMethod :: StackedBorrows =>
265
266
AllocState :: StackedBorrows ( Box :: new ( RefCell :: new ( Stacks :: new_allocation (
@@ -280,6 +281,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
280
281
kind : RetagKind ,
281
282
val : & ImmTy < ' tcx > ,
282
283
) -> InterpResult < ' tcx , ImmTy < ' tcx > > {
284
+ let _span = enter_trace_span ! ( borrow_tracker:: retag_ptr_value, ?kind, ?val. layout) ;
283
285
let this = self . eval_context_mut ( ) ;
284
286
let method = this. machine . borrow_tracker . as_ref ( ) . unwrap ( ) . borrow ( ) . borrow_tracker_method ;
285
287
match method {
@@ -293,6 +295,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
293
295
kind : RetagKind ,
294
296
place : & PlaceTy < ' tcx > ,
295
297
) -> InterpResult < ' tcx > {
298
+ let _span = enter_trace_span ! ( borrow_tracker:: retag_place_contents, ?kind, ?place) ;
296
299
let this = self . eval_context_mut ( ) ;
297
300
let method = this. machine . borrow_tracker . as_ref ( ) . unwrap ( ) . borrow ( ) . borrow_tracker_method ;
298
301
match method {
@@ -302,6 +305,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
302
305
}
303
306
304
307
fn protect_place ( & mut self , place : & MPlaceTy < ' tcx > ) -> InterpResult < ' tcx , MPlaceTy < ' tcx > > {
308
+ let _span = enter_trace_span ! ( borrow_tracker:: protect_place, ?place) ;
305
309
let this = self . eval_context_mut ( ) ;
306
310
let method = this. machine . borrow_tracker . as_ref ( ) . unwrap ( ) . borrow ( ) . borrow_tracker_method ;
307
311
match method {
@@ -311,6 +315,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
311
315
}
312
316
313
317
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 ) ;
314
320
let this = self . eval_context_ref ( ) ;
315
321
let method = this. machine . borrow_tracker . as_ref ( ) . unwrap ( ) . borrow ( ) . borrow_tracker_method ;
316
322
match method {
@@ -354,6 +360,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
354
360
& self ,
355
361
frame : & Frame < ' tcx , Provenance , FrameExtra < ' tcx > > ,
356
362
) -> InterpResult < ' tcx > {
363
+ let _span = enter_trace_span ! ( borrow_tracker:: on_stack_pop) ;
357
364
let this = self . eval_context_ref ( ) ;
358
365
let borrow_tracker = this. machine . borrow_tracker . as_ref ( ) . unwrap ( ) ;
359
366
// The body of this loop needs `borrow_tracker` immutably
@@ -431,6 +438,7 @@ impl AllocState {
431
438
range : AllocRange ,
432
439
machine : & MiriMachine < ' tcx > ,
433
440
) -> InterpResult < ' tcx > {
441
+ let _span = enter_trace_span ! ( borrow_tracker:: before_memory_read, alloc_id = alloc_id. 0 ) ;
434
442
match self {
435
443
AllocState :: StackedBorrows ( sb) =>
436
444
sb. borrow_mut ( ) . before_memory_read ( alloc_id, prov_extra, range, machine) ,
@@ -452,6 +460,7 @@ impl AllocState {
452
460
range : AllocRange ,
453
461
machine : & MiriMachine < ' tcx > ,
454
462
) -> InterpResult < ' tcx > {
463
+ let _span = enter_trace_span ! ( borrow_tracker:: before_memory_write, alloc_id = alloc_id. 0 ) ;
455
464
match self {
456
465
AllocState :: StackedBorrows ( sb) =>
457
466
sb. get_mut ( ) . before_memory_write ( alloc_id, prov_extra, range, machine) ,
@@ -473,6 +482,8 @@ impl AllocState {
473
482
size : Size ,
474
483
machine : & MiriMachine < ' tcx > ,
475
484
) -> InterpResult < ' tcx > {
485
+ let _span =
486
+ enter_trace_span ! ( borrow_tracker:: before_memory_deallocation, alloc_id = alloc_id. 0 ) ;
476
487
match self {
477
488
AllocState :: StackedBorrows ( sb) =>
478
489
sb. get_mut ( ) . before_memory_deallocation ( alloc_id, prov_extra, size, machine) ,
@@ -482,6 +493,7 @@ impl AllocState {
482
493
}
483
494
484
495
pub fn remove_unreachable_tags ( & self , tags : & FxHashSet < BorTag > ) {
496
+ let _span = enter_trace_span ! ( borrow_tracker:: remove_unreachable_tags) ;
485
497
match self {
486
498
AllocState :: StackedBorrows ( sb) => sb. borrow_mut ( ) . remove_unreachable_tags ( tags) ,
487
499
AllocState :: TreeBorrows ( tb) => tb. borrow_mut ( ) . remove_unreachable_tags ( tags) ,
@@ -496,6 +508,11 @@ impl AllocState {
496
508
tag : BorTag ,
497
509
alloc_id : AllocId , // diagnostics
498
510
) -> InterpResult < ' tcx > {
511
+ let _span = enter_trace_span ! (
512
+ borrow_tracker:: release_protector,
513
+ alloc_id = alloc_id. 0 ,
514
+ tag = tag. 0
515
+ ) ;
499
516
match self {
500
517
AllocState :: StackedBorrows ( _sb) => interp_ok ( ( ) ) ,
501
518
AllocState :: TreeBorrows ( tb) =>
@@ -506,6 +523,7 @@ impl AllocState {
506
523
507
524
impl VisitProvenance for AllocState {
508
525
fn visit_provenance ( & self , visit : & mut VisitWith < ' _ > ) {
526
+ let _span = enter_trace_span ! ( borrow_tracker:: visit_provenance) ;
509
527
match self {
510
528
AllocState :: StackedBorrows ( sb) => sb. visit_provenance ( visit) ,
511
529
AllocState :: TreeBorrows ( tb) => tb. visit_provenance ( visit) ,
0 commit comments