Skip to content

Commit f756e3a

Browse files
committed
Explain encoding scheme
1 parent b89f656 commit f756e3a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/shims/backtrace.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
3030
}
3131

3232
let ptrs: Vec<_> = data.into_iter().map(|(instance, pos)| {
33+
// We represent a frame pointer by using the `span.lo` value
34+
// as an offset into the function's allocation. This gives us an
35+
// opaque pointer that we can return to user code, and allows us
36+
// to reconstruct the needed frame information in `handle_miri_resolve_frame`.
37+
// Note that we never actually read or write anything from/to this pointer -
38+
// all of the data is represented by the pointer value itself.
3339
let mut fn_ptr = this.memory.create_fn_alloc(FnVal::Instance(instance));
3440
fn_ptr.offset = Size::from_bytes(pos.0);
3541
Scalar::Ptr(fn_ptr)

0 commit comments

Comments
 (0)