@@ -260,6 +260,10 @@ impl GlobalStateInner {
260
260
kind : MemoryKind ,
261
261
machine : & MiriMachine < ' _ > ,
262
262
) -> AllocState {
263
+ let _span = enter_trace_span ! (
264
+ "borrow_tracker::new_allocation" ,
265
+ "id = {id:?}, size = {alloc_size:?}, kind = {kind:?}"
266
+ ) ;
263
267
match self . borrow_tracker_method {
264
268
BorrowTrackerMethod :: StackedBorrows =>
265
269
AllocState :: StackedBorrows ( Box :: new ( RefCell :: new ( Stacks :: new_allocation (
@@ -280,6 +284,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
280
284
kind : RetagKind ,
281
285
val : & ImmTy < ' tcx > ,
282
286
) -> InterpResult < ' tcx , ImmTy < ' tcx > > {
287
+ let _span = enter_trace_span ! (
288
+ "borrow_tracker::retag_ptr_value" ,
289
+ "kind = {kind:?}, val.layout = {:?}" ,
290
+ val. layout
291
+ ) ;
283
292
let this = self . eval_context_mut ( ) ;
284
293
let method = this. machine . borrow_tracker . as_ref ( ) . unwrap ( ) . borrow ( ) . borrow_tracker_method ;
285
294
match method {
@@ -293,6 +302,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
293
302
kind : RetagKind ,
294
303
place : & PlaceTy < ' tcx > ,
295
304
) -> InterpResult < ' tcx > {
305
+ let _span = enter_trace_span ! (
306
+ "borrow_tracker::retag_place_contents" ,
307
+ "kind = {kind:?}, place = {place:?}"
308
+ ) ;
296
309
let this = self . eval_context_mut ( ) ;
297
310
let method = this. machine . borrow_tracker . as_ref ( ) . unwrap ( ) . borrow ( ) . borrow_tracker_method ;
298
311
match method {
@@ -302,6 +315,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
302
315
}
303
316
304
317
fn protect_place ( & mut self , place : & MPlaceTy < ' tcx > ) -> InterpResult < ' tcx , MPlaceTy < ' tcx > > {
318
+ let _span = enter_trace_span ! ( "borrow_tracker::protect_place" , "place = {place:?}" ) ;
305
319
let this = self . eval_context_mut ( ) ;
306
320
let method = this. machine . borrow_tracker . as_ref ( ) . unwrap ( ) . borrow ( ) . borrow_tracker_method ;
307
321
match method {
@@ -311,6 +325,12 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
311
325
}
312
326
313
327
fn expose_tag ( & self , alloc_id : AllocId , tag : BorTag ) -> InterpResult < ' tcx > {
328
+ let _span = enter_trace_span ! (
329
+ "borrow_tracker::expose_tag" ,
330
+ "alloc_id = {}, tag = {}" ,
331
+ alloc_id. 0 ,
332
+ tag. 0
333
+ ) ;
314
334
let this = self . eval_context_ref ( ) ;
315
335
let method = this. machine . borrow_tracker . as_ref ( ) . unwrap ( ) . borrow ( ) . borrow_tracker_method ;
316
336
match method {
@@ -354,6 +374,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
354
374
& self ,
355
375
frame : & Frame < ' tcx , Provenance , FrameExtra < ' tcx > > ,
356
376
) -> InterpResult < ' tcx > {
377
+ let _span = enter_trace_span ! ( "borrow_tracker::on_stack_pop" ) ;
357
378
let this = self . eval_context_ref ( ) ;
358
379
let borrow_tracker = this. machine . borrow_tracker . as_ref ( ) . unwrap ( ) ;
359
380
// The body of this loop needs `borrow_tracker` immutably
@@ -431,6 +452,7 @@ impl AllocState {
431
452
range : AllocRange ,
432
453
machine : & MiriMachine < ' tcx > ,
433
454
) -> InterpResult < ' tcx > {
455
+ let _span = enter_trace_span ! ( "borrow_tracker::before_memory_read" ) ;
434
456
match self {
435
457
AllocState :: StackedBorrows ( sb) =>
436
458
sb. borrow_mut ( ) . before_memory_read ( alloc_id, prov_extra, range, machine) ,
@@ -452,6 +474,7 @@ impl AllocState {
452
474
range : AllocRange ,
453
475
machine : & MiriMachine < ' tcx > ,
454
476
) -> InterpResult < ' tcx > {
477
+ let _span = enter_trace_span ! ( "borrow_tracker::before_memory_write" ) ;
455
478
match self {
456
479
AllocState :: StackedBorrows ( sb) =>
457
480
sb. get_mut ( ) . before_memory_write ( alloc_id, prov_extra, range, machine) ,
@@ -473,6 +496,7 @@ impl AllocState {
473
496
size : Size ,
474
497
machine : & MiriMachine < ' tcx > ,
475
498
) -> InterpResult < ' tcx > {
499
+ let _span = enter_trace_span ! ( "borrow_tracker::before_memory_deallocation" ) ;
476
500
match self {
477
501
AllocState :: StackedBorrows ( sb) =>
478
502
sb. get_mut ( ) . before_memory_deallocation ( alloc_id, prov_extra, size, machine) ,
@@ -482,6 +506,7 @@ impl AllocState {
482
506
}
483
507
484
508
pub fn remove_unreachable_tags ( & self , tags : & FxHashSet < BorTag > ) {
509
+ let _span = enter_trace_span ! ( "borrow_tracker::remove_unreachable_tags" ) ;
485
510
match self {
486
511
AllocState :: StackedBorrows ( sb) => sb. borrow_mut ( ) . remove_unreachable_tags ( tags) ,
487
512
AllocState :: TreeBorrows ( tb) => tb. borrow_mut ( ) . remove_unreachable_tags ( tags) ,
@@ -496,6 +521,7 @@ impl AllocState {
496
521
tag : BorTag ,
497
522
alloc_id : AllocId , // diagnostics
498
523
) -> InterpResult < ' tcx > {
524
+ let _span = enter_trace_span ! ( "borrow_tracker::release_protector" ) ;
499
525
match self {
500
526
AllocState :: StackedBorrows ( _sb) => interp_ok ( ( ) ) ,
501
527
AllocState :: TreeBorrows ( tb) =>
@@ -506,6 +532,7 @@ impl AllocState {
506
532
507
533
impl VisitProvenance for AllocState {
508
534
fn visit_provenance ( & self , visit : & mut VisitWith < ' _ > ) {
535
+ let _span = enter_trace_span ! ( "borrow_tracker::visit_provenance" ) ;
509
536
match self {
510
537
AllocState :: StackedBorrows ( sb) => sb. visit_provenance ( visit) ,
511
538
AllocState :: TreeBorrows ( tb) => tb. visit_provenance ( visit) ,
0 commit comments