Home | History | Annotate | Download | only in sanitizer_common

Lines Matching refs:dtls

199   void ensureCurrentEpoch(DeadlockDetectorTLS<BV> *dtls) {
200 dtls->ensureCurrentEpoch(current_epoch_);
206 bool onLockBefore(DeadlockDetectorTLS<BV> *dtls, uptr cur_node) {
207 ensureCurrentEpoch(dtls);
209 return g_.isReachable(cur_idx, dtls->getLocks(current_epoch_));
212 u32 findLockContext(DeadlockDetectorTLS<BV> *dtls, uptr node) {
213 return dtls->findLockContext(nodeToIndex(node));
216 // Add cur_node to the set of locks held currently by dtls.
217 void onLockAfter(DeadlockDetectorTLS<BV> *dtls, uptr cur_node, u32 stk = 0) {
218 ensureCurrentEpoch(dtls);
220 dtls->addLock(cur_idx, current_epoch_, stk);
225 bool hasAllEdges(DeadlockDetectorTLS<BV> *dtls, uptr cur_node) {
226 uptr local_epoch = dtls->getEpoch();
231 for (uptr i = 0, n = dtls->getNumLocks(); i < n; i++) {
232 if (!g_.hasEdge(dtls->getLock(i), cur_idx))
244 uptr addEdges(DeadlockDetectorTLS<BV> *dtls, uptr cur_node, u32 stk,
246 ensureCurrentEpoch(dtls);
249 uptr n_added_edges = g_.addEdges(dtls->getLocks(current_epoch_), cur_idx,
254 dtls->findLockContext(added_edges[i]), stk,
281 bool onLock(DeadlockDetectorTLS<BV> *dtls, uptr cur_node, u32 stk = 0) {
282 ensureCurrentEpoch(dtls);
283 bool is_reachable = !isHeld(dtls, cur_node) && onLockBefore(dtls, cur_node);
284 addEdges(dtls, cur_node, stk, 0);
285 onLockAfter(dtls, cur_node, stk);
294 bool onTryLock(DeadlockDetectorTLS<BV> *dtls, uptr cur_node, u32 stk = 0) {
295 ensureCurrentEpoch(dtls);
297 dtls->addLock(cur_idx, current_epoch_, stk);
301 // Returns true iff dtls is empty (no locks are currently held) and we can
303 // This operation is thread-safe as it only touches the dtls.
304 bool onFirstLock(DeadlockDetectorTLS<BV> *dtls, uptr node, u32 stk = 0) {
305 if (!dtls->empty()) return false;
306 if (dtls->getEpoch() && dtls->getEpoch() == nodeToEpoch(node)) {
307 dtls->addLock(nodeToIndexUnchecked(node), nodeToEpoch(node), stk);
313 // Finds a path between the lock 'cur_node' (currently not held in dtls)
316 uptr findPathToLock(DeadlockDetectorTLS<BV> *dtls, uptr cur_node, uptr *path,
318 tmp_bv_.copyFrom(dtls->getLocks(current_epoch_));
330 // This operation is thread-safe as it only touches the dtls.
331 void onUnlock(DeadlockDetectorTLS<BV> *dtls, uptr node) {
332 if (dtls->getEpoch() == nodeToEpoch(node))
333 dtls->removeLock(nodeToIndexUnchecked(node));
338 // This operation is thread-safe as it only touches the dtls
340 bool onLockFast(DeadlockDetectorTLS<BV> *dtls, uptr node, u32 stk = 0) {
341 if (hasAllEdges(dtls, node)) {
342 dtls->addLock(nodeToIndexUnchecked(node), nodeToEpoch(node), stk);
348 bool isHeld(DeadlockDetectorTLS<BV> *dtls, uptr node) const {
349 return dtls->getLocks(current_epoch_).getBit(nodeToIndex(node));