Skip to content

Commit 22479ca

Browse files
committed
Add tracing calls to step.rs
1 parent e1f674c commit 22479ca

File tree

1 file changed

+20
-2
lines changed
  • compiler/rustc_const_eval/src/interpret

1 file changed

+20
-2
lines changed

compiler/rustc_const_eval/src/interpret/step.rs

Lines changed: 20 additions & 2 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,8 @@ 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!(M, step::eval_statement, stmt = ?stmt, tracing_separate_thread = Empty);
79+
info!(?stmt);
7880

7981
use rustc_middle::mir::StatementKind::*;
8082

@@ -159,6 +161,12 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
159161
rvalue: &mir::Rvalue<'tcx>,
160162
place: mir::Place<'tcx>,
161163
) -> InterpResult<'tcx> {
164+
let _span = enter_trace_span!(
165+
M,
166+
step::eval_rvalue_into_place,
167+
?rvalue,
168+
tracing_separate_thread = Empty
169+
);
162170
let dest = self.eval_place(place)?;
163171
// FIXME: ensure some kind of non-aliasing between LHS and RHS?
164172
// Also see https://github.com/rust-lang/rust/issues/68364.
@@ -383,6 +391,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
383391
&self,
384392
op: &mir::Operand<'tcx>,
385393
) -> InterpResult<'tcx, FnArg<'tcx, M::Provenance>> {
394+
let _span =
395+
enter_trace_span!(M, step::eval_fn_call_argument, ?op, tracing_separate_thread = Empty);
386396
interp_ok(match op {
387397
mir::Operand::Copy(_) | mir::Operand::Constant(_) => {
388398
// Make a regular copy.
@@ -421,6 +431,13 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
421431
func: &mir::Operand<'tcx>,
422432
args: &[Spanned<mir::Operand<'tcx>>],
423433
) -> InterpResult<'tcx, EvaluatedCalleeAndArgs<'tcx, M>> {
434+
let _span = enter_trace_span!(
435+
M,
436+
step::eval_callee_and_args,
437+
?func,
438+
?args,
439+
tracing_separate_thread = Empty
440+
);
424441
let func = self.eval_operand(func, None)?;
425442
let args = args
426443
.iter()
@@ -456,6 +473,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
456473
}
457474

458475
fn eval_terminator(&mut self, terminator: &mir::Terminator<'tcx>) -> InterpResult<'tcx> {
476+
let _span = enter_trace_span!(M, step::eval_terminator, terminator = ?terminator.kind, tracing_separate_thread = Empty);
459477
info!("{:?}", terminator.kind);
460478

461479
use rustc_middle::mir::TerminatorKind::*;

0 commit comments

Comments
 (0)