Skip to content

Commit 0317e5b

Browse files
committed
Address more review comments
1 parent 20f1b2a commit 0317e5b

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/machine.rs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use std::num::NonZeroU64;
88
use std::time::Instant;
99

1010
use log::trace;
11-
use measureme::{DetachedTiming, EventId, Profiler, StringId};
1211
use rand::rngs::StdRng;
1312
use rand::SeedableRng;
1413

@@ -47,7 +46,16 @@ pub struct FrameData<'tcx> {
4746
/// If `measureme` profiling is enabled, holds timing information
4847
/// for the start of this frame. When we finish executing this frame,
4948
/// we use this to register a completed event with `measureme`.
50-
pub timing: Option<DetachedTiming>,
49+
pub timing: Option<measureme::DetachedTiming>,
50+
}
51+
52+
impl<'tcx> std::fmt::Debug for FrameData<'tcx> {
53+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
54+
f.debug_struct("FrameData")
55+
.field("call_id", &self.call_id)
56+
.field("catch_unwind", &self.catch_unwind)
57+
.finish()
58+
}
5159
}
5260

5361
/// Extra memory kinds
@@ -278,20 +286,19 @@ pub struct Evaluator<'mir, 'tcx> {
278286

279287
/// The `measureme` profiler used to record timing information about
280288
/// the emulated program.
281-
profiler: Option<Profiler>,
289+
profiler: Option<measureme::Profiler>,
282290
/// Used with `profiler` to cache the `StringId`s for event names
283291
/// uesd with `measureme`.
284-
string_cache: FxHashMap<String, StringId>,
292+
string_cache: FxHashMap<String, measureme::StringId>,
285293
}
286294

287295
impl<'mir, 'tcx> Evaluator<'mir, 'tcx> {
288296
pub(crate) fn new(config: &MiriConfig, layout_cx: LayoutCx<'tcx, TyCtxt<'tcx>>) -> Self {
289297
let layouts =
290298
PrimitiveLayouts::new(layout_cx).expect("Couldn't get layouts of primitive types");
291-
let profiler = config
292-
.measureme_out
293-
.as_ref()
294-
.map(|out| Profiler::new(out).expect("Couldn't create `measureme` profiler"));
299+
let profiler = config.measureme_out.as_ref().map(|out| {
300+
measureme::Profiler::new(out).expect("Couldn't create `measureme` profiler")
301+
});
295302
Evaluator {
296303
// `env_vars` could be initialized properly here if `Memory` were available before
297304
// calling this method.
@@ -619,7 +626,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
619626

620627
Some(profiler.start_recording_interval_event_detached(
621628
*name,
622-
EventId::from_label(*name),
629+
measureme::EventId::from_label(*name),
623630
ecx.get_active_thread().to_u32(),
624631
))
625632
} else {

src/shims/panic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
119119
) -> InterpResult<'tcx, StackPopJump> {
120120
let this = self.eval_context_mut();
121121

122+
trace!("handle_stack_pop(extra = {:?}, unwinding = {})", extra, unwinding);
122123
if let Some(stacked_borrows) = &this.memory.extra.stacked_borrows {
123124
stacked_borrows.borrow_mut().end_call(extra.call_id);
124125
}

0 commit comments

Comments
 (0)