From: Vytautas Astrauskas Date: Wed, 1 Apr 2020 23:28:33 +0000 (-0700) Subject: Update to support the updated API. X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=8dd8f199cab87584387ff1dbd74430e908e1f1e2;p=rust.git Update to support the updated API. --- diff --git a/src/machine.rs b/src/machine.rs index 9d1fa9b78c3..e6fea672c60 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -464,8 +464,13 @@ fn canonical_alloc_id(mem: &Memory<'mir, 'tcx, Self>, id: AllocId) -> AllocId { } } - fn resolve_thread_local_allocation_id(extra: &Self::MemoryExtra, id: AllocId) -> AllocId { - extra.tls.resolve_allocation(id) + #[inline(always)] + fn resolve_maybe_global_alloc( + tcx: ty::query::TyCtxtAt<'tcx>, + extra: &Self::MemoryExtra, + id: AllocId, + ) -> Option> { + extra.tls.resolve_allocation(*tcx, id) } fn init_allocation_extra<'b>( diff --git a/src/threads.rs b/src/threads.rs index 14ee58c2ee3..618713e3c3d 100644 --- a/src/threads.rs +++ b/src/threads.rs @@ -5,9 +5,10 @@ use log::trace; -use rustc_middle::ty; use rustc_data_structures::fx::FxHashMap; use rustc_index::vec::{Idx, IndexVec}; +use rustc_middle::mir; +use rustc_middle::ty; use crate::*; @@ -234,13 +235,17 @@ pub fn get_or_register_allocation(&self, tcx: ty::TyCtxt<'_>, original_id: Alloc } /// For thread local allocation identifier `alloc_id`, retrieve the original /// static allocation identifier from which it was created. - pub fn resolve_allocation(&self, alloc_id: AllocId) -> AllocId { + pub fn resolve_allocation<'tcx>( + &self, + tcx: ty::TyCtxt<'tcx>, + alloc_id: AllocId, + ) -> Option> { trace!("resolve_allocation(alloc_id: {:?})", alloc_id); if let Some(original_id) = self.thread_local_origin.borrow().get(&alloc_id) { trace!("resolve_allocation(alloc_id: {:?}) -> {:?}", alloc_id, original_id); - *original_id + tcx.alloc_map.lock().get(*original_id) } else { - alloc_id + tcx.alloc_map.lock().get(alloc_id) } } /// Set which thread is currently active.