@@ -77,9 +77,7 @@ use std::{
77
77
collections:: VecDeque ,
78
78
} ;
79
79
80
- use rustc_const_eval:: interpret:: {
81
- alloc_range, AllocRange , InterpResult , MPlaceTy , ScalarMaybeUninit ,
82
- } ;
80
+ use rustc_const_eval:: interpret:: { alloc_range, AllocRange , InterpResult , MPlaceTy , Scalar } ;
83
81
use rustc_data_structures:: fx:: FxHashMap ;
84
82
85
83
use crate :: * ;
@@ -130,10 +128,10 @@ struct StoreElement {
130
128
/// The timestamp of the storing thread when it performed the store
131
129
timestamp : VTimestamp ,
132
130
/// The value of this store
133
- // FIXME: this means the store is either fully initialized or fully uninitialized ;
131
+ // FIXME: this means the store must be fully initialized;
134
132
// we will have to change this if we want to support atomics on
135
- // partially initialized data.
136
- val : ScalarMaybeUninit < Provenance > ,
133
+ // ( partially) uninitialized data.
134
+ val : Scalar < Provenance > ,
137
135
138
136
/// Timestamp of first loads from this store element by each thread
139
137
/// Behind a RefCell to keep load op take &self
@@ -180,7 +178,7 @@ impl StoreBufferAlloc {
180
178
fn get_or_create_store_buffer < ' tcx > (
181
179
& self ,
182
180
range : AllocRange ,
183
- init : ScalarMaybeUninit < Provenance > ,
181
+ init : Scalar < Provenance > ,
184
182
) -> InterpResult < ' tcx , Ref < ' _ , StoreBuffer > > {
185
183
let access_type = self . store_buffers . borrow ( ) . access_type ( range) ;
186
184
let pos = match access_type {
@@ -205,7 +203,7 @@ impl StoreBufferAlloc {
205
203
fn get_or_create_store_buffer_mut < ' tcx > (
206
204
& mut self ,
207
205
range : AllocRange ,
208
- init : ScalarMaybeUninit < Provenance > ,
206
+ init : Scalar < Provenance > ,
209
207
) -> InterpResult < ' tcx , & mut StoreBuffer > {
210
208
let buffers = self . store_buffers . get_mut ( ) ;
211
209
let access_type = buffers. access_type ( range) ;
@@ -226,7 +224,7 @@ impl StoreBufferAlloc {
226
224
}
227
225
228
226
impl < ' mir , ' tcx : ' mir > StoreBuffer {
229
- fn new ( init : ScalarMaybeUninit < Provenance > ) -> Self {
227
+ fn new ( init : Scalar < Provenance > ) -> Self {
230
228
let mut buffer = VecDeque :: new ( ) ;
231
229
buffer. reserve ( STORE_BUFFER_LIMIT ) ;
232
230
let mut ret = Self { buffer } ;
@@ -259,7 +257,7 @@ impl<'mir, 'tcx: 'mir> StoreBuffer {
259
257
is_seqcst : bool ,
260
258
rng : & mut ( impl rand:: Rng + ?Sized ) ,
261
259
validate : impl FnOnce ( ) -> InterpResult < ' tcx > ,
262
- ) -> InterpResult < ' tcx , ( ScalarMaybeUninit < Provenance > , LoadRecency ) > {
260
+ ) -> InterpResult < ' tcx , ( Scalar < Provenance > , LoadRecency ) > {
263
261
// Having a live borrow to store_buffer while calling validate_atomic_load is fine
264
262
// because the race detector doesn't touch store_buffer
265
263
@@ -284,7 +282,7 @@ impl<'mir, 'tcx: 'mir> StoreBuffer {
284
282
285
283
fn buffered_write (
286
284
& mut self ,
287
- val : ScalarMaybeUninit < Provenance > ,
285
+ val : Scalar < Provenance > ,
288
286
global : & DataRaceState ,
289
287
thread_mgr : & ThreadManager < ' _ , ' _ > ,
290
288
is_seqcst : bool ,
@@ -375,7 +373,7 @@ impl<'mir, 'tcx: 'mir> StoreBuffer {
375
373
/// ATOMIC STORE IMPL in the paper (except we don't need the location's vector clock)
376
374
fn store_impl (
377
375
& mut self ,
378
- val : ScalarMaybeUninit < Provenance > ,
376
+ val : Scalar < Provenance > ,
379
377
index : VectorIdx ,
380
378
thread_clock : & VClock ,
381
379
is_seqcst : bool ,
@@ -417,11 +415,7 @@ impl StoreElement {
417
415
/// buffer regardless of subsequent loads by the same thread; if the earliest load of another
418
416
/// thread doesn't happen before the current one, then no subsequent load by the other thread
419
417
/// can happen before the current one.
420
- fn load_impl (
421
- & self ,
422
- index : VectorIdx ,
423
- clocks : & ThreadClockSet ,
424
- ) -> ScalarMaybeUninit < Provenance > {
418
+ fn load_impl ( & self , index : VectorIdx , clocks : & ThreadClockSet ) -> Scalar < Provenance > {
425
419
let _ = self . loads . borrow_mut ( ) . try_insert ( index, clocks. clock [ index] ) ;
426
420
self . val
427
421
}
@@ -464,10 +458,10 @@ pub(super) trait EvalContextExt<'mir, 'tcx: 'mir>:
464
458
465
459
fn buffered_atomic_rmw (
466
460
& mut self ,
467
- new_val : ScalarMaybeUninit < Provenance > ,
461
+ new_val : Scalar < Provenance > ,
468
462
place : & MPlaceTy < ' tcx , Provenance > ,
469
463
atomic : AtomicRwOrd ,
470
- init : ScalarMaybeUninit < Provenance > ,
464
+ init : Scalar < Provenance > ,
471
465
) -> InterpResult < ' tcx > {
472
466
let this = self . eval_context_mut ( ) ;
473
467
let ( alloc_id, base_offset, ..) = this. ptr_get_alloc_id ( place. ptr ) ?;
@@ -492,9 +486,9 @@ pub(super) trait EvalContextExt<'mir, 'tcx: 'mir>:
492
486
& self ,
493
487
place : & MPlaceTy < ' tcx , Provenance > ,
494
488
atomic : AtomicReadOrd ,
495
- latest_in_mo : ScalarMaybeUninit < Provenance > ,
489
+ latest_in_mo : Scalar < Provenance > ,
496
490
validate : impl FnOnce ( ) -> InterpResult < ' tcx > ,
497
- ) -> InterpResult < ' tcx , ScalarMaybeUninit < Provenance > > {
491
+ ) -> InterpResult < ' tcx , Scalar < Provenance > > {
498
492
let this = self . eval_context_ref ( ) ;
499
493
if let Some ( global) = & this. machine . data_race {
500
494
let ( alloc_id, base_offset, ..) = this. ptr_get_alloc_id ( place. ptr ) ?;
@@ -529,10 +523,10 @@ pub(super) trait EvalContextExt<'mir, 'tcx: 'mir>:
529
523
530
524
fn buffered_atomic_write (
531
525
& mut self ,
532
- val : ScalarMaybeUninit < Provenance > ,
526
+ val : Scalar < Provenance > ,
533
527
dest : & MPlaceTy < ' tcx , Provenance > ,
534
528
atomic : AtomicWriteOrd ,
535
- init : ScalarMaybeUninit < Provenance > ,
529
+ init : Scalar < Provenance > ,
536
530
) -> InterpResult < ' tcx > {
537
531
let this = self . eval_context_mut ( ) ;
538
532
let ( alloc_id, base_offset, ..) = this. ptr_get_alloc_id ( dest. ptr ) ?;
@@ -576,7 +570,7 @@ pub(super) trait EvalContextExt<'mir, 'tcx: 'mir>:
576
570
& self ,
577
571
place : & MPlaceTy < ' tcx , Provenance > ,
578
572
atomic : AtomicReadOrd ,
579
- init : ScalarMaybeUninit < Provenance > ,
573
+ init : Scalar < Provenance > ,
580
574
) -> InterpResult < ' tcx > {
581
575
let this = self . eval_context_ref ( ) ;
582
576
0 commit comments