@@ -446,7 +446,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
446
446
/// Atomic variant of read_scalar_at_offset.
447
447
fn read_scalar_at_offset_atomic (
448
448
& self ,
449
- op : OpTy < ' tcx , Tag > ,
449
+ op : & OpTy < ' tcx , Tag > ,
450
450
offset : u64 ,
451
451
layout : TyAndLayout < ' tcx > ,
452
452
atomic : AtomicReadOp ,
@@ -458,13 +458,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
458
458
// Ensure that the following read at an offset is within bounds.
459
459
assert ! ( op_place. layout. size >= offset + layout. size) ;
460
460
let value_place = op_place. offset ( offset, MemPlaceMeta :: None , layout, this) ?;
461
- this. read_scalar_atomic ( value_place, atomic)
461
+ this. read_scalar_atomic ( & value_place, atomic)
462
462
}
463
463
464
464
/// Atomic variant of write_scalar_at_offset.
465
465
fn write_scalar_at_offset_atomic (
466
466
& mut self ,
467
- op : OpTy < ' tcx , Tag > ,
467
+ op : & OpTy < ' tcx , Tag > ,
468
468
offset : u64 ,
469
469
value : impl Into < ScalarMaybeUninit < Tag > > ,
470
470
layout : TyAndLayout < ' tcx > ,
@@ -477,17 +477,17 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
477
477
// Ensure that the following read at an offset is within bounds.
478
478
assert ! ( op_place. layout. size >= offset + layout. size) ;
479
479
let value_place = op_place. offset ( offset, MemPlaceMeta :: None , layout, this) ?;
480
- this. write_scalar_atomic ( value. into ( ) , value_place, atomic)
480
+ this. write_scalar_atomic ( value. into ( ) , & value_place, atomic)
481
481
}
482
482
483
483
/// Perform an atomic read operation at the memory location.
484
484
fn read_scalar_atomic (
485
485
& self ,
486
- place : MPlaceTy < ' tcx , Tag > ,
486
+ place : & MPlaceTy < ' tcx , Tag > ,
487
487
atomic : AtomicReadOp ,
488
488
) -> InterpResult < ' tcx , ScalarMaybeUninit < Tag > > {
489
489
let this = self . eval_context_ref ( ) ;
490
- let scalar = this. allow_data_races_ref ( move |this| this. read_scalar ( place. into ( ) ) ) ?;
490
+ let scalar = this. allow_data_races_ref ( move |this| this. read_scalar ( & place. into ( ) ) ) ?;
491
491
self . validate_atomic_load ( place, atomic) ?;
492
492
Ok ( scalar)
493
493
}
@@ -496,31 +496,31 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
496
496
fn write_scalar_atomic (
497
497
& mut self ,
498
498
val : ScalarMaybeUninit < Tag > ,
499
- dest : MPlaceTy < ' tcx , Tag > ,
499
+ dest : & MPlaceTy < ' tcx , Tag > ,
500
500
atomic : AtomicWriteOp ,
501
501
) -> InterpResult < ' tcx > {
502
502
let this = self . eval_context_mut ( ) ;
503
- this. allow_data_races_mut ( move |this| this. write_scalar ( val, dest. into ( ) ) ) ?;
503
+ this. allow_data_races_mut ( move |this| this. write_scalar ( val, & ( * dest) . into ( ) ) ) ?;
504
504
self . validate_atomic_store ( dest, atomic)
505
505
}
506
506
507
507
/// Perform a atomic operation on a memory location.
508
508
fn atomic_op_immediate (
509
509
& mut self ,
510
- place : MPlaceTy < ' tcx , Tag > ,
511
- rhs : ImmTy < ' tcx , Tag > ,
510
+ place : & MPlaceTy < ' tcx , Tag > ,
511
+ rhs : & ImmTy < ' tcx , Tag > ,
512
512
op : mir:: BinOp ,
513
513
neg : bool ,
514
514
atomic : AtomicRwOp ,
515
515
) -> InterpResult < ' tcx , ImmTy < ' tcx , Tag > > {
516
516
let this = self . eval_context_mut ( ) ;
517
517
518
- let old = this. allow_data_races_mut ( |this| this. read_immediate ( place. into ( ) ) ) ?;
518
+ let old = this. allow_data_races_mut ( |this| this. read_immediate ( & place. into ( ) ) ) ?;
519
519
520
520
// Atomics wrap around on overflow.
521
- let val = this. binary_op ( op, old, rhs) ?;
522
- let val = if neg { this. unary_op ( mir:: UnOp :: Not , val) ? } else { val } ;
523
- this. allow_data_races_mut ( |this| this. write_immediate ( * val, place. into ( ) ) ) ?;
521
+ let val = this. binary_op ( op, & old, rhs) ?;
522
+ let val = if neg { this. unary_op ( mir:: UnOp :: Not , & val) ? } else { val } ;
523
+ this. allow_data_races_mut ( |this| this. write_immediate ( * val, & ( * place) . into ( ) ) ) ?;
524
524
525
525
this. validate_atomic_rmw ( place, atomic) ?;
526
526
Ok ( old)
@@ -530,14 +530,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
530
530
/// scalar value, the old value is returned.
531
531
fn atomic_exchange_scalar (
532
532
& mut self ,
533
- place : MPlaceTy < ' tcx , Tag > ,
533
+ place : & MPlaceTy < ' tcx , Tag > ,
534
534
new : ScalarMaybeUninit < Tag > ,
535
535
atomic : AtomicRwOp ,
536
536
) -> InterpResult < ' tcx , ScalarMaybeUninit < Tag > > {
537
537
let this = self . eval_context_mut ( ) ;
538
538
539
- let old = this. allow_data_races_mut ( |this| this. read_scalar ( place. into ( ) ) ) ?;
540
- this. allow_data_races_mut ( |this| this. write_scalar ( new, place. into ( ) ) ) ?;
539
+ let old = this. allow_data_races_mut ( |this| this. read_scalar ( & place. into ( ) ) ) ?;
540
+ this. allow_data_races_mut ( |this| this. write_scalar ( new, & ( * place) . into ( ) ) ) ?;
541
541
this. validate_atomic_rmw ( place, atomic) ?;
542
542
Ok ( old)
543
543
}
@@ -550,8 +550,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
550
550
/// identical.
551
551
fn atomic_compare_exchange_scalar (
552
552
& mut self ,
553
- place : MPlaceTy < ' tcx , Tag > ,
554
- expect_old : ImmTy < ' tcx , Tag > ,
553
+ place : & MPlaceTy < ' tcx , Tag > ,
554
+ expect_old : & ImmTy < ' tcx , Tag > ,
555
555
new : ScalarMaybeUninit < Tag > ,
556
556
success : AtomicRwOp ,
557
557
fail : AtomicReadOp ,
@@ -564,9 +564,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
564
564
// to read with the failure ordering and if successful then try again with the success
565
565
// read ordering and write in the success case.
566
566
// Read as immediate for the sake of `binary_op()`
567
- let old = this. allow_data_races_mut ( |this| this. read_immediate ( place. into ( ) ) ) ?;
567
+ let old = this. allow_data_races_mut ( |this| this. read_immediate ( & ( place. into ( ) ) ) ) ?;
568
568
// `binary_op` will bail if either of them is not a scalar.
569
- let eq = this. overflowing_binary_op ( mir:: BinOp :: Eq , old, expect_old) ?. 0 ;
569
+ let eq = this. overflowing_binary_op ( mir:: BinOp :: Eq , & old, expect_old) ?. 0 ;
570
570
// If the operation would succeed, but is "weak", fail some portion
571
571
// of the time, based on `rate`.
572
572
let rate = this. memory . extra . cmpxchg_weak_failure_rate ;
@@ -581,7 +581,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
581
581
// if successful, perform a full rw-atomic validation
582
582
// otherwise treat this as an atomic load with the fail ordering.
583
583
if cmpxchg_success {
584
- this. allow_data_races_mut ( |this| this. write_scalar ( new, place. into ( ) ) ) ?;
584
+ this. allow_data_races_mut ( |this| this. write_scalar ( new, & ( * place) . into ( ) ) ) ?;
585
585
this. validate_atomic_rmw ( place, success) ?;
586
586
} else {
587
587
this. validate_atomic_load ( place, fail) ?;
@@ -595,7 +595,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
595
595
/// associated memory-place and on the current thread.
596
596
fn validate_atomic_load (
597
597
& self ,
598
- place : MPlaceTy < ' tcx , Tag > ,
598
+ place : & MPlaceTy < ' tcx , Tag > ,
599
599
atomic : AtomicReadOp ,
600
600
) -> InterpResult < ' tcx > {
601
601
let this = self . eval_context_ref ( ) ;
@@ -617,7 +617,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
617
617
/// associated memory-place and on the current thread.
618
618
fn validate_atomic_store (
619
619
& mut self ,
620
- place : MPlaceTy < ' tcx , Tag > ,
620
+ place : & MPlaceTy < ' tcx , Tag > ,
621
621
atomic : AtomicWriteOp ,
622
622
) -> InterpResult < ' tcx > {
623
623
let this = self . eval_context_ref ( ) ;
@@ -639,7 +639,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
639
639
/// at the associated memory place and on the current thread.
640
640
fn validate_atomic_rmw (
641
641
& mut self ,
642
- place : MPlaceTy < ' tcx , Tag > ,
642
+ place : & MPlaceTy < ' tcx , Tag > ,
643
643
atomic : AtomicRwOp ,
644
644
) -> InterpResult < ' tcx > {
645
645
use AtomicRwOp :: * ;
@@ -973,7 +973,7 @@ trait EvalContextPrivExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
973
973
/// atomic-stores/atomic-rmw?
974
974
fn validate_atomic_op < A : Debug + Copy > (
975
975
& self ,
976
- place : MPlaceTy < ' tcx , Tag > ,
976
+ place : & MPlaceTy < ' tcx , Tag > ,
977
977
atomic : A ,
978
978
description : & str ,
979
979
mut op : impl FnMut (
0 commit comments