}
impl ThreadId {
- pub fn to_u32_scalar(&self) -> Scalar<Tag> {
+ pub fn to_u32_scalar(&self) -> Scalar<Provenance> {
Scalar::from_u32(self.0)
}
}
thread_name: Option<Vec<u8>>,
/// The virtual call stack.
- stack: Vec<Frame<'mir, 'tcx, Tag, FrameData<'tcx>>>,
+ stack: Vec<Frame<'mir, 'tcx, Provenance, FrameData<'tcx>>>,
/// The join status.
join_status: ThreadJoinStatus,
/// The temporary used for storing the argument of
/// the call to `miri_start_panic` (the panic payload) when unwinding.
/// This is pointer-sized, and matches the `Payload` type in `src/libpanic_unwind/miri.rs`.
- pub(crate) panic_payload: Option<Scalar<Tag>>,
+ pub(crate) panic_payload: Option<Scalar<Provenance>>,
/// Last OS error location in memory. It is a 32-bit integer.
- pub(crate) last_error: Option<MPlaceTy<'tcx, Tag>>,
+ pub(crate) last_error: Option<MPlaceTy<'tcx, Provenance>>,
}
impl<'mir, 'tcx> Thread<'mir, 'tcx> {
pub(crate) sync: SynchronizationState,
/// A mapping from a thread-local static to an allocation id of a thread
/// specific allocation.
- thread_local_alloc_ids: RefCell<FxHashMap<(DefId, ThreadId), Pointer<Tag>>>,
+ thread_local_alloc_ids: RefCell<FxHashMap<(DefId, ThreadId), Pointer<Provenance>>>,
/// A flag that indicates that we should change the active thread.
yield_active_thread: bool,
/// Callbacks that are called once the specified time passes.
impl<'mir, 'tcx: 'mir> ThreadManager<'mir, 'tcx> {
/// Check if we have an allocation for the given thread local static for the
/// active thread.
- fn get_thread_local_alloc_id(&self, def_id: DefId) -> Option<Pointer<Tag>> {
+ fn get_thread_local_alloc_id(&self, def_id: DefId) -> Option<Pointer<Provenance>> {
self.thread_local_alloc_ids.borrow().get(&(def_id, self.active_thread)).cloned()
}
/// static for the active thread.
///
/// Panics if a thread local is initialized twice for the same thread.
- fn set_thread_local_alloc(&self, def_id: DefId, ptr: Pointer<Tag>) {
+ fn set_thread_local_alloc(&self, def_id: DefId, ptr: Pointer<Provenance>) {
self.thread_local_alloc_ids
.borrow_mut()
.try_insert((def_id, self.active_thread), ptr)
}
/// Borrow the stack of the active thread.
- pub fn active_thread_stack(&self) -> &[Frame<'mir, 'tcx, Tag, FrameData<'tcx>>] {
+ pub fn active_thread_stack(&self) -> &[Frame<'mir, 'tcx, Provenance, FrameData<'tcx>>] {
&self.threads[self.active_thread].stack
}
/// Mutably borrow the stack of the active thread.
- fn active_thread_stack_mut(&mut self) -> &mut Vec<Frame<'mir, 'tcx, Tag, FrameData<'tcx>>> {
+ fn active_thread_stack_mut(
+ &mut self,
+ ) -> &mut Vec<Frame<'mir, 'tcx, Provenance, FrameData<'tcx>>> {
&mut self.threads[self.active_thread].stack
}
+ pub fn all_stacks(
+ &self,
+ ) -> impl Iterator<Item = &[Frame<'mir, 'tcx, Provenance, FrameData<'tcx>>]> {
+ self.threads.iter().map(|t| &t.stack[..])
+ }
+
/// Create a new thread and returns its id.
fn create_thread(&mut self) -> ThreadId {
let new_thread_id = ThreadId::new(self.threads.len());
fn thread_terminated(
&mut self,
mut data_race: Option<&mut data_race::GlobalState>,
- ) -> Vec<Pointer<Tag>> {
+ ) -> Vec<Pointer<Provenance>> {
let mut free_tls_statics = Vec::new();
{
let mut thread_local_statics = self.thread_local_alloc_ids.borrow_mut();
fn get_or_create_thread_local_alloc(
&mut self,
def_id: DefId,
- ) -> InterpResult<'tcx, Pointer<Tag>> {
+ ) -> InterpResult<'tcx, Pointer<Provenance>> {
let this = self.eval_context_mut();
let tcx = this.tcx;
if let Some(old_alloc) = this.machine.threads.get_thread_local_alloc_id(def_id) {
}
#[inline]
- fn active_thread_stack(&self) -> &[Frame<'mir, 'tcx, Tag, FrameData<'tcx>>] {
+ fn active_thread_stack(&self) -> &[Frame<'mir, 'tcx, Provenance, FrameData<'tcx>>] {
let this = self.eval_context_ref();
this.machine.threads.active_thread_stack()
}
#[inline]
- fn active_thread_stack_mut(&mut self) -> &mut Vec<Frame<'mir, 'tcx, Tag, FrameData<'tcx>>> {
+ fn active_thread_stack_mut(
+ &mut self,
+ ) -> &mut Vec<Frame<'mir, 'tcx, Provenance, FrameData<'tcx>>> {
let this = self.eval_context_mut();
this.machine.threads.active_thread_stack_mut()
}