From 3f0b6a0d1c5ab7146035dd993113ff348aefe94f Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 4 Mar 2024 23:40:26 +0100 Subject: [PATCH] consistently use MPlaceTy for return places --- .../src/const_eval/machine.rs | 10 ++--- .../src/interpret/eval_context.rs | 5 +-- .../src/interpret/intrinsics.rs | 12 +++--- .../rustc_const_eval/src/interpret/machine.rs | 8 ++-- .../rustc_const_eval/src/interpret/place.rs | 10 ----- .../src/interpret/terminator.rs | 6 +-- .../src/dataflow_const_prop.rs | 4 +- src/tools/miri/src/helpers.rs | 2 +- src/tools/miri/src/machine.rs | 6 +-- src/tools/miri/src/shims/backtrace.rs | 21 +++++----- src/tools/miri/src/shims/ffi_support.rs | 4 +- src/tools/miri/src/shims/foreign_items.rs | 10 ++--- src/tools/miri/src/shims/intrinsics/atomic.rs | 14 +++---- src/tools/miri/src/shims/intrinsics/mod.rs | 6 +-- src/tools/miri/src/shims/intrinsics/simd.rs | 22 +++++------ src/tools/miri/src/shims/panic.rs | 4 +- .../miri/src/shims/unix/foreign_items.rs | 2 +- .../src/shims/unix/freebsd/foreign_items.rs | 2 +- .../src/shims/unix/linux/foreign_items.rs | 4 +- src/tools/miri/src/shims/unix/linux/sync.rs | 4 +- .../src/shims/unix/macos/foreign_items.rs | 2 +- src/tools/miri/src/shims/unix/sync.rs | 4 +- .../miri/src/shims/windows/foreign_items.rs | 2 +- src/tools/miri/src/shims/windows/sync.rs | 10 ++--- src/tools/miri/src/shims/x86/aesni.rs | 4 +- src/tools/miri/src/shims/x86/avx.rs | 10 ++--- src/tools/miri/src/shims/x86/mod.rs | 38 +++++++++---------- src/tools/miri/src/shims/x86/sse.rs | 4 +- src/tools/miri/src/shims/x86/sse2.rs | 24 ++++++------ src/tools/miri/src/shims/x86/sse3.rs | 2 +- src/tools/miri/src/shims/x86/sse41.rs | 10 ++--- src/tools/miri/src/shims/x86/ssse3.rs | 12 +++--- 32 files changed, 133 insertions(+), 145 deletions(-) diff --git a/compiler/rustc_const_eval/src/const_eval/machine.rs b/compiler/rustc_const_eval/src/const_eval/machine.rs index 946ffc05cc1..864241fbd4a 100644 --- a/compiler/rustc_const_eval/src/const_eval/machine.rs +++ b/compiler/rustc_const_eval/src/const_eval/machine.rs @@ -24,7 +24,7 @@ use crate::fluent_generated as fluent; use crate::interpret::{ self, compile_time_machine, AllocId, AllocRange, ConstAllocation, CtfeProvenance, FnArg, FnVal, - Frame, ImmTy, InterpCx, InterpResult, OpTy, PlaceTy, Pointer, PointerArithmetic, Scalar, + Frame, ImmTy, InterpCx, InterpResult, MPlaceTy, OpTy, Pointer, PointerArithmetic, Scalar, }; use super::error::*; @@ -219,7 +219,7 @@ fn hook_special_const_fn( &mut self, instance: ty::Instance<'tcx>, args: &[FnArg<'tcx>], - dest: &PlaceTy<'tcx>, + dest: &MPlaceTy<'tcx>, ret: Option, ) -> InterpResult<'tcx, Option>> { let def_id = instance.def_id(); @@ -280,7 +280,7 @@ fn align_offset( &mut self, instance: ty::Instance<'tcx>, args: &[OpTy<'tcx>], - dest: &PlaceTy<'tcx>, + dest: &MPlaceTy<'tcx>, ret: Option, ) -> InterpResult<'tcx, ControlFlow<()>> { assert_eq!(args.len(), 2); @@ -410,7 +410,7 @@ fn find_mir_or_eval_fn( orig_instance: ty::Instance<'tcx>, _abi: CallAbi, args: &[FnArg<'tcx>], - dest: &PlaceTy<'tcx>, + dest: &MPlaceTy<'tcx>, ret: Option, _unwind: mir::UnwindAction, // unwinding is not supported in consts ) -> InterpResult<'tcx, Option<(&'mir mir::Body<'tcx>, ty::Instance<'tcx>)>> { @@ -455,7 +455,7 @@ fn call_intrinsic( ecx: &mut InterpCx<'mir, 'tcx, Self>, instance: ty::Instance<'tcx>, args: &[OpTy<'tcx>], - dest: &PlaceTy<'tcx, Self::Provenance>, + dest: &MPlaceTy<'tcx, Self::Provenance>, target: Option, _unwind: mir::UnwindAction, ) -> InterpResult<'tcx> { diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs index a99620937ef..a484fbd892c 100644 --- a/compiler/rustc_const_eval/src/interpret/eval_context.rs +++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs @@ -771,19 +771,18 @@ pub fn push_stack_frame( &mut self, instance: ty::Instance<'tcx>, body: &'mir mir::Body<'tcx>, - return_place: &PlaceTy<'tcx, M::Provenance>, + return_place: &MPlaceTy<'tcx, M::Provenance>, return_to_block: StackPopCleanup, ) -> InterpResult<'tcx> { trace!("body: {:#?}", body); let dead_local = LocalState { value: LocalValue::Dead, layout: Cell::new(None) }; let locals = IndexVec::from_elem(dead_local, &body.local_decls); - let return_place = self.force_allocation(return_place)?; // avoid a long-lived `PlaceTy` // First push a stack frame so we have access to the local args let pre_frame = Frame { body, loc: Right(body.span), // Span used for errors caused during preamble. return_to_block, - return_place, + return_place: return_place.clone(), locals, instance, tracing_span: SpanGuard::new(), diff --git a/compiler/rustc_const_eval/src/interpret/intrinsics.rs b/compiler/rustc_const_eval/src/interpret/intrinsics.rs index 1cb991b38f7..b68bfb4211d 100644 --- a/compiler/rustc_const_eval/src/interpret/intrinsics.rs +++ b/compiler/rustc_const_eval/src/interpret/intrinsics.rs @@ -21,7 +21,7 @@ use rustc_target::abi::Size; use super::{ - util::ensure_monomorphic_enough, CheckInAllocMsg, ImmTy, InterpCx, Machine, OpTy, PlaceTy, + util::ensure_monomorphic_enough, CheckInAllocMsg, ImmTy, InterpCx, MPlaceTy, Machine, OpTy, Pointer, }; @@ -104,7 +104,7 @@ pub fn emulate_intrinsic( &mut self, instance: ty::Instance<'tcx>, args: &[OpTy<'tcx, M::Provenance>], - dest: &PlaceTy<'tcx, M::Provenance>, + dest: &MPlaceTy<'tcx, M::Provenance>, ret: Option, ) -> InterpResult<'tcx, bool> { let instance_args = instance.args; @@ -377,7 +377,7 @@ pub fn emulate_intrinsic( let index = u64::from(self.read_scalar(&args[1])?.to_u32()?); let elem = &args[2]; let (input, input_len) = self.operand_to_simd(&args[0])?; - let (dest, dest_len) = self.place_to_simd(dest)?; + let (dest, dest_len) = self.mplace_to_simd(dest)?; assert_eq!(input_len, dest_len, "Return vector length must match input length"); // Bounds are not checked by typeck so we have to do it ourselves. if index >= input_len { @@ -430,7 +430,7 @@ pub fn emulate_intrinsic( _ => return Ok(false), } - trace!("{:?}", self.dump_place(dest)); + trace!("{:?}", self.dump_place(&dest.clone().into())); self.go_to_block(ret); Ok(true) } @@ -488,7 +488,7 @@ pub fn exact_div( &mut self, a: &ImmTy<'tcx, M::Provenance>, b: &ImmTy<'tcx, M::Provenance>, - dest: &PlaceTy<'tcx, M::Provenance>, + dest: &MPlaceTy<'tcx, M::Provenance>, ) -> InterpResult<'tcx> { assert_eq!(a.layout.ty, b.layout.ty); assert!(matches!(a.layout.ty.kind(), ty::Int(..) | ty::Uint(..))); @@ -506,7 +506,7 @@ pub fn exact_div( ) } // `Rem` says this is all right, so we can let `Div` do its job. - self.binop_ignore_overflow(BinOp::Div, a, b, dest) + self.binop_ignore_overflow(BinOp::Div, a, b, &dest.clone().into()) } pub fn saturating_arith( diff --git a/compiler/rustc_const_eval/src/interpret/machine.rs b/compiler/rustc_const_eval/src/interpret/machine.rs index 0106ec425bc..ee5de44a651 100644 --- a/compiler/rustc_const_eval/src/interpret/machine.rs +++ b/compiler/rustc_const_eval/src/interpret/machine.rs @@ -196,7 +196,7 @@ fn find_mir_or_eval_fn( instance: ty::Instance<'tcx>, abi: CallAbi, args: &[FnArg<'tcx, Self::Provenance>], - destination: &PlaceTy<'tcx, Self::Provenance>, + destination: &MPlaceTy<'tcx, Self::Provenance>, target: Option, unwind: mir::UnwindAction, ) -> InterpResult<'tcx, Option<(&'mir mir::Body<'tcx>, ty::Instance<'tcx>)>>; @@ -208,7 +208,7 @@ fn call_extra_fn( fn_val: Self::ExtraFnVal, abi: CallAbi, args: &[FnArg<'tcx, Self::Provenance>], - destination: &PlaceTy<'tcx, Self::Provenance>, + destination: &MPlaceTy<'tcx, Self::Provenance>, target: Option, unwind: mir::UnwindAction, ) -> InterpResult<'tcx>; @@ -219,7 +219,7 @@ fn call_intrinsic( ecx: &mut InterpCx<'mir, 'tcx, Self>, instance: ty::Instance<'tcx>, args: &[OpTy<'tcx, Self::Provenance>], - destination: &PlaceTy<'tcx, Self::Provenance>, + destination: &MPlaceTy<'tcx, Self::Provenance>, target: Option, unwind: mir::UnwindAction, ) -> InterpResult<'tcx>; @@ -584,7 +584,7 @@ fn call_extra_fn( fn_val: !, _abi: CallAbi, _args: &[FnArg<$tcx>], - _destination: &PlaceTy<$tcx, Self::Provenance>, + _destination: &MPlaceTy<$tcx, Self::Provenance>, _target: Option, _unwind: mir::UnwindAction, ) -> InterpResult<$tcx> { diff --git a/compiler/rustc_const_eval/src/interpret/place.rs b/compiler/rustc_const_eval/src/interpret/place.rs index 330e9b28bb7..38da1ae3108 100644 --- a/compiler/rustc_const_eval/src/interpret/place.rs +++ b/compiler/rustc_const_eval/src/interpret/place.rs @@ -500,16 +500,6 @@ pub fn mplace_to_simd( Ok((mplace, len)) } - /// Converts a repr(simd) place into a place where `place_index` accesses the SIMD elements. - /// Also returns the number of elements. - pub fn place_to_simd( - &mut self, - place: &PlaceTy<'tcx, M::Provenance>, - ) -> InterpResult<'tcx, (MPlaceTy<'tcx, M::Provenance>, u64)> { - let mplace = self.force_allocation(place)?; - self.mplace_to_simd(&mplace) - } - pub fn local_to_place( &self, frame: usize, diff --git a/compiler/rustc_const_eval/src/interpret/terminator.rs b/compiler/rustc_const_eval/src/interpret/terminator.rs index e72ace8be35..6a242997968 100644 --- a/compiler/rustc_const_eval/src/interpret/terminator.rs +++ b/compiler/rustc_const_eval/src/interpret/terminator.rs @@ -153,7 +153,7 @@ pub(super) fn eval_terminator( ), }; - let destination = self.eval_place(destination)?; + let destination = self.force_allocation(&self.eval_place(destination)?)?; self.eval_fn_call( fn_val, (fn_sig.abi, fn_abi), @@ -503,7 +503,7 @@ pub(crate) fn eval_fn_call( (caller_abi, caller_fn_abi): (Abi, &FnAbi<'tcx, Ty<'tcx>>), args: &[FnArg<'tcx, M::Provenance>], with_caller_location: bool, - destination: &PlaceTy<'tcx, M::Provenance>, + destination: &MPlaceTy<'tcx, M::Provenance>, target: Option, mut unwind: mir::UnwindAction, ) -> InterpResult<'tcx> { @@ -732,7 +732,7 @@ pub(crate) fn eval_fn_call( }); } // Protect return place for in-place return value passing. - M::protect_in_place_function_argument(self, destination)?; + M::protect_in_place_function_argument(self, &destination.clone().into())?; // Don't forget to mark "initially live" locals as live. self.storage_live_for_always_live_locals()?; diff --git a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs index 6e635529d96..1572d5b7834 100644 --- a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs +++ b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs @@ -929,7 +929,7 @@ fn find_mir_or_eval_fn( _instance: ty::Instance<'tcx>, _abi: rustc_target::spec::abi::Abi, _args: &[rustc_const_eval::interpret::FnArg<'tcx, Self::Provenance>], - _destination: &rustc_const_eval::interpret::PlaceTy<'tcx, Self::Provenance>, + _destination: &rustc_const_eval::interpret::MPlaceTy<'tcx, Self::Provenance>, _target: Option, _unwind: UnwindAction, ) -> interpret::InterpResult<'tcx, Option<(&'mir Body<'tcx>, ty::Instance<'tcx>)>> { @@ -947,7 +947,7 @@ fn call_intrinsic( _ecx: &mut InterpCx<'mir, 'tcx, Self>, _instance: ty::Instance<'tcx>, _args: &[rustc_const_eval::interpret::OpTy<'tcx, Self::Provenance>], - _destination: &rustc_const_eval::interpret::PlaceTy<'tcx, Self::Provenance>, + _destination: &rustc_const_eval::interpret::MPlaceTy<'tcx, Self::Provenance>, _target: Option, _unwind: UnwindAction, ) -> interpret::InterpResult<'tcx> { diff --git a/src/tools/miri/src/helpers.rs b/src/tools/miri/src/helpers.rs index 65260254ae2..9e4b5fe8ad7 100644 --- a/src/tools/miri/src/helpers.rs +++ b/src/tools/miri/src/helpers.rs @@ -381,7 +381,7 @@ fn call_function( f: ty::Instance<'tcx>, caller_abi: Abi, args: &[Immediate], - dest: Option<&PlaceTy<'tcx, Provenance>>, + dest: Option<&MPlaceTy<'tcx, Provenance>>, stack_pop: StackPopCleanup, ) -> InterpResult<'tcx> { let this = self.eval_context_mut(); diff --git a/src/tools/miri/src/machine.rs b/src/tools/miri/src/machine.rs index d40f1c4525f..c3c3a815856 100644 --- a/src/tools/miri/src/machine.rs +++ b/src/tools/miri/src/machine.rs @@ -950,7 +950,7 @@ fn find_mir_or_eval_fn( instance: ty::Instance<'tcx>, abi: Abi, args: &[FnArg<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ret: Option, unwind: mir::UnwindAction, ) -> InterpResult<'tcx, Option<(&'mir mir::Body<'tcx>, ty::Instance<'tcx>)>> { @@ -977,7 +977,7 @@ fn call_extra_fn( fn_val: DynSym, abi: Abi, args: &[FnArg<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ret: Option, unwind: mir::UnwindAction, ) -> InterpResult<'tcx> { @@ -990,7 +990,7 @@ fn call_intrinsic( ecx: &mut MiriInterpCx<'mir, 'tcx>, instance: ty::Instance<'tcx>, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ret: Option, unwind: mir::UnwindAction, ) -> InterpResult<'tcx> { diff --git a/src/tools/miri/src/shims/backtrace.rs b/src/tools/miri/src/shims/backtrace.rs index 48dafc40c62..abfa7143a73 100644 --- a/src/tools/miri/src/shims/backtrace.rs +++ b/src/tools/miri/src/shims/backtrace.rs @@ -12,7 +12,7 @@ fn handle_miri_backtrace_size( abi: Abi, link_name: Symbol, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx> { let this = self.eval_context_mut(); let [flags] = this.check_shim(abi, Abi::Rust, link_name, args)?; @@ -32,7 +32,7 @@ fn handle_miri_get_backtrace( abi: Abi, link_name: Symbol, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx> { let this = self.eval_context_mut(); let tcx = this.tcx; @@ -145,7 +145,7 @@ fn handle_miri_resolve_frame( abi: Abi, link_name: Symbol, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx> { let this = self.eval_context_mut(); let [ptr, flags] = this.check_shim(abi, Abi::Rust, link_name, args)?; @@ -174,7 +174,6 @@ fn handle_miri_resolve_frame( // `lo.col` is 0-based - add 1 to make it 1-based for the caller. let colno: u32 = u32::try_from(lo.col.0.saturating_add(1)).unwrap_or(0); - let dest = this.force_allocation(dest)?; if let ty::Adt(adt, _) = dest.layout.ty.kind() { if !adt.repr().c() { throw_ub_format!( @@ -191,29 +190,29 @@ fn handle_miri_resolve_frame( let filename_alloc = this.allocate_str(&filename, MiriMemoryKind::Rust.into(), Mutability::Mut)?; - this.write_immediate(name_alloc.to_ref(this), &this.project_field(&dest, 0)?)?; - this.write_immediate(filename_alloc.to_ref(this), &this.project_field(&dest, 1)?)?; + this.write_immediate(name_alloc.to_ref(this), &this.project_field(dest, 0)?)?; + this.write_immediate(filename_alloc.to_ref(this), &this.project_field(dest, 1)?)?; } 1 => { this.write_scalar( Scalar::from_target_usize(name.len().try_into().unwrap(), this), - &this.project_field(&dest, 0)?, + &this.project_field(dest, 0)?, )?; this.write_scalar( Scalar::from_target_usize(filename.len().try_into().unwrap(), this), - &this.project_field(&dest, 1)?, + &this.project_field(dest, 1)?, )?; } _ => throw_unsup_format!("unknown `miri_resolve_frame` flags {}", flags), } - this.write_scalar(Scalar::from_u32(lineno), &this.project_field(&dest, 2)?)?; - this.write_scalar(Scalar::from_u32(colno), &this.project_field(&dest, 3)?)?; + this.write_scalar(Scalar::from_u32(lineno), &this.project_field(dest, 2)?)?; + this.write_scalar(Scalar::from_u32(colno), &this.project_field(dest, 3)?)?; // Support a 4-field struct for now - this is deprecated // and slated for removal. if num_fields == 5 { - this.write_pointer(fn_ptr, &this.project_field(&dest, 4)?)?; + this.write_pointer(fn_ptr, &this.project_field(dest, 4)?)?; } Ok(()) diff --git a/src/tools/miri/src/shims/ffi_support.rs b/src/tools/miri/src/shims/ffi_support.rs index e628c44a867..6da119e5fa8 100644 --- a/src/tools/miri/src/shims/ffi_support.rs +++ b/src/tools/miri/src/shims/ffi_support.rs @@ -70,7 +70,7 @@ fn scalar_to_carg( fn call_external_c_and_store_return<'a>( &mut self, link_name: Symbol, - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ptr: CodePtr, libffi_args: Vec>, ) -> InterpResult<'tcx, ()> { @@ -205,7 +205,7 @@ fn get_func_ptr_explicitly_from_lib(&mut self, link_name: Symbol) -> Option, + dest: &MPlaceTy<'tcx, Provenance>, args: &[OpTy<'tcx, Provenance>], ) -> InterpResult<'tcx, bool> { // Get the pointer to the function in the shared object file if it exists. diff --git a/src/tools/miri/src/shims/foreign_items.rs b/src/tools/miri/src/shims/foreign_items.rs index 4ae607e98da..a25d377f3a7 100644 --- a/src/tools/miri/src/shims/foreign_items.rs +++ b/src/tools/miri/src/shims/foreign_items.rs @@ -57,7 +57,7 @@ fn emulate_foreign_item( link_name: Symbol, abi: Abi, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ret: Option, unwind: mir::UnwindAction, ) -> InterpResult<'tcx, Option<(&'mir mir::Body<'tcx>, ty::Instance<'tcx>)>> { @@ -123,7 +123,7 @@ fn emulate_foreign_item( // Second: functions that return immediately. match this.emulate_foreign_item_inner(link_name, abi, args, dest)? { EmulateForeignItemResult::NeedsJumping => { - trace!("{:?}", this.dump_place(dest)); + trace!("{:?}", this.dump_place(&dest.clone().into())); this.go_to_block(ret); } EmulateForeignItemResult::AlreadyJumped => (), @@ -149,7 +149,7 @@ fn emulate_dyn_sym( sym: DynSym, abi: Abi, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ret: Option, unwind: mir::UnwindAction, ) -> InterpResult<'tcx> { @@ -401,7 +401,7 @@ fn emulate_foreign_item_inner( link_name: Symbol, abi: Abi, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, EmulateForeignItemResult> { let this = self.eval_context_mut(); @@ -1085,7 +1085,7 @@ fn emulate_foreign_item_inner( let [op] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; let (op, op_len) = this.operand_to_simd(op)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, op_len); diff --git a/src/tools/miri/src/shims/intrinsics/atomic.rs b/src/tools/miri/src/shims/intrinsics/atomic.rs index 4d7f6a6b4e0..865886a7fc1 100644 --- a/src/tools/miri/src/shims/intrinsics/atomic.rs +++ b/src/tools/miri/src/shims/intrinsics/atomic.rs @@ -18,7 +18,7 @@ fn emulate_atomic_intrinsic( &mut self, intrinsic_name: &str, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx> { let this = self.eval_context_mut(); @@ -124,7 +124,7 @@ trait EvalContextPrivExt<'mir, 'tcx: 'mir>: MiriInterpCxExt<'mir, 'tcx> { fn atomic_load( &mut self, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, atomic: AtomicReadOrd, ) -> InterpResult<'tcx> { let this = self.eval_context_mut(); @@ -181,7 +181,7 @@ fn atomic_fence_intrinsic( fn atomic_rmw_op( &mut self, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, atomic_op: AtomicOp, atomic: AtomicRwOrd, ) -> InterpResult<'tcx> { @@ -223,7 +223,7 @@ fn atomic_rmw_op( fn atomic_exchange( &mut self, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, atomic: AtomicRwOrd, ) -> InterpResult<'tcx> { let this = self.eval_context_mut(); @@ -240,7 +240,7 @@ fn atomic_exchange( fn atomic_compare_exchange_impl( &mut self, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, success: AtomicRwOrd, fail: AtomicReadOrd, can_fail_spuriously: bool, @@ -269,7 +269,7 @@ fn atomic_compare_exchange_impl( fn atomic_compare_exchange( &mut self, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, success: AtomicRwOrd, fail: AtomicReadOrd, ) -> InterpResult<'tcx> { @@ -279,7 +279,7 @@ fn atomic_compare_exchange( fn atomic_compare_exchange_weak( &mut self, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, success: AtomicRwOrd, fail: AtomicReadOrd, ) -> InterpResult<'tcx> { diff --git a/src/tools/miri/src/shims/intrinsics/mod.rs b/src/tools/miri/src/shims/intrinsics/mod.rs index b67d588dbc9..46f0c771cb5 100644 --- a/src/tools/miri/src/shims/intrinsics/mod.rs +++ b/src/tools/miri/src/shims/intrinsics/mod.rs @@ -23,7 +23,7 @@ fn call_intrinsic( &mut self, instance: ty::Instance<'tcx>, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ret: Option, _unwind: mir::UnwindAction, ) -> InterpResult<'tcx> { @@ -61,7 +61,7 @@ fn call_intrinsic( // The rest jumps to `ret` immediately. this.emulate_intrinsic_by_name(intrinsic_name, instance.args, args, dest)?; - trace!("{:?}", this.dump_place(dest)); + trace!("{:?}", this.dump_place(&dest.clone().into())); this.go_to_block(ret); Ok(()) } @@ -72,7 +72,7 @@ fn emulate_intrinsic_by_name( intrinsic_name: &str, generic_args: ty::GenericArgsRef<'tcx>, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx> { let this = self.eval_context_mut(); diff --git a/src/tools/miri/src/shims/intrinsics/simd.rs b/src/tools/miri/src/shims/intrinsics/simd.rs index bb18fba5c98..ddddcdcebd2 100644 --- a/src/tools/miri/src/shims/intrinsics/simd.rs +++ b/src/tools/miri/src/shims/intrinsics/simd.rs @@ -21,7 +21,7 @@ fn emulate_simd_intrinsic( intrinsic_name: &str, generic_args: ty::GenericArgsRef<'tcx>, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx> { let this = self.eval_context_mut(); match intrinsic_name { @@ -40,7 +40,7 @@ fn emulate_simd_intrinsic( => { let [op] = check_arg_count(args)?; let (op, op_len) = this.operand_to_simd(op)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, op_len); @@ -167,7 +167,7 @@ enum Op { let [left, right] = check_arg_count(args)?; let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); @@ -255,7 +255,7 @@ enum Op { let (a, a_len) = this.operand_to_simd(a)?; let (b, b_len) = this.operand_to_simd(b)?; let (c, c_len) = this.operand_to_simd(c)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, a_len); assert_eq!(dest_len, b_len); @@ -390,7 +390,7 @@ enum Op { let (mask, mask_len) = this.operand_to_simd(mask)?; let (yes, yes_len) = this.operand_to_simd(yes)?; let (no, no_len) = this.operand_to_simd(no)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, mask_len); assert_eq!(dest_len, yes_len); @@ -411,7 +411,7 @@ enum Op { let [mask, yes, no] = check_arg_count(args)?; let (yes, yes_len) = this.operand_to_simd(yes)?; let (no, no_len) = this.operand_to_simd(no)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; let bitmask_len = dest_len.next_multiple_of(8); // The mask must be an integer or an array. @@ -487,7 +487,7 @@ enum Op { "cast" | "as" | "cast_ptr" | "expose_addr" | "from_exposed_addr" => { let [op] = check_arg_count(args)?; let (op, op_len) = this.operand_to_simd(op)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, op_len); @@ -545,7 +545,7 @@ enum Op { let [left, right] = check_arg_count(args)?; let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; let index = generic_args[2] .expect_const() @@ -582,7 +582,7 @@ enum Op { let [left, right, index] = check_arg_count(args)?; let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; // `index` is an array, not a SIMD type let ty::Array(_, index_len) = index.layout.ty.kind() else { @@ -623,7 +623,7 @@ enum Op { let (passthru, passthru_len) = this.operand_to_simd(passthru)?; let (ptrs, ptrs_len) = this.operand_to_simd(ptrs)?; let (mask, mask_len) = this.operand_to_simd(mask)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, passthru_len); assert_eq!(dest_len, ptrs_len); @@ -669,7 +669,7 @@ enum Op { let (mask, mask_len) = this.operand_to_simd(mask)?; let ptr = this.read_pointer(ptr)?; let (default, default_len) = this.operand_to_simd(default)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, mask_len); assert_eq!(dest_len, default_len); diff --git a/src/tools/miri/src/shims/panic.rs b/src/tools/miri/src/shims/panic.rs index 65b5838cd14..34b6481dd38 100644 --- a/src/tools/miri/src/shims/panic.rs +++ b/src/tools/miri/src/shims/panic.rs @@ -28,7 +28,7 @@ pub struct CatchUnwindData<'tcx> { /// The `data` argument for that callback. data: Scalar, /// The return place from the original call to `try`. - dest: PlaceTy<'tcx, Provenance>, + dest: MPlaceTy<'tcx, Provenance>, /// The return block from the original call to `try`. ret: mir::BasicBlock, } @@ -72,7 +72,7 @@ fn handle_miri_start_unwind( fn handle_catch_unwind( &mut self, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ret: mir::BasicBlock, ) -> InterpResult<'tcx> { let this = self.eval_context_mut(); diff --git a/src/tools/miri/src/shims/unix/foreign_items.rs b/src/tools/miri/src/shims/unix/foreign_items.rs index b5cd18396a2..4ceda809350 100644 --- a/src/tools/miri/src/shims/unix/foreign_items.rs +++ b/src/tools/miri/src/shims/unix/foreign_items.rs @@ -44,7 +44,7 @@ fn emulate_foreign_item_inner( link_name: Symbol, abi: Abi, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, EmulateForeignItemResult> { let this = self.eval_context_mut(); diff --git a/src/tools/miri/src/shims/unix/freebsd/foreign_items.rs b/src/tools/miri/src/shims/unix/freebsd/foreign_items.rs index 64094ac307d..6814e0d4283 100644 --- a/src/tools/miri/src/shims/unix/freebsd/foreign_items.rs +++ b/src/tools/miri/src/shims/unix/freebsd/foreign_items.rs @@ -17,7 +17,7 @@ fn emulate_foreign_item_inner( link_name: Symbol, abi: Abi, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, EmulateForeignItemResult> { let this = self.eval_context_mut(); match link_name.as_str() { diff --git a/src/tools/miri/src/shims/unix/linux/foreign_items.rs b/src/tools/miri/src/shims/unix/linux/foreign_items.rs index b9215129674..d13ada0f4cf 100644 --- a/src/tools/miri/src/shims/unix/linux/foreign_items.rs +++ b/src/tools/miri/src/shims/unix/linux/foreign_items.rs @@ -24,7 +24,7 @@ fn emulate_foreign_item_inner( link_name: Symbol, abi: Abi, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, EmulateForeignItemResult> { let this = self.eval_context_mut(); @@ -228,7 +228,7 @@ fn getrandom<'tcx>( ptr: &OpTy<'tcx, Provenance>, len: &OpTy<'tcx, Provenance>, flags: &OpTy<'tcx, Provenance>, - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx> { let ptr = this.read_pointer(ptr)?; let len = this.read_target_usize(len)?; diff --git a/src/tools/miri/src/shims/unix/linux/sync.rs b/src/tools/miri/src/shims/unix/linux/sync.rs index 66105391c47..ed27066aa6a 100644 --- a/src/tools/miri/src/shims/unix/linux/sync.rs +++ b/src/tools/miri/src/shims/unix/linux/sync.rs @@ -8,7 +8,7 @@ pub fn futex<'tcx>( this: &mut MiriInterpCx<'_, 'tcx>, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx> { // The amount of arguments used depends on the type of futex operation. // The full futex syscall takes six arguments (excluding the syscall @@ -179,7 +179,7 @@ pub fn futex<'tcx>( struct Callback<'tcx> { thread: ThreadId, addr_usize: u64, - dest: PlaceTy<'tcx, Provenance>, + dest: MPlaceTy<'tcx, Provenance>, } impl<'tcx> VisitProvenance for Callback<'tcx> { diff --git a/src/tools/miri/src/shims/unix/macos/foreign_items.rs b/src/tools/miri/src/shims/unix/macos/foreign_items.rs index ecc07e28a29..3af01eb44d8 100644 --- a/src/tools/miri/src/shims/unix/macos/foreign_items.rs +++ b/src/tools/miri/src/shims/unix/macos/foreign_items.rs @@ -17,7 +17,7 @@ fn emulate_foreign_item_inner( link_name: Symbol, abi: Abi, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, EmulateForeignItemResult> { let this = self.eval_context_mut(); diff --git a/src/tools/miri/src/shims/unix/sync.rs b/src/tools/miri/src/shims/unix/sync.rs index 054e9719b34..dd301f9ee6d 100644 --- a/src/tools/miri/src/shims/unix/sync.rs +++ b/src/tools/miri/src/shims/unix/sync.rs @@ -843,7 +843,7 @@ fn pthread_cond_timedwait( cond_op: &OpTy<'tcx, Provenance>, mutex_op: &OpTy<'tcx, Provenance>, abstime_op: &OpTy<'tcx, Provenance>, - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx> { let this = self.eval_context_mut(); @@ -883,7 +883,7 @@ struct Callback<'tcx> { active_thread: ThreadId, mutex_id: MutexId, id: CondvarId, - dest: PlaceTy<'tcx, Provenance>, + dest: MPlaceTy<'tcx, Provenance>, } impl<'tcx> VisitProvenance for Callback<'tcx> { diff --git a/src/tools/miri/src/shims/windows/foreign_items.rs b/src/tools/miri/src/shims/windows/foreign_items.rs index 734737a86dd..e0e129a129e 100644 --- a/src/tools/miri/src/shims/windows/foreign_items.rs +++ b/src/tools/miri/src/shims/windows/foreign_items.rs @@ -27,7 +27,7 @@ fn emulate_foreign_item_inner( link_name: Symbol, abi: Abi, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, EmulateForeignItemResult> { let this = self.eval_context_mut(); diff --git a/src/tools/miri/src/shims/windows/sync.rs b/src/tools/miri/src/shims/windows/sync.rs index 2b9801fea68..620fb44f851 100644 --- a/src/tools/miri/src/shims/windows/sync.rs +++ b/src/tools/miri/src/shims/windows/sync.rs @@ -201,7 +201,7 @@ fn InitOnceBeginInitialize( // When we are woken up, set the `pending` flag accordingly. struct Callback<'tcx> { init_once_id: InitOnceId, - pending_place: PlaceTy<'tcx, Provenance>, + pending_place: MPlaceTy<'tcx, Provenance>, } impl<'tcx> VisitProvenance for Callback<'tcx> { @@ -290,7 +290,7 @@ fn WaitOnAddress( compare_op: &OpTy<'tcx, Provenance>, size_op: &OpTy<'tcx, Provenance>, timeout_op: &OpTy<'tcx, Provenance>, - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx> { let this = self.eval_context_mut(); @@ -334,7 +334,7 @@ fn WaitOnAddress( struct Callback<'tcx> { thread: ThreadId, addr: u64, - dest: PlaceTy<'tcx, Provenance>, + dest: MPlaceTy<'tcx, Provenance>, } impl<'tcx> VisitProvenance for Callback<'tcx> { @@ -391,7 +391,7 @@ fn SleepConditionVariableSRW( lock_op: &OpTy<'tcx, Provenance>, timeout_op: &OpTy<'tcx, Provenance>, flags_op: &OpTy<'tcx, Provenance>, - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, Scalar> { let this = self.eval_context_mut(); @@ -438,7 +438,7 @@ struct Callback<'tcx> { condvar_id: CondvarId, lock_id: RwLockId, mode: RwLockMode, - dest: PlaceTy<'tcx, Provenance>, + dest: MPlaceTy<'tcx, Provenance>, } impl<'tcx> VisitProvenance for Callback<'tcx> { diff --git a/src/tools/miri/src/shims/x86/aesni.rs b/src/tools/miri/src/shims/x86/aesni.rs index fb0b7015127..6c090d877ea 100644 --- a/src/tools/miri/src/shims/x86/aesni.rs +++ b/src/tools/miri/src/shims/x86/aesni.rs @@ -15,7 +15,7 @@ fn emulate_x86_aesni_intrinsic( link_name: Symbol, abi: Abi, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, EmulateForeignItemResult> { let this = self.eval_context_mut(); this.expect_target_feature_for_intrinsic(link_name, "aes")?; @@ -138,7 +138,7 @@ fn aes_round<'tcx>( this: &mut crate::MiriInterpCx<'_, 'tcx>, state: &OpTy<'tcx, Provenance>, key: &OpTy<'tcx, Provenance>, - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, f: impl Fn(u128, u128) -> u128, ) -> InterpResult<'tcx, ()> { assert_eq!(dest.layout.size, state.layout.size); diff --git a/src/tools/miri/src/shims/x86/avx.rs b/src/tools/miri/src/shims/x86/avx.rs index 65de1607595..23c78647b9c 100644 --- a/src/tools/miri/src/shims/x86/avx.rs +++ b/src/tools/miri/src/shims/x86/avx.rs @@ -21,7 +21,7 @@ fn emulate_x86_avx_intrinsic( link_name: Symbol, abi: Abi, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, EmulateForeignItemResult> { let this = self.eval_context_mut(); this.expect_target_feature_for_intrinsic(link_name, "avx")?; @@ -164,7 +164,7 @@ fn emulate_x86_avx_intrinsic( let (data, data_len) = this.operand_to_simd(data)?; let (control, control_len) = this.operand_to_simd(control)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, data_len); assert_eq!(dest_len, control_len); @@ -199,7 +199,7 @@ fn emulate_x86_avx_intrinsic( let (data, data_len) = this.operand_to_simd(data)?; let (control, control_len) = this.operand_to_simd(control)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, data_len); assert_eq!(dest_len, control_len); @@ -354,10 +354,10 @@ fn mask_load<'tcx>( this: &mut crate::MiriInterpCx<'_, 'tcx>, ptr: &OpTy<'tcx, Provenance>, mask: &OpTy<'tcx, Provenance>, - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, ()> { let (mask, mask_len) = this.operand_to_simd(mask)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, mask_len); diff --git a/src/tools/miri/src/shims/x86/mod.rs b/src/tools/miri/src/shims/x86/mod.rs index 9cfee20014f..7cd397625dc 100644 --- a/src/tools/miri/src/shims/x86/mod.rs +++ b/src/tools/miri/src/shims/x86/mod.rs @@ -29,7 +29,7 @@ fn emulate_x86_intrinsic( link_name: Symbol, abi: Abi, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, EmulateForeignItemResult> { let this = self.eval_context_mut(); // Prefix should have already been checked. @@ -286,11 +286,11 @@ fn bin_op_simd_float_first<'tcx, F: rustc_apfloat::Float>( which: FloatBinOp, left: &OpTy<'tcx, Provenance>, right: &OpTy<'tcx, Provenance>, - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, ()> { let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); @@ -317,11 +317,11 @@ fn bin_op_simd_float_all<'tcx, F: rustc_apfloat::Float>( which: FloatBinOp, left: &OpTy<'tcx, Provenance>, right: &OpTy<'tcx, Provenance>, - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, ()> { let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); @@ -414,10 +414,10 @@ fn unary_op_ss<'tcx>( this: &mut crate::MiriInterpCx<'_, 'tcx>, which: FloatUnaryOp, op: &OpTy<'tcx, Provenance>, - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, ()> { let (op, op_len) = this.operand_to_simd(op)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, op_len); @@ -437,10 +437,10 @@ fn unary_op_ps<'tcx>( this: &mut crate::MiriInterpCx<'_, 'tcx>, which: FloatUnaryOp, op: &OpTy<'tcx, Provenance>, - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, ()> { let (op, op_len) = this.operand_to_simd(op)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, op_len); @@ -462,11 +462,11 @@ fn round_first<'tcx, F: rustc_apfloat::Float>( left: &OpTy<'tcx, Provenance>, right: &OpTy<'tcx, Provenance>, rounding: &OpTy<'tcx, Provenance>, - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, ()> { let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); @@ -492,10 +492,10 @@ fn round_all<'tcx, F: rustc_apfloat::Float>( this: &mut crate::MiriInterpCx<'_, 'tcx>, op: &OpTy<'tcx, Provenance>, rounding: &OpTy<'tcx, Provenance>, - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, ()> { let (op, op_len) = this.operand_to_simd(op)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, op_len); @@ -544,10 +544,10 @@ fn convert_float_to_int<'tcx>( this: &mut crate::MiriInterpCx<'_, 'tcx>, op: &OpTy<'tcx, Provenance>, rnd: rustc_apfloat::Round, - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, ()> { let (op, op_len) = this.operand_to_simd(op)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; // Output must be *signed* integers. assert!(matches!(dest.layout.field(this, 0).ty.kind(), ty::Int(_))); @@ -587,7 +587,7 @@ fn split_simd_to_128bit_chunks<'tcx>( this: &mut crate::MiriInterpCx<'_, 'tcx>, left: &OpTy<'tcx, Provenance>, right: &OpTy<'tcx, Provenance>, - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult< 'tcx, (u64, u64, MPlaceTy<'tcx, Provenance>, MPlaceTy<'tcx, Provenance>, MPlaceTy<'tcx, Provenance>), @@ -597,7 +597,7 @@ fn split_simd_to_128bit_chunks<'tcx>( let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); @@ -636,7 +636,7 @@ fn horizontal_bin_op<'tcx>( saturating: bool, left: &OpTy<'tcx, Provenance>, right: &OpTy<'tcx, Provenance>, - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, ()> { let (num_chunks, items_per_chunk, left, right, dest) = split_simd_to_128bit_chunks(this, left, right, dest)?; @@ -684,7 +684,7 @@ fn conditional_dot_product<'tcx>( left: &OpTy<'tcx, Provenance>, right: &OpTy<'tcx, Provenance>, imm: &OpTy<'tcx, Provenance>, - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, ()> { let (num_chunks, items_per_chunk, left, right, dest) = split_simd_to_128bit_chunks(this, left, right, dest)?; diff --git a/src/tools/miri/src/shims/x86/sse.rs b/src/tools/miri/src/shims/x86/sse.rs index da0db92738f..b8c0dfb1c7f 100644 --- a/src/tools/miri/src/shims/x86/sse.rs +++ b/src/tools/miri/src/shims/x86/sse.rs @@ -19,7 +19,7 @@ fn emulate_x86_sse_intrinsic( link_name: Symbol, abi: Abi, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, EmulateForeignItemResult> { let this = self.eval_context_mut(); this.expect_target_feature_for_intrinsic(link_name, "sse")?; @@ -198,7 +198,7 @@ fn emulate_x86_sse_intrinsic( this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; let (left, left_len) = this.operand_to_simd(left)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, left_len); diff --git a/src/tools/miri/src/shims/x86/sse2.rs b/src/tools/miri/src/shims/x86/sse2.rs index b34b93e3739..18ff5d809e3 100644 --- a/src/tools/miri/src/shims/x86/sse2.rs +++ b/src/tools/miri/src/shims/x86/sse2.rs @@ -17,7 +17,7 @@ fn emulate_x86_sse2_intrinsic( link_name: Symbol, abi: Abi, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, EmulateForeignItemResult> { let this = self.eval_context_mut(); this.expect_target_feature_for_intrinsic(link_name, "sse2")?; @@ -46,7 +46,7 @@ fn emulate_x86_sse2_intrinsic( let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(left_len, right_len); assert_eq!(dest_len.checked_mul(2).unwrap(), left_len); @@ -85,7 +85,7 @@ fn emulate_x86_sse2_intrinsic( let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; // left and right are u8x16, dest is u64x2 assert_eq!(left_len, right_len); @@ -122,7 +122,7 @@ fn emulate_x86_sse2_intrinsic( let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); @@ -172,7 +172,7 @@ enum ShiftOp { let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); @@ -223,7 +223,7 @@ enum ShiftOp { let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); @@ -306,7 +306,7 @@ enum ShiftOp { let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; // left and right are i16x8, dest is i8x16 assert_eq!(left_len, 8); @@ -337,7 +337,7 @@ enum ShiftOp { let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; // left and right are i16x8, dest is u8x16 assert_eq!(left_len, 8); @@ -367,7 +367,7 @@ enum ShiftOp { let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; // left and right are i32x4, dest is i16x8 assert_eq!(left_len, 4); @@ -430,7 +430,7 @@ enum ShiftOp { let [op] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; let (op, op_len) = this.operand_to_simd(op)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, op_len); @@ -449,7 +449,7 @@ enum ShiftOp { let [op] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; let (op, op_len) = this.operand_to_simd(op)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, op_len); @@ -563,7 +563,7 @@ enum ShiftOp { let (left, left_len) = this.operand_to_simd(left)?; let (right, _) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, left_len); diff --git a/src/tools/miri/src/shims/x86/sse3.rs b/src/tools/miri/src/shims/x86/sse3.rs index 99a7a4f2f88..5ac30dca79a 100644 --- a/src/tools/miri/src/shims/x86/sse3.rs +++ b/src/tools/miri/src/shims/x86/sse3.rs @@ -15,7 +15,7 @@ fn emulate_x86_sse3_intrinsic( link_name: Symbol, abi: Abi, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, EmulateForeignItemResult> { let this = self.eval_context_mut(); this.expect_target_feature_for_intrinsic(link_name, "sse3")?; diff --git a/src/tools/miri/src/shims/x86/sse41.rs b/src/tools/miri/src/shims/x86/sse41.rs index 32b1fe43c58..16a82eed99b 100644 --- a/src/tools/miri/src/shims/x86/sse41.rs +++ b/src/tools/miri/src/shims/x86/sse41.rs @@ -14,7 +14,7 @@ fn emulate_x86_sse41_intrinsic( link_name: Symbol, abi: Abi, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, EmulateForeignItemResult> { let this = self.eval_context_mut(); this.expect_target_feature_for_intrinsic(link_name, "sse4.1")?; @@ -34,7 +34,7 @@ fn emulate_x86_sse41_intrinsic( let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); @@ -70,7 +70,7 @@ fn emulate_x86_sse41_intrinsic( let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(left_len, right_len); assert_eq!(dest_len, left_len.checked_mul(2).unwrap()); @@ -142,7 +142,7 @@ fn emulate_x86_sse41_intrinsic( let [op] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; let (op, op_len) = this.operand_to_simd(op)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; // Find minimum let mut min_value = u16::MAX; @@ -178,7 +178,7 @@ fn emulate_x86_sse41_intrinsic( let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(left_len, right_len); assert_eq!(left_len, dest_len.checked_mul(2).unwrap()); diff --git a/src/tools/miri/src/shims/x86/ssse3.rs b/src/tools/miri/src/shims/x86/ssse3.rs index 724150fd2fe..dd5d064b20f 100644 --- a/src/tools/miri/src/shims/x86/ssse3.rs +++ b/src/tools/miri/src/shims/x86/ssse3.rs @@ -15,7 +15,7 @@ fn emulate_x86_ssse3_intrinsic( link_name: Symbol, abi: Abi, args: &[OpTy<'tcx, Provenance>], - dest: &PlaceTy<'tcx, Provenance>, + dest: &MPlaceTy<'tcx, Provenance>, ) -> InterpResult<'tcx, EmulateForeignItemResult> { let this = self.eval_context_mut(); this.expect_target_feature_for_intrinsic(link_name, "ssse3")?; @@ -29,7 +29,7 @@ fn emulate_x86_ssse3_intrinsic( let [op] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; let (op, op_len) = this.operand_to_simd(op)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(op_len, dest_len); @@ -52,7 +52,7 @@ fn emulate_x86_ssse3_intrinsic( let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); @@ -102,7 +102,7 @@ fn emulate_x86_ssse3_intrinsic( let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(left_len, right_len); assert_eq!(dest_len.checked_mul(2).unwrap(), left_len); @@ -138,7 +138,7 @@ fn emulate_x86_ssse3_intrinsic( let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); @@ -172,7 +172,7 @@ fn emulate_x86_ssse3_intrinsic( let (left, left_len) = this.operand_to_simd(left)?; let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.place_to_simd(dest)?; + let (dest, dest_len) = this.mplace_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len);