Skip to content

Commit 2b501a3

Browse files
committed
Add tracing to various miscellaneous functions
1 parent a153133 commit 2b501a3

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

compiler/rustc_const_eval/src/interpret/eval_context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
582582
span: Span,
583583
layout: Option<TyAndLayout<'tcx>>,
584584
) -> InterpResult<'tcx, OpTy<'tcx, M::Provenance>> {
585+
let _trace = enter_trace_span!(M, const_eval::eval_mir_constant, ?val);
585586
let const_val = val.eval(*self.tcx, self.typing_env, span).map_err(|err| {
586587
if M::ALL_CONSTS_ARE_PRECHECKED {
587588
match err {

compiler/rustc_const_eval/src/interpret/stack.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use super::{
2020
MemoryKind, Operand, PlaceTy, Pointer, Provenance, ReturnAction, Scalar, from_known_layout,
2121
interp_ok, throw_ub, throw_unsup,
2222
};
23-
use crate::errors;
23+
use crate::{enter_trace_span, errors};
2424

2525
// The Phantomdata exists to prevent this type from being `Send`. If it were sent across a thread
2626
// boundary and dropped in the other thread, it would exit the span in the other thread.
@@ -386,6 +386,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
386386

387387
// Make sure all the constants required by this frame evaluate successfully (post-monomorphization check).
388388
for &const_ in body.required_consts() {
389+
let _trace = enter_trace_span!(M, const_eval::push_stack_frame_raw, ?const_.const_);
389390
let c =
390391
self.instantiate_from_current_frame_and_normalize_erasing_regions(const_.const_)?;
391392
c.eval(*self.tcx, self.typing_env, const_.span).map_err(|err| {

compiler/rustc_const_eval/src/interpret/step.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
436436
.map(|arg| self.eval_fn_call_argument(&arg.node))
437437
.collect::<InterpResult<'tcx, Vec<_>>>()?;
438438

439-
let fn_sig_binder = func.layout.ty.fn_sig(*self.tcx);
439+
let fn_sig_binder = {
440+
let _trace = enter_trace_span!(M, "fn_sig", ty = ?func.layout.ty.kind());
441+
func.layout.ty.fn_sig(*self.tcx)
442+
};
440443
let fn_sig = self.tcx.normalize_erasing_late_bound_regions(self.typing_env, fn_sig_binder);
441444
let extra_args = &args[fn_sig.inputs().len()..];
442445
let extra_args =

src/tools/miri/src/machine.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,8 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
11091109
ret: Option<mir::BasicBlock>,
11101110
unwind: mir::UnwindAction,
11111111
) -> InterpResult<'tcx, Option<(&'tcx mir::Body<'tcx>, ty::Instance<'tcx>)>> {
1112+
let _trace = enter_trace_span!("find_mir_or_eval_fn");
1113+
11121114
// For foreign items, try to see if we can emulate them.
11131115
if ecx.tcx.is_foreign_item(instance.def_id()) {
11141116
// An external function call that does not have a MIR body. We either find MIR elsewhere

0 commit comments

Comments
 (0)