]> git.lizzy.rs Git - rust.git/blobdiff - src/machine.rs
Replace target.target with target
[rust.git] / src / machine.rs
index 9e22825ccac4bbdcd08591844359f0f9f6de2560..544f4667e84613e5a74aa3a6db5cd38f35994eaa 100644 (file)
@@ -128,7 +128,7 @@ pub struct MemoryExtra {
     tracked_alloc_id: Option<AllocId>,
 
     /// Controls whether alignment of memory accesses is being checked.
-    check_alignment: bool,
+    pub(crate) check_alignment: AlignmentCheck,
 }
 
 impl MemoryExtra {
@@ -138,7 +138,7 @@ pub fn new(
         tracked_pointer_tag: Option<PtrId>,
         tracked_call_id: Option<CallId>,
         tracked_alloc_id: Option<AllocId>,
-        check_alignment: bool,
+        check_alignment: AlignmentCheck,
     ) -> Self {
         let stacked_borrows = if stacked_borrows {
             Some(Rc::new(RefCell::new(stacked_borrows::GlobalState::new(tracked_pointer_tag, tracked_call_id))))
@@ -173,7 +173,7 @@ fn add_extern_static<'tcx, 'mir>(
     pub fn init_extern_statics<'tcx, 'mir>(
         this: &mut MiriEvalContext<'mir, 'tcx>,
     ) -> InterpResult<'tcx> {
-        match this.tcx.sess.target.target.target_os.as_str() {
+        match this.tcx.sess.target.target_os.as_str() {
             "linux" => {
                 // "__cxa_thread_atexit_impl"
                 // This should be all-zero, pointer-sized.
@@ -236,9 +236,6 @@ pub struct Evaluator<'mir, 'tcx> {
     pub(crate) argv: Option<Scalar<Tag>>,
     pub(crate) cmd_line: Option<Scalar<Tag>>,
 
-    /// Last OS error location in memory. It is a 32-bit integer.
-    pub(crate) last_error: Option<MPlaceTy<'tcx, Tag>>,
-
     /// TLS state.
     pub(crate) tls: TlsData<'tcx>,
 
@@ -249,14 +246,9 @@ pub struct Evaluator<'mir, 'tcx> {
     /// Whether to enforce the validity invariant.
     pub(crate) validate: bool,
 
-    pub(crate) file_handler: shims::posix::FileHandler<'tcx>,
+    pub(crate) file_handler: shims::posix::FileHandler,
     pub(crate) dir_handler: shims::posix::DirHandler,
 
-    /// 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>>,
-
     /// The "time anchor" for this machine's monotone clock (for `Instant` simulation).
     pub(crate) time_anchor: Instant,
 
@@ -285,13 +277,11 @@ pub(crate) fn new(
             argc: None,
             argv: None,
             cmd_line: None,
-            last_error: None,
             tls: TlsData::default(),
             communicate,
             validate,
             file_handler: Default::default(),
             dir_handler: Default::default(),
-            panic_payload: None,
             time_anchor: Instant::now(),
             layouts,
             threads: ThreadManager::default(),
@@ -336,7 +326,12 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
 
     #[inline(always)]
     fn enforce_alignment(memory_extra: &MemoryExtra) -> bool {
-        memory_extra.check_alignment
+        memory_extra.check_alignment != AlignmentCheck::None
+    }
+
+    #[inline(always)]
+    fn force_int_for_alignment_check(memory_extra: &Self::MemoryExtra) -> bool {
+        memory_extra.check_alignment == AlignmentCheck::Int
     }
 
     #[inline(always)]