@@ -40,8 +40,8 @@ opdi::MutexOmpLogic::AllCounters opdi::MutexOmpLogic::evaluationCounters;
4040 opdi::MutexOmpLogic::AllCounters opdi::MutexOmpLogic::tsanDummies;
4141#endif
4242
43- void opdi::MutexOmpLogic::checkKind (MutexKind kind ) {
44- if (kind >= nMutexKind) {
43+ void opdi::MutexOmpLogic::checkKind (MutexKind mutexKind ) {
44+ if (mutexKind >= nMutexKind) {
4545 OPDI_ERROR (" Invalid mutex kind." );
4646 }
4747}
@@ -61,15 +61,15 @@ void opdi::MutexOmpLogic::waitReverseFunc(void* dataPtr) {
6161 MutexOmpLogic::Counter currentValue;
6262
6363 #pragma omp atomic read
64- currentValue = MutexOmpLogic::evaluationCounters[data->kind ][data->waitId ];
64+ currentValue = MutexOmpLogic::evaluationCounters[data->mutexKind ][data->waitId ];
6565
6666 if (currentValue == data->counter ) {
6767 break ;
6868 }
6969 }
7070
7171 #ifdef __SANITIZE_THREAD__
72- ANNOTATE_RWLOCK_ACQUIRED (&MutexOmpLogic::tsanDummies[data->kind ][data->waitId ], true );
72+ ANNOTATE_RWLOCK_ACQUIRED (&MutexOmpLogic::tsanDummies[data->mutexKind ][data->waitId ], true );
7373 #endif
7474}
7575
@@ -83,12 +83,12 @@ void opdi::MutexOmpLogic::decrementReverseFunc(void* dataPtr) {
8383 Data* data = static_cast <Data*>(dataPtr);
8484
8585 #ifdef __SANITIZE_THREAD__
86- ANNOTATE_RWLOCK_RELEASED (&MutexOmpLogic::tsanDummies[data->kind ][data->waitId ], true );
86+ ANNOTATE_RWLOCK_RELEASED (&MutexOmpLogic::tsanDummies[data->mutexKind ][data->waitId ], true );
8787 #endif
8888
8989 // decrement counter
9090 #pragma omp atomic update
91- MutexOmpLogic::evaluationCounters[data->kind ][data->waitId ] -= 1 ;
91+ MutexOmpLogic::evaluationCounters[data->mutexKind ][data->waitId ] -= 1 ;
9292
9393 #if OPDI_OMP_LOGIC_INSTRUMENT
9494 for (auto & instrument : ompLogicInstruments) {
@@ -115,24 +115,24 @@ void opdi::MutexOmpLogic::internalFinalize() {
115115 }
116116}
117117
118- void opdi::MutexOmpLogic::onMutexDestroyed (MutexKind kind , WaitId waitId) {
118+ void opdi::MutexOmpLogic::onMutexDestroyed (MutexKind mutexKind , WaitId waitId) {
119119
120120 #if OPDI_OMP_LOGIC_INSTRUMENT
121121 for (auto & instrument : ompLogicInstruments) {
122- instrument->onMutexDestroyed (kind , waitId);
122+ instrument->onMutexDestroyed (mutexKind , waitId);
123123 }
124124 #endif
125125
126- checkKind (kind );
127- this ->recordings [kind ].inactive .erase (waitId);
126+ checkKind (mutexKind );
127+ this ->recordings [mutexKind ].inactive .erase (waitId);
128128}
129129
130- void opdi::MutexOmpLogic::onMutexAcquired (MutexKind kind , WaitId waitId) {
130+ void opdi::MutexOmpLogic::onMutexAcquired (MutexKind mutexKind , WaitId waitId) {
131131
132- checkKind (kind );
132+ checkKind (mutexKind );
133133
134134 // always skip internal locks
135- if (MutexKind::Lock == kind ) {
135+ if (MutexKind::Lock == mutexKind ) {
136136 for (std::size_t mutexKind = 0 ; mutexKind < nMutexKind; ++mutexKind) {
137137 if (waitId == this ->recordings [mutexKind].waitId ) {
138138 return ;
@@ -143,16 +143,16 @@ void opdi::MutexOmpLogic::onMutexAcquired(MutexKind kind, WaitId waitId) {
143143 if (tool != nullptr && tool->getThreadLocalTape () != nullptr && tool->isActive (tool->getThreadLocalTape ())) {
144144
145145 // skip inactive mutexes
146- if (recordings[kind ].inactive .count (waitId) == 0 ) {
146+ if (recordings[mutexKind ].inactive .count (waitId) == 0 ) {
147147
148148 Data* data = new Data;
149- data->kind = kind ;
149+ data->mutexKind = mutexKind ;
150150 data->waitId = waitId;
151151
152- omp_set_lock (&recordings[kind ].lock );
153- data->counter = recordings[kind ].counters [waitId]++;
154- localCounters[kind ][waitId] = recordings[kind ].counters [waitId]; // remember incremented counter value for the release event
155- omp_unset_lock (&recordings[kind ].lock );
152+ omp_set_lock (&recordings[mutexKind ].lock );
153+ data->counter = recordings[mutexKind ].counters [waitId]++;
154+ localCounters[mutexKind ][waitId] = recordings[mutexKind ].counters [waitId]; // remember incremented counter value for the release event
155+ omp_unset_lock (&recordings[mutexKind ].lock );
156156
157157 #if OPDI_OMP_LOGIC_INSTRUMENT
158158 for (auto & instrument : ompLogicInstruments) {
@@ -171,12 +171,12 @@ void opdi::MutexOmpLogic::onMutexAcquired(MutexKind kind, WaitId waitId) {
171171 }
172172}
173173
174- void opdi::MutexOmpLogic::onMutexReleased (MutexKind kind , WaitId waitId) {
174+ void opdi::MutexOmpLogic::onMutexReleased (MutexKind mutexKind , WaitId waitId) {
175175
176- checkKind (kind );
176+ checkKind (mutexKind );
177177
178178 // always skip internal locks
179- if (MutexKind::Lock == kind ) {
179+ if (MutexKind::Lock == mutexKind ) {
180180 for (std::size_t mutexKind = 0 ; mutexKind < nMutexKind; ++mutexKind) {
181181 if (waitId == this ->recordings [mutexKind].waitId ) {
182182 return ;
@@ -187,15 +187,13 @@ void opdi::MutexOmpLogic::onMutexReleased(MutexKind kind, WaitId waitId) {
187187 if (tool != nullptr && tool->getThreadLocalTape () != nullptr && tool->isActive (tool->getThreadLocalTape ())) {
188188
189189 // skip inactive mutexes
190- if (recordings[kind ].inactive .count (waitId) == 0 ) {
190+ if (recordings[mutexKind ].inactive .count (waitId) == 0 ) {
191191
192192 Data* data = new Data;
193- data->kind = kind ;
193+ data->mutexKind = mutexKind ;
194194 data->waitId = waitId;
195195
196- omp_set_lock (&recordings[kind].lock );
197- data->counter = localCounters[kind][waitId];
198- omp_unset_lock (&recordings[kind].lock );
196+ data->counter = localCounters[mutexKind][waitId];
199197
200198 #if OPDI_OMP_LOGIC_INSTRUMENT
201199 for (auto & instrument : ompLogicInstruments) {
@@ -215,9 +213,9 @@ void opdi::MutexOmpLogic::onMutexReleased(MutexKind kind, WaitId waitId) {
215213}
216214
217215// not thread safe! only use outside parallel regions
218- void opdi::MutexOmpLogic::registerInactiveMutex (MutexKind kind , WaitId waitId) {
219- checkKind (kind );
220- this ->recordings [kind ].inactive .insert (waitId);
216+ void opdi::MutexOmpLogic::registerInactiveMutex (MutexKind mutexKind , WaitId waitId) {
217+ checkKind (mutexKind );
218+ this ->recordings [mutexKind ].inactive .insert (waitId);
221219}
222220
223221void opdi::MutexOmpLogic::prepareEvaluate () {
0 commit comments