Skip to content

Commit 4e806c8

Browse files
committed
Add tracing calls to eval_statement/terminator
1 parent adcb3d3 commit 4e806c8

File tree

1 file changed

+18
-3
lines changed
  • compiler/rustc_const_eval/src/interpret

1 file changed

+18
-3
lines changed

compiler/rustc_const_eval/src/interpret/step.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ use rustc_middle::ty::{self, Instance, Ty};
99
use rustc_middle::{bug, mir, span_bug};
1010
use rustc_span::source_map::Spanned;
1111
use rustc_target::callconv::FnAbi;
12+
use tracing::field::Empty;
1213
use tracing::{info, instrument, trace};
1314

1415
use super::{
1516
FnArg, FnVal, ImmTy, Immediate, InterpCx, InterpResult, Machine, MemPlaceMeta, PlaceTy,
1617
Projectable, Scalar, interp_ok, throw_ub, throw_unsup_format,
1718
};
18-
use crate::util;
19+
use crate::{enter_trace_span, util};
1920

2021
struct EvaluatedCalleeAndArgs<'tcx, M: Machine<'tcx>> {
2122
callee: FnVal<'tcx, M::ExtraFnVal>,
@@ -74,7 +75,14 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
7475
///
7576
/// This does NOT move the statement counter forward, the caller has to do that!
7677
pub fn eval_statement(&mut self, stmt: &mir::Statement<'tcx>) -> InterpResult<'tcx> {
77-
info!("{:?}", stmt);
78+
let _span = enter_trace_span!(
79+
M,
80+
step::eval_statement,
81+
stmt = ?stmt.kind,
82+
span = ?stmt.source_info.span,
83+
tracing_separate_thread = Empty,
84+
);
85+
info!(stmt = ?stmt.kind);
7886

7987
use rustc_middle::mir::StatementKind::*;
8088

@@ -456,7 +464,14 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
456464
}
457465

458466
fn eval_terminator(&mut self, terminator: &mir::Terminator<'tcx>) -> InterpResult<'tcx> {
459-
info!("{:?}", terminator.kind);
467+
let _span = enter_trace_span!(
468+
M,
469+
step::eval_terminator,
470+
terminator = ?terminator.kind,
471+
span = ?terminator.source_info.span,
472+
tracing_separate_thread = Empty,
473+
);
474+
info!(terminator = ?terminator.kind);
460475

461476
use rustc_middle::mir::TerminatorKind::*;
462477
match terminator.kind {

0 commit comments

Comments
 (0)