提交 6b266405 编写于 作者: R Ralf Jung

remove unnecessary deallocate_local hack

上级 c8baac57
......@@ -18,8 +18,8 @@
use rustc_target::abi::{Align, HasDataLayout, LayoutOf, Size, TargetDataLayout};
use super::{
Immediate, MPlaceTy, Machine, MemPlace, MemPlaceMeta, Memory, Operand, Place, PlaceTy,
ScalarMaybeUninit, StackPopJump,
Immediate, MPlaceTy, Machine, MemPlace, MemPlaceMeta, Memory, MemoryKind, Operand, Place,
PlaceTy, ScalarMaybeUninit, StackPopJump,
};
use crate::transform::validate::equal_up_to_regions;
use crate::util::storage::AlwaysLiveLocals;
......@@ -900,7 +900,7 @@ fn deallocate_local(&mut self, local: LocalValue<M::PointerTag>) -> InterpResult
// due to the local having ZST type.
let ptr = ptr.assert_ptr();
trace!("deallocating local: {:?}", self.memory.dump_alloc(ptr.alloc_id));
self.memory.deallocate_local(ptr)?;
self.memory.deallocate(ptr, None, MemoryKind::Stack)?;
};
Ok(())
}
......
......@@ -276,17 +276,6 @@ pub fn reallocate(
Ok(new_ptr)
}
/// Deallocate a local, or do nothing if that local has been made into a global.
pub fn deallocate_local(&mut self, ptr: Pointer<M::PointerTag>) -> InterpResult<'tcx> {
// The allocation might be already removed by global interning.
// This can only really happen in the CTFE instance, not in miri.
if self.alloc_map.contains_key(&ptr.alloc_id) {
self.deallocate(ptr, None, MemoryKind::Stack)
} else {
Ok(())
}
}
pub fn deallocate(
&mut self,
ptr: Pointer<M::PointerTag>,
......@@ -1110,7 +1099,11 @@ pub fn copy_repeatedly(
}
// now fill in all the "init" data
dest_alloc.mark_compressed_init_range(&compressed, alloc_range(dest.offset, size), num_copies);
dest_alloc.mark_compressed_init_range(
&compressed,
alloc_range(dest.offset, size),
num_copies,
);
// copy the relocations to the destination
dest_alloc.mark_relocation_range(relocations);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册