rust/compiler/rustc_const_eval/src/interpret
Matthias Krüger 221d6c734c
Rollup merge of #140972 - Stypox:machine-tracing-flag, r=RalfJung
Add TRACING_ENABLED to Machine and add enter_trace_span!()

This PR adds the necessary infrastructure to make it possible to do tracing calls from within `rustc_const_eval` when running Miri, while making sure they don't impact the performance of normal compiler execution. This is done by adding a `const` boolean to `Machine`, false by default, but that will be set to true in Miri only. The tracing macro `enter_trace_span!()` checks if it is true before doing anything, and since the value of a `const` is known at compile time, if it it false it the whole tracing call should be optimized out.

I will soon open further PRs to add tracing macro calls similar to this one, so that afterwards it will be possible to learn more about Miri's time spent in the various interpretation steps:
```rs
let _guard = enter_trace_span!(M, "eval_statement", "{:?}", stmt);
```

r? `@RalfJung`
2025-05-20 20:57:26 +02:00
..
call.rs Rollup merge of #135808 - tiif:conv_display, r=workingjubilee 2025-05-17 15:45:19 +02:00
cast.rs Stop relying on rustc_type_ir in non-type-system crates 2025-03-15 06:42:48 +00:00
discriminant.rs make no-variant types a dedicated Variants variant 2024-12-18 11:01:54 +01:00
eval_context.rs Change function visibility to pub 2025-04-17 16:23:44 +02:00
intern.rs Move DisambiguatorState into intern_const_alloc_recursive 2025-05-02 15:51:26 +02:00
intrinsics.rs Use intrinsics for {f16,f32,f64,f128}::{minimum,maximum} operations 2025-05-09 17:11:23 +02:00
machine.rs Add TRACING_ENABLED to Machine trait 2025-05-13 18:15:02 +02:00
memory.rs interpret: better error message for out-of-bounds pointer arithmetic and accesses 2025-04-30 18:45:41 +02:00
mod.rs make return type of get_alloc_info a struct, and reduce some code duplication with validity checking 2024-11-09 15:18:52 +01:00
operand.rs Remove BackendRepr::Uninhabited, replaced with an uninhabited: bool field in LayoutData. 2025-02-20 13:27:32 -06:00
operator.rs Contracts core intrinsics. 2025-02-03 12:53:57 -08:00
place.rs miri: optimize zeroed alloc 2025-01-28 12:50:02 +01:00
projection.rs Implement MIR, CTFE, and codegen for unsafe binders 2025-01-31 17:19:53 +00:00
stack.rs Shorten span of panic failures in const context 2025-02-28 16:28:41 +00:00
step.rs AsyncDrop implementation using shim codegen of async_drop_in_place::{closure}, scoped async drop added. 2025-04-28 16:23:13 +07:00
traits.rs interpret: adjust vtable validity check for higher-ranked types 2025-01-31 17:43:28 +01:00
util.rs Add enter_trace_span!() that checks if tracing is enabled 2025-05-20 17:28:30 +02:00
validity.rs interpret: better error message for out-of-bounds pointer arithmetic and accesses 2025-04-30 18:45:41 +02:00
visitor.rs make no-variant types a dedicated Variants variant 2024-12-18 11:01:54 +01:00