@@ -117,8 +117,7 @@ enum MutexKind {
117117}
118118
119119#[ derive( Debug , Clone , Copy ) ]
120- /// Additional data that we attach with each mutex instance.
121- struct MutexData {
120+ struct PthreadMutex {
122121id : MutexId ,
123122kind : MutexKind ,
124123}
@@ -173,10 +172,10 @@ fn mutex_create<'tcx>(
173172ecx : & mut MiriInterpCx < ' tcx > ,
174173mutex_ptr : & OpTy < ' tcx > ,
175174kind : MutexKind ,
176- ) -> InterpResult < ' tcx , MutexData > {
175+ ) -> InterpResult < ' tcx , PthreadMutex > {
177176let mutex = ecx. deref_pointer ( mutex_ptr) ?;
178177let id = ecx. machine . sync . mutex_create ( ) ;
179- let data = MutexData { id, kind } ;
178+ let data = PthreadMutex { id, kind } ;
180179lazy_sync_init ( ecx, & mutex, mutex_init_offset ( ecx) ?, data) ?;
181180interp_ok ( data)
182181}
@@ -188,12 +187,12 @@ fn mutex_create<'tcx>(
188187fn mutex_get_data < ' tcx , ' a > (
189188ecx : & ' a mut MiriInterpCx < ' tcx > ,
190189mutex_ptr : & OpTy < ' tcx > ,
191- ) -> InterpResult < ' tcx , MutexData > {
190+ ) -> InterpResult < ' tcx , PthreadMutex > {
192191let mutex = ecx. deref_pointer ( mutex_ptr) ?;
193192lazy_sync_get_data ( ecx, & mutex, mutex_init_offset ( ecx) ?, "pthread_mutex_t" , |ecx| {
194193let kind = mutex_kind_from_static_initializer ( ecx, & mutex) ?;
195194let id = ecx. machine . sync . mutex_create ( ) ;
196- interp_ok ( MutexData { id, kind } )
195+ interp_ok ( PthreadMutex { id, kind } )
197196} )
198197}
199198
@@ -228,8 +227,7 @@ fn mutex_kind_from_static_initializer<'tcx>(
228227// - init: u32
229228
230229#[ derive( Debug , Copy , Clone ) ]
231- /// Additional data that we attach with each rwlock instance.
232- struct RwLockData {
230+ struct PthreadRwLock {
233231id : RwLockId ,
234232}
235233
@@ -261,7 +259,7 @@ fn rwlock_init_offset<'tcx>(ecx: &MiriInterpCx<'tcx>) -> InterpResult<'tcx, Size
261259fn rwlock_get_data < ' tcx > (
262260ecx : & mut MiriInterpCx < ' tcx > ,
263261rwlock_ptr : & OpTy < ' tcx > ,
264- ) -> InterpResult < ' tcx , RwLockData > {
262+ ) -> InterpResult < ' tcx , PthreadRwLock > {
265263let rwlock = ecx. deref_pointer ( rwlock_ptr) ?;
266264lazy_sync_get_data ( ecx, & rwlock, rwlock_init_offset ( ecx) ?, "pthread_rwlock_t" , |ecx| {
267265if !bytewise_equal_atomic_relaxed (
@@ -272,7 +270,7 @@ fn rwlock_get_data<'tcx>(
272270throw_unsup_format ! ( "unsupported static initializer used for `pthread_rwlock_t`" ) ;
273271}
274272let id = ecx. machine . sync . rwlock_create ( ) ;
275- interp_ok ( RwLockData { id } )
273+ interp_ok ( PthreadRwLock { id } )
276274} )
277275}
278276
@@ -366,8 +364,7 @@ enum ClockId {
366364}
367365
368366#[ derive( Debug , Copy , Clone ) ]
369- /// Additional data that we attach with each cond instance.
370- struct CondData {
367+ struct PthreadCondvar {
371368id : CondvarId ,
372369clock : ClockId ,
373370}
@@ -376,18 +373,18 @@ fn cond_create<'tcx>(
376373ecx : & mut MiriInterpCx < ' tcx > ,
377374cond_ptr : & OpTy < ' tcx > ,
378375clock : ClockId ,
379- ) -> InterpResult < ' tcx , CondData > {
376+ ) -> InterpResult < ' tcx , PthreadCondvar > {
380377let cond = ecx. deref_pointer ( cond_ptr) ?;
381378let id = ecx. machine . sync . condvar_create ( ) ;
382- let data = CondData { id, clock } ;
379+ let data = PthreadCondvar { id, clock } ;
383380lazy_sync_init ( ecx, & cond, cond_init_offset ( ecx) ?, data) ?;
384381interp_ok ( data)
385382}
386383
387384fn cond_get_data < ' tcx > (
388385ecx : & mut MiriInterpCx < ' tcx > ,
389386cond_ptr : & OpTy < ' tcx > ,
390- ) -> InterpResult < ' tcx , CondData > {
387+ ) -> InterpResult < ' tcx , PthreadCondvar > {
391388let cond = ecx. deref_pointer ( cond_ptr) ?;
392389lazy_sync_get_data ( ecx, & cond, cond_init_offset ( ecx) ?, "pthread_cond_t" , |ecx| {
393390if !bytewise_equal_atomic_relaxed (
@@ -399,7 +396,7 @@ fn cond_get_data<'tcx>(
399396}
400397// This used the static initializer. The clock there is always CLOCK_REALTIME.
401398let id = ecx. machine . sync . condvar_create ( ) ;
402- interp_ok ( CondData { id, clock : ClockId :: Realtime } )
399+ interp_ok ( PthreadCondvar { id, clock : ClockId :: Realtime } )
403400} )
404401}
405402
0 commit comments