commit
a591e9fc5b
@ -1 +1 @@
|
||||
35a061724802377a21fc6dac1ebcbb9b8d1f558a
|
||||
7fe022f5aa32bbbb33c3a58755729d6667a461a9
|
||||
|
@ -545,11 +545,6 @@ fn enforce_number_init(_ecx: &MiriEvalContext<'mir, 'tcx>) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn enforce_number_no_provenance(_ecx: &MiriEvalContext<'mir, 'tcx>) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn enforce_abi(ecx: &MiriEvalContext<'mir, 'tcx>) -> bool {
|
||||
ecx.machine.enforce_abi
|
||||
@ -753,14 +748,6 @@ fn ptr_from_addr_cast(
|
||||
intptrcast::GlobalStateInner::ptr_from_addr_cast(ecx, addr)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn ptr_from_addr_transmute(
|
||||
ecx: &MiriEvalContext<'mir, 'tcx>,
|
||||
addr: u64,
|
||||
) -> Pointer<Option<Self::Provenance>> {
|
||||
intptrcast::GlobalStateInner::ptr_from_addr_transmute(ecx, addr)
|
||||
}
|
||||
|
||||
fn expose_ptr(
|
||||
ecx: &mut InterpCx<'mir, 'tcx, Self>,
|
||||
ptr: Pointer<Self::Provenance>,
|
||||
|
@ -57,7 +57,7 @@ fn binary_ptr_op(
|
||||
|
||||
Offset => {
|
||||
assert!(left.layout.ty.is_unsafe_ptr());
|
||||
let ptr = self.scalar_to_ptr(left.to_scalar()?)?;
|
||||
let ptr = left.to_scalar()?.to_pointer(self)?;
|
||||
let offset = right.to_scalar()?.to_machine_isize(self)?;
|
||||
|
||||
let pointee_ty =
|
||||
@ -71,7 +71,7 @@ fn binary_ptr_op(
|
||||
Add | Sub | BitOr | BitAnd | BitXor => {
|
||||
assert!(left.layout.ty.is_unsafe_ptr());
|
||||
assert!(right.layout.ty.is_unsafe_ptr());
|
||||
let ptr = self.scalar_to_ptr(left.to_scalar()?)?;
|
||||
let ptr = left.to_scalar()?.to_pointer(self)?;
|
||||
// We do the actual operation with usize-typed scalars.
|
||||
let left = ImmTy::from_uint(ptr.addr().bytes(), self.machine.layouts.usize);
|
||||
let right = ImmTy::from_uint(
|
||||
|
@ -201,7 +201,7 @@ enum Op {
|
||||
this.saturating_arith(mir_op, &left, &right)?
|
||||
}
|
||||
Op::WrappingOffset => {
|
||||
let ptr = this.scalar_to_ptr(left.to_scalar()?)?;
|
||||
let ptr = left.to_scalar()?.to_pointer(this)?;
|
||||
let offset_count = right.to_scalar()?.to_machine_isize(this)?;
|
||||
let pointee_ty = left.layout.ty.builtin_deref(true).unwrap().ty;
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
#[derive(Debug)]
|
||||
pub struct CatchUnwindData<'tcx> {
|
||||
/// The `catch_fn` callback to call in case of a panic.
|
||||
catch_fn: Scalar<Provenance>,
|
||||
catch_fn: Pointer<Option<Provenance>>,
|
||||
/// The `data` argument for that callback.
|
||||
data: Scalar<Provenance>,
|
||||
/// The return place from the original call to `try`.
|
||||
@ -86,7 +86,7 @@ fn handle_try(
|
||||
let [try_fn, data, catch_fn] = check_arg_count(args)?;
|
||||
let try_fn = this.read_pointer(try_fn)?;
|
||||
let data = this.read_scalar(data)?.check_init()?;
|
||||
let catch_fn = this.read_scalar(catch_fn)?.check_init()?;
|
||||
let catch_fn = this.read_pointer(catch_fn)?;
|
||||
|
||||
// Now we make a function call, and pass `data` as first and only argument.
|
||||
let f_instance = this.get_ptr_fn(try_fn)?.as_instance()?;
|
||||
@ -140,8 +140,7 @@ fn handle_stack_pop_unwind(
|
||||
let payload = this.active_thread_mut().panic_payload.take().unwrap();
|
||||
|
||||
// Push the `catch_fn` stackframe.
|
||||
let f_instance =
|
||||
this.get_ptr_fn(this.scalar_to_ptr(catch_unwind.catch_fn)?)?.as_instance()?;
|
||||
let f_instance = this.get_ptr_fn(catch_unwind.catch_fn)?.as_instance()?;
|
||||
trace!("catch_fn: {:?}", f_instance);
|
||||
this.call_function(
|
||||
f_instance,
|
||||
|
@ -241,15 +241,10 @@ fn schedule_windows_tls_dtors(&mut self) -> InterpResult<'tcx> {
|
||||
// (that would be basically https://github.com/rust-lang/miri/issues/450),
|
||||
// we specifically look up the static in libstd that we know is placed
|
||||
// in that section.
|
||||
let thread_callback = this.eval_path_scalar(&[
|
||||
"std",
|
||||
"sys",
|
||||
"windows",
|
||||
"thread_local_key",
|
||||
"p_thread_callback",
|
||||
])?;
|
||||
let thread_callback =
|
||||
this.get_ptr_fn(this.scalar_to_ptr(thread_callback)?)?.as_instance()?;
|
||||
let thread_callback = this
|
||||
.eval_path_scalar(&["std", "sys", "windows", "thread_local_key", "p_thread_callback"])?
|
||||
.to_pointer(this)?;
|
||||
let thread_callback = this.get_ptr_fn(thread_callback)?.as_instance()?;
|
||||
|
||||
// The signature of this function is `unsafe extern "system" fn(h: c::LPVOID, dwReason: c::DWORD, pv: c::LPVOID)`.
|
||||
let reason = this.eval_path_scalar(&["std", "sys", "windows", "c", "DLL_THREAD_DETACH"])?;
|
||||
|
@ -121,7 +121,7 @@ pub fn futex<'tcx>(
|
||||
// The API requires `addr` to be a 4-byte aligned pointer, and will
|
||||
// use the 4 bytes at the given address as an (atomic) i32.
|
||||
this.check_ptr_access_align(
|
||||
this.scalar_to_ptr(addr_scalar)?,
|
||||
addr_scalar.to_pointer(this)?,
|
||||
Size::from_bytes(4),
|
||||
Align::from_bytes(4).unwrap(),
|
||||
CheckInAllocMsg::MemoryAccessTest,
|
||||
|
Loading…
Reference in New Issue
Block a user