@@ -79,9 +79,6 @@ struct Mutex {
79
79
queue : VecDeque < ThreadId > ,
80
80
/// Mutex clock. This tracks the moment of the last unlock.
81
81
clock : VClock ,
82
-
83
- /// Additional data that can be set by shim implementations.
84
- data : Option < Box < dyn Any > > ,
85
82
}
86
83
87
84
declare_id ! ( RwLockId ) ;
@@ -118,9 +115,6 @@ struct RwLock {
118
115
/// locks.
119
116
/// This is only relevant when there is an active reader.
120
117
clock_current_readers : VClock ,
121
-
122
- /// Additional data that can be set by shim implementations.
123
- data : Option < Box < dyn Any > > ,
124
118
}
125
119
126
120
declare_id ! ( CondvarId ) ;
@@ -290,56 +284,22 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
290
284
& mut self ,
291
285
lock : & MPlaceTy < ' tcx > ,
292
286
offset : u64 ,
293
- initialize_data : impl for < ' a > FnOnce (
294
- & ' a mut MiriInterpCx < ' tcx > ,
295
- ) -> InterpResult < ' tcx , Option < Box < dyn Any > > > ,
296
287
) -> InterpResult < ' tcx , MutexId > {
297
288
let this = self . eval_context_mut ( ) ;
298
289
this. get_or_create_id (
299
290
lock,
300
291
offset,
301
292
|ecx| & mut ecx. machine . sync . mutexes ,
302
- |ecx| initialize_data ( ecx ) . map ( |data| Mutex { data , .. Default :: default ( ) } ) ,
293
+ |_ecx| interp_ok ( Mutex :: default ( ) ) ,
303
294
) ?
304
295
. ok_or_else ( || err_ub_format ! ( "mutex has invalid ID" ) )
305
296
. into ( )
306
297
}
307
298
308
- /// Retrieve the additional data stored for a mutex.
309
- fn mutex_get_data < ' a , T : ' static > ( & ' a mut self , id : MutexId ) -> Option < & ' a T >
310
- where
311
- ' tcx : ' a ,
312
- {
313
- let this = self . eval_context_ref ( ) ;
314
- this. machine . sync . mutexes [ id] . data . as_deref ( ) . and_then ( |p| p. downcast_ref :: < T > ( ) )
315
- }
316
-
317
- fn rwlock_get_or_create_id (
318
- & mut self ,
319
- lock : & MPlaceTy < ' tcx > ,
320
- offset : u64 ,
321
- initialize_data : impl for < ' a > FnOnce (
322
- & ' a mut MiriInterpCx < ' tcx > ,
323
- ) -> InterpResult < ' tcx , Option < Box < dyn Any > > > ,
324
- ) -> InterpResult < ' tcx , RwLockId > {
299
+ /// Eagerly create and initialize a new rwlock.
300
+ fn rwlock_create ( & mut self ) -> RwLockId {
325
301
let this = self . eval_context_mut ( ) ;
326
- this. get_or_create_id (
327
- lock,
328
- offset,
329
- |ecx| & mut ecx. machine . sync . rwlocks ,
330
- |ecx| initialize_data ( ecx) . map ( |data| RwLock { data, ..Default :: default ( ) } ) ,
331
- ) ?
332
- . ok_or_else ( || err_ub_format ! ( "rwlock has invalid ID" ) )
333
- . into ( )
334
- }
335
-
336
- /// Retrieve the additional data stored for a rwlock.
337
- fn rwlock_get_data < ' a , T : ' static > ( & ' a mut self , id : RwLockId ) -> Option < & ' a T >
338
- where
339
- ' tcx : ' a ,
340
- {
341
- let this = self . eval_context_ref ( ) ;
342
- this. machine . sync . rwlocks [ id] . data . as_deref ( ) . and_then ( |p| p. downcast_ref :: < T > ( ) )
302
+ this. machine . sync . rwlocks . push ( Default :: default ( ) )
343
303
}
344
304
345
305
/// Eagerly create and initialize a new condvar.
0 commit comments