Rollup merge of #143520 - Stypox:enter_trace_span-closure, r=RalfJung
Fix perf regression caused by tracing See rust-lang/rust#143334, this is another alternative that may be worth benchmarking as suggested in https://github.com/rust-lang/rust/pull/143334#issuecomment-3038953172. r? ``@RalfJung``
This commit is contained in:
commit
00aa4e1627
5 changed files with 36 additions and 23 deletions
|
|
@ -1014,8 +1014,6 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
|
|||
|
||||
const PANIC_ON_ALLOC_FAIL: bool = false;
|
||||
|
||||
const TRACING_ENABLED: bool = cfg!(feature = "tracing");
|
||||
|
||||
#[inline(always)]
|
||||
fn enforce_alignment(ecx: &MiriInterpCx<'tcx>) -> bool {
|
||||
ecx.machine.check_alignment != AlignmentCheck::None
|
||||
|
|
@ -1827,6 +1825,16 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
|
|||
#[cfg(not(target_os = "linux"))]
|
||||
MiriAllocParams::Global
|
||||
}
|
||||
|
||||
fn enter_trace_span(span: impl FnOnce() -> tracing::Span) -> impl EnteredTraceSpan {
|
||||
#[cfg(feature = "tracing")]
|
||||
{ span().entered() }
|
||||
#[cfg(not(feature = "tracing"))]
|
||||
{
|
||||
let _ = span; // so we avoid the "unused variable" warning
|
||||
()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Trait for callbacks handling asynchronous machine operations.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue