Lines Matching refs:DRD_
67 DrdThreadId DRD_(g_drd_running_tid) = DRD_INVALID_THREADID;
68 ThreadInfo* DRD_(g_threadinfo);
69 struct bitmap* DRD_(g_conflict_set);
70 Bool DRD_(verify_conflict_set);
82 Bool DRD_(ignore_thread_creation) = True;
84 Bool DRD_(ignore_thread_creation) = False;
91 void DRD_(thread_trace_context_switches)(const Bool t) in DRD_() function
98 void DRD_(thread_trace_conflict_set)(const Bool t) in DRD_() function
105 void DRD_(thread_trace_conflict_set_bm)(const Bool t) in DRD_() function
112 Bool DRD_(thread_get_trace_fork_join)(void) in DRD_() function
118 void DRD_(thread_set_trace_fork_join)(const Bool t) in DRD_() function
125 void DRD_(thread_set_segment_merging)(const Bool m) in DRD_() function
132 int DRD_(thread_get_segment_merge_interval)(void) in DRD_() function
138 void DRD_(thread_set_segment_merge_interval)(const int i) in DRD_() function
143 void DRD_(thread_set_join_list_vol)(const int jlv) in DRD_() function
148 void DRD_(thread_init)(void) in DRD_() function
150 DRD_(g_threadinfo) = VG_(malloc)("drd.main.ti.1", in DRD_()
151 DRD_N_THREADS * sizeof DRD_(g_threadinfo)[0]); in DRD_()
154 DRD_(g_threadinfo)[i] = initval; in DRD_()
164 DrdThreadId DRD_(VgThreadIdToDrdThreadId)(const ThreadId tid) in DRD_() function
173 if (DRD_(g_threadinfo)[i].vg_thread_exists == True in DRD_()
174 && DRD_(g_threadinfo)[i].vg_threadid == tid) in DRD_()
184 static DrdThreadId DRD_(VgThreadIdToNewDrdThreadId)(const ThreadId tid) in DRD_() function
188 tl_assert(DRD_(VgThreadIdToDrdThreadId)(tid) == DRD_INVALID_THREADID); in DRD_()
192 if (!DRD_(g_threadinfo)[i].valid) in DRD_()
194 tl_assert(! DRD_(IsValidDrdThreadId)(i)); in DRD_()
196 DRD_(g_threadinfo)[i].valid = True; in DRD_()
197 DRD_(g_threadinfo)[i].vg_thread_exists = True; in DRD_()
198 DRD_(g_threadinfo)[i].vg_threadid = tid; in DRD_()
199 DRD_(g_threadinfo)[i].pt_threadid = INVALID_POSIX_THREADID; in DRD_()
200 DRD_(g_threadinfo)[i].stack_min = 0; in DRD_()
201 DRD_(g_threadinfo)[i].stack_min_min = 0; in DRD_()
202 DRD_(g_threadinfo)[i].stack_startup = 0; in DRD_()
203 DRD_(g_threadinfo)[i].stack_max = 0; in DRD_()
204 DRD_(thread_set_name)(i, ""); in DRD_()
205 DRD_(g_threadinfo)[i].on_alt_stack = False; in DRD_()
206 DRD_(g_threadinfo)[i].is_recording_loads = True; in DRD_()
207 DRD_(g_threadinfo)[i].is_recording_stores = True; in DRD_()
208 DRD_(g_threadinfo)[i].pthread_create_nesting_level = 0; in DRD_()
209 DRD_(g_threadinfo)[i].synchr_nesting = 0; in DRD_()
210 DRD_(g_threadinfo)[i].deletion_seq = s_deletion_tail - 1; in DRD_()
211 DRD_(g_threadinfo)[i].creator_thread = DRD_INVALID_THREADID; in DRD_()
213 DRD_(g_threadinfo)[i].bind_guard_flag = 0; in DRD_()
216 tl_assert(DRD_(g_threadinfo)[i].sg_first == NULL); in DRD_()
217 tl_assert(DRD_(g_threadinfo)[i].sg_last == NULL); in DRD_()
219 tl_assert(DRD_(IsValidDrdThreadId)(i)); in DRD_()
235 DrdThreadId DRD_(PtThreadIdToDrdThreadId)(const PThreadId tid) in DRD_() function
243 if (DRD_(g_threadinfo)[i].posix_thread_exists in DRD_()
244 && DRD_(g_threadinfo)[i].pt_threadid == tid) in DRD_()
254 ThreadId DRD_(DrdThreadIdToVgThreadId)(const DrdThreadId tid) in DRD_() function
259 return (DRD_(g_threadinfo)[tid].vg_thread_exists in DRD_()
260 ? DRD_(g_threadinfo)[tid].vg_threadid in DRD_()
270 static Bool DRD_(sane_ThreadInfo)(const ThreadInfo* const ti) in DRD_() function
303 DrdThreadId DRD_(thread_pre_create)(const DrdThreadId creator, in DRD_() function
308 tl_assert(DRD_(VgThreadIdToDrdThreadId)(vg_created) == DRD_INVALID_THREADID); in DRD_()
309 created = DRD_(VgThreadIdToNewDrdThreadId)(vg_created); in DRD_()
313 tl_assert(DRD_(g_threadinfo)[created].sg_first == NULL); in DRD_()
314 tl_assert(DRD_(g_threadinfo)[created].sg_last == NULL); in DRD_()
317 if (DRD_(ignore_thread_creation)) { in DRD_()
318 tl_assert(DRD_(thread_get_synchr_nesting_count)(created) == 0); in DRD_()
319 DRD_(thread_enter_synchr)(created); in DRD_()
323 DRD_(g_threadinfo)[created].creator_thread = creator; in DRD_()
326 thread_append_segment(created, DRD_(sg_new)(creator, created)); in DRD_()
341 DrdThreadId DRD_(thread_post_create)(const ThreadId vg_created) in DRD_() function
343 const DrdThreadId created = DRD_(VgThreadIdToDrdThreadId)(vg_created); in DRD_()
348 DRD_(g_threadinfo)[created].stack_max in DRD_()
350 DRD_(g_threadinfo)[created].stack_startup in DRD_()
351 = DRD_(g_threadinfo)[created].stack_max; in DRD_()
352 DRD_(g_threadinfo)[created].stack_min in DRD_()
353 = DRD_(g_threadinfo)[created].stack_max; in DRD_()
354 DRD_(g_threadinfo)[created].stack_min_min in DRD_()
355 = DRD_(g_threadinfo)[created].stack_max; in DRD_()
356 DRD_(g_threadinfo)[created].stack_size in DRD_()
358 tl_assert(DRD_(g_threadinfo)[created].stack_max != 0); in DRD_()
363 static void DRD_(thread_delayed_delete)(const DrdThreadId tid) in DRD_() function
367 DRD_(g_threadinfo)[tid].vg_thread_exists = False; in DRD_()
368 DRD_(g_threadinfo)[tid].posix_thread_exists = False; in DRD_()
369 DRD_(g_threadinfo)[tid].deletion_seq = s_deletion_head++; in DRD_()
375 if (DRD_(IsValidDrdThreadId)(j) in DRD_()
376 && DRD_(g_threadinfo)[j].deletion_seq == s_deletion_tail) in DRD_()
382 DRD_(thread_delete)(j, False); in DRD_()
393 void DRD_(thread_post_join)(DrdThreadId drd_joiner, DrdThreadId drd_joinee) in DRD_() function
395 tl_assert(DRD_(IsValidDrdThreadId)(drd_joiner)); in DRD_()
396 tl_assert(DRD_(IsValidDrdThreadId)(drd_joinee)); in DRD_()
398 DRD_(thread_new_segment)(drd_joiner); in DRD_()
399 DRD_(thread_combine_vc_join)(drd_joiner, drd_joinee); in DRD_()
400 DRD_(thread_new_segment)(drd_joinee); in DRD_()
404 const ThreadId joiner = DRD_(DrdThreadIdToVgThreadId)(drd_joiner); in DRD_()
417 vc = DRD_(vc_aprint)(DRD_(thread_get_vc)(drd_joiner)); in DRD_()
422 DRD_(trace_msg)("%pS", msg); in DRD_()
426 if (! DRD_(get_check_stack_accesses)()) in DRD_()
428 DRD_(finish_suppression)(DRD_(thread_get_stack_max)(drd_joinee) in DRD_()
429 - DRD_(thread_get_stack_size)(drd_joinee), in DRD_()
430 DRD_(thread_get_stack_max)(drd_joinee)); in DRD_()
432 DRD_(clientobj_delete_thread)(drd_joinee); in DRD_()
433 DRD_(thread_delayed_delete)(drd_joinee); in DRD_()
442 void DRD_(thread_set_stack_startup)(const DrdThreadId tid, in DRD_() function
447 tl_assert(DRD_(g_threadinfo)[tid].stack_min <= stack_startup); in DRD_()
448 tl_assert(stack_startup <= DRD_(g_threadinfo)[tid].stack_max); in DRD_()
449 DRD_(g_threadinfo)[tid].stack_startup = stack_startup; in DRD_()
453 Addr DRD_(thread_get_stack_min)(const DrdThreadId tid) in DRD_() function
457 return DRD_(g_threadinfo)[tid].stack_min; in DRD_()
464 Addr DRD_(thread_get_stack_min_min)(const DrdThreadId tid) in DRD_() function
468 return DRD_(g_threadinfo)[tid].stack_min_min; in DRD_()
472 Addr DRD_(thread_get_stack_max)(const DrdThreadId tid) in DRD_() function
476 return DRD_(g_threadinfo)[tid].stack_max; in DRD_()
480 SizeT DRD_(thread_get_stack_size)(const DrdThreadId tid) in DRD_() function
484 return DRD_(g_threadinfo)[tid].stack_size; in DRD_()
487 Bool DRD_(thread_get_on_alt_stack)(const DrdThreadId tid) in DRD_() function
491 return DRD_(g_threadinfo)[tid].on_alt_stack; in DRD_()
494 void DRD_(thread_set_on_alt_stack)(const DrdThreadId tid, in DRD_() function
500 DRD_(g_threadinfo)[tid].on_alt_stack = on_alt_stack; in DRD_()
503 Int DRD_(thread_get_threads_on_alt_stack)(void) in DRD_() function
508 n += DRD_(g_threadinfo)[i].on_alt_stack; in DRD_()
515 void DRD_(thread_delete)(const DrdThreadId tid, const Bool detached) in DRD_() function
520 tl_assert(DRD_(IsValidDrdThreadId)(tid)); in DRD_()
522 tl_assert(DRD_(g_threadinfo)[tid].synchr_nesting >= 0); in DRD_()
523 for (sg = DRD_(g_threadinfo)[tid].sg_last; sg; sg = sg_prev) { in DRD_()
527 DRD_(sg_put)(sg); in DRD_()
529 DRD_(g_threadinfo)[tid].valid = False; in DRD_()
530 DRD_(g_threadinfo)[tid].vg_thread_exists = False; in DRD_()
531 DRD_(g_threadinfo)[tid].posix_thread_exists = False; in DRD_()
533 DRD_(g_threadinfo)[tid].detached_posix_thread = False; in DRD_()
535 tl_assert(!DRD_(g_threadinfo)[tid].detached_posix_thread); in DRD_()
536 DRD_(g_threadinfo)[tid].sg_first = NULL; in DRD_()
537 DRD_(g_threadinfo)[tid].sg_last = NULL; in DRD_()
539 tl_assert(!DRD_(IsValidDrdThreadId)(tid)); in DRD_()
547 void DRD_(thread_finished)(const DrdThreadId tid) in DRD_() function
552 DRD_(g_threadinfo)[tid].vg_thread_exists = False; in DRD_()
554 if (DRD_(g_threadinfo)[tid].detached_posix_thread) in DRD_()
560 DRD_(g_threadinfo)[tid].stack_min = DRD_(g_threadinfo)[tid].stack_max; in DRD_()
568 DRD_(g_threadinfo)[tid].posix_thread_exists = False; in DRD_()
573 void DRD_(drd_thread_atfork_child)(const DrdThreadId tid) in DRD_() function
581 if (DRD_(IsValidDrdThreadId(i))) in DRD_()
582 DRD_(thread_delete)(i, True); in DRD_()
583 tl_assert(!DRD_(IsValidDrdThreadId(i))); in DRD_()
586 DRD_(bm_cleanup)(DRD_(g_conflict_set)); in DRD_()
587 DRD_(bm_init)(DRD_(g_conflict_set)); in DRD_()
591 void DRD_(thread_pre_cancel)(const DrdThreadId tid) in DRD_() function
595 tl_assert(DRD_(g_threadinfo)[tid].pt_threadid != INVALID_POSIX_THREADID); in DRD_()
597 if (DRD_(thread_get_trace_fork_join)()) in DRD_()
598 DRD_(trace_msg)("[%u] drd_thread_pre_cancel %u", in DRD_()
599 DRD_(g_drd_running_tid), tid); in DRD_()
609 void DRD_(thread_set_pthreadid)(const DrdThreadId tid, const PThreadId ptid) in DRD_() function
613 tl_assert(DRD_(g_threadinfo)[tid].pt_threadid == INVALID_POSIX_THREADID in DRD_()
614 || DRD_(g_threadinfo)[tid].pt_threadid == ptid); in DRD_()
616 DRD_(g_threadinfo)[tid].posix_thread_exists = True; in DRD_()
617 DRD_(g_threadinfo)[tid].pt_threadid = ptid; in DRD_()
619 if (DRD_(g_threadinfo)[tid].creator_thread != DRD_INVALID_THREADID) { in DRD_()
620 if (DRD_(ignore_thread_creation)) { in DRD_()
621 DRD_(thread_leave_synchr)(tid); in DRD_()
622 tl_assert(DRD_(thread_get_synchr_nesting_count)(tid) == 0); in DRD_()
628 Bool DRD_(thread_get_joinable)(const DrdThreadId tid) in DRD_() function
632 return ! DRD_(g_threadinfo)[tid].detached_posix_thread; in DRD_()
642 void DRD_(thread_set_joinable)(const DrdThreadId tid, const Bool joinable) in DRD_() function
647 tl_assert(DRD_(g_threadinfo)[tid].pt_threadid != INVALID_POSIX_THREADID); in DRD_()
649 DRD_(g_threadinfo)[tid].detached_posix_thread = ! joinable; in DRD_()
653 void DRD_(thread_entering_pthread_create)(const DrdThreadId tid) in DRD_() function
657 tl_assert(DRD_(g_threadinfo)[tid].pt_threadid != INVALID_POSIX_THREADID); in DRD_()
658 tl_assert(DRD_(g_threadinfo)[tid].pthread_create_nesting_level >= 0); in DRD_()
660 DRD_(g_threadinfo)[tid].pthread_create_nesting_level++; in DRD_()
662 if (DRD_(ignore_thread_creation)) { in DRD_()
663 tl_assert(DRD_(thread_get_synchr_nesting_count)(tid) == 0); in DRD_()
664 DRD_(thread_enter_synchr)(tid); in DRD_()
669 void DRD_(thread_left_pthread_create)(const DrdThreadId tid) in DRD_() function
673 tl_assert(DRD_(g_threadinfo)[tid].pt_threadid != INVALID_POSIX_THREADID); in DRD_()
674 tl_assert(DRD_(g_threadinfo)[tid].pthread_create_nesting_level > 0); in DRD_()
676 DRD_(g_threadinfo)[tid].pthread_create_nesting_level--; in DRD_()
678 if (DRD_(ignore_thread_creation)) { in DRD_()
679 DRD_(thread_leave_synchr)(tid); in DRD_()
680 tl_assert(DRD_(thread_get_synchr_nesting_count)(tid) == 0); in DRD_()
686 void DRD_(thread_entering_rtld_bind_guard)(const DrdThreadId tid, int flags) in DRD_() function
692 if ((bindflag & DRD_(g_threadinfo)[tid].bind_guard_flag) == 0) { in DRD_()
693 DRD_(g_threadinfo)[tid].bind_guard_flag |= bindflag; in DRD_()
694 DRD_(thread_enter_synchr)(tid); in DRD_()
702 void DRD_(thread_leaving_rtld_bind_clear)(const DrdThreadId tid, int flags) in DRD_() function
708 if ((DRD_(g_threadinfo)[tid].bind_guard_flag & bindflag) != 0) { in DRD_()
709 DRD_(g_threadinfo)[tid].bind_guard_flag &= ~bindflag; in DRD_()
710 DRD_(thread_leave_synchr)(tid); in DRD_()
716 const HChar* DRD_(thread_get_name)(const DrdThreadId tid) in DRD_() function
721 return DRD_(g_threadinfo)[tid].name; in DRD_()
725 void DRD_(thread_set_name)(const DrdThreadId tid, const HChar* const name) in DRD_() function
731 VG_(snprintf)(DRD_(g_threadinfo)[tid].name, in DRD_()
732 sizeof(DRD_(g_threadinfo)[tid].name), in DRD_()
736 VG_(snprintf)(DRD_(g_threadinfo)[tid].name, in DRD_()
737 sizeof(DRD_(g_threadinfo)[tid].name), in DRD_()
740 DRD_(g_threadinfo)[tid].name[sizeof(DRD_(g_threadinfo)[tid].name) - 1] = 0; in DRD_()
747 void DRD_(thread_set_vg_running_tid)(const ThreadId vg_tid) in DRD_() function
753 DRD_(thread_set_running_tid)(vg_tid, in DRD_()
754 DRD_(VgThreadIdToDrdThreadId)(vg_tid)); in DRD_()
758 tl_assert(DRD_(g_drd_running_tid) != DRD_INVALID_THREADID); in DRD_()
765 void DRD_(thread_set_running_tid)(const ThreadId vg_tid, in DRD_() function
774 && DRD_(g_drd_running_tid) != DRD_INVALID_THREADID) in DRD_()
779 DRD_(g_drd_running_tid), drd_tid, in DRD_()
780 DRD_(sg_get_segments_alive_count)()); in DRD_()
783 DRD_(g_drd_running_tid) = drd_tid; in DRD_()
784 thread_compute_conflict_set(&DRD_(g_conflict_set), drd_tid); in DRD_()
789 tl_assert(DRD_(g_drd_running_tid) != DRD_INVALID_THREADID); in DRD_()
796 int DRD_(thread_enter_synchr)(const DrdThreadId tid) in DRD_() function
798 tl_assert(DRD_(IsValidDrdThreadId)(tid)); in DRD_()
799 return DRD_(g_threadinfo)[tid].synchr_nesting++; in DRD_()
806 int DRD_(thread_leave_synchr)(const DrdThreadId tid) in DRD_() function
808 tl_assert(DRD_(IsValidDrdThreadId)(tid)); in DRD_()
809 tl_assert(DRD_(g_threadinfo)[tid].synchr_nesting >= 1); in DRD_()
810 return --DRD_(g_threadinfo)[tid].synchr_nesting; in DRD_()
814 int DRD_(thread_get_synchr_nesting_count)(const DrdThreadId tid) in DRD_() function
816 tl_assert(DRD_(IsValidDrdThreadId)(tid)); in DRD_()
817 return DRD_(g_threadinfo)[tid].synchr_nesting; in DRD_()
828 tl_assert(DRD_(sane_ThreadInfo)(&DRD_(g_threadinfo)[tid])); in thread_append_segment()
832 sg->thr_prev = DRD_(g_threadinfo)[tid].sg_last; in thread_append_segment()
834 if (DRD_(g_threadinfo)[tid].sg_last) in thread_append_segment()
835 DRD_(g_threadinfo)[tid].sg_last->thr_next = sg; in thread_append_segment()
836 DRD_(g_threadinfo)[tid].sg_last = sg; in thread_append_segment()
837 if (DRD_(g_threadinfo)[tid].sg_first == NULL) in thread_append_segment()
838 DRD_(g_threadinfo)[tid].sg_first = sg; in thread_append_segment()
841 tl_assert(DRD_(sane_ThreadInfo)(&DRD_(g_threadinfo)[tid])); in thread_append_segment()
856 tl_assert(DRD_(sane_ThreadInfo)(&DRD_(g_threadinfo)[tid])); in thread_discard_segment()
863 if (sg == DRD_(g_threadinfo)[tid].sg_first) in thread_discard_segment()
864 DRD_(g_threadinfo)[tid].sg_first = sg->thr_next; in thread_discard_segment()
865 if (sg == DRD_(g_threadinfo)[tid].sg_last) in thread_discard_segment()
866 DRD_(g_threadinfo)[tid].sg_last = sg->thr_prev; in thread_discard_segment()
867 DRD_(sg_put)(sg); in thread_discard_segment()
870 tl_assert(DRD_(sane_ThreadInfo)(&DRD_(g_threadinfo)[tid])); in thread_discard_segment()
878 VectorClock* DRD_(thread_get_vc)(const DrdThreadId tid) in DRD_() function
884 latest_sg = DRD_(g_threadinfo)[tid].sg_last; in DRD_()
892 void DRD_(thread_get_latest_segment)(Segment** sg, const DrdThreadId tid) in DRD_() function
899 latest_sg = DRD_(g_threadinfo)[tid].sg_last; in DRD_()
902 DRD_(sg_put)(*sg); in DRD_()
903 *sg = DRD_(sg_get)(latest_sg); in DRD_()
912 static void DRD_(thread_compute_minimum_vc)(VectorClock* vc) in DRD_() function
921 latest_sg = DRD_(g_threadinfo)[i].sg_last; in DRD_()
924 DRD_(vc_assign)(vc, &latest_sg->vc); in DRD_()
926 DRD_(vc_min)(vc, &latest_sg->vc); in DRD_()
937 static void DRD_(thread_compute_maximum_vc)(VectorClock* vc) in DRD_() function
946 latest_sg = DRD_(g_threadinfo)[i].sg_last; in DRD_()
949 DRD_(vc_assign)(vc, &latest_sg->vc); in DRD_()
951 DRD_(vc_combine)(vc, &latest_sg->vc); in DRD_()
969 DRD_(vc_init)(&thread_vc_min, 0, 0); in thread_discard_ordered_segments()
970 DRD_(thread_compute_minimum_vc)(&thread_vc_min); in thread_discard_ordered_segments()
971 if (DRD_(sg_get_trace)()) in thread_discard_ordered_segments()
976 DRD_(vc_init)(&thread_vc_max, 0, 0); in thread_discard_ordered_segments()
977 DRD_(thread_compute_maximum_vc)(&thread_vc_max); in thread_discard_ordered_segments()
978 vc_min = DRD_(vc_aprint)(&thread_vc_min); in thread_discard_ordered_segments()
979 vc_max = DRD_(vc_aprint)(&thread_vc_max); in thread_discard_ordered_segments()
985 DRD_(vc_cleanup)(&thread_vc_max); in thread_discard_ordered_segments()
992 for (sg = DRD_(g_threadinfo)[i].sg_first; in thread_discard_ordered_segments()
994 && DRD_(vc_lte)(&sg->vc, &thread_vc_min); in thread_discard_ordered_segments()
1000 DRD_(vc_cleanup)(&thread_vc_min); in thread_discard_ordered_segments()
1041 tl_assert(DRD_(vc_lte)(&sg1->vc, &sg2->vc)); in thread_consistent_segment_ordering()
1047 for (sg = DRD_(g_threadinfo)[i].sg_first; sg; sg = sg->thr_next) { in thread_consistent_segment_ordering()
1048 if (!sg->thr_next || DRD_(sg_get_refcnt)(sg) > 1) { in thread_consistent_segment_ordering()
1049 if (DRD_(vc_lte)(&sg2->vc, &sg->vc)) in thread_consistent_segment_ordering()
1051 if (DRD_(vc_lte)(&sg1->vc, &sg->vc)) in thread_consistent_segment_ordering()
1055 for (sg = DRD_(g_threadinfo)[i].sg_last; sg; sg = sg->thr_prev) { in thread_consistent_segment_ordering()
1056 if (!sg->thr_next || DRD_(sg_get_refcnt)(sg) > 1) { in thread_consistent_segment_ordering()
1057 if (DRD_(vc_lte)(&sg->vc, &sg1->vc)) in thread_consistent_segment_ordering()
1059 if (DRD_(vc_lte)(&sg->vc, &sg2->vc)) in thread_consistent_segment_ordering()
1097 tl_assert(DRD_(sane_ThreadInfo)(&DRD_(g_threadinfo)[i])); in thread_merge_segments()
1100 for (sg = DRD_(g_threadinfo)[i].sg_first; sg; sg = sg->thr_next) { in thread_merge_segments()
1101 if (DRD_(sg_get_refcnt)(sg) == 1 && sg->thr_next) { in thread_merge_segments()
1103 if (DRD_(sg_get_refcnt)(sg_next) == 1 in thread_merge_segments()
1108 DRD_(sg_merge)(sg, sg_next); in thread_merge_segments()
1115 tl_assert(DRD_(sane_ThreadInfo)(&DRD_(g_threadinfo)[i])); in thread_merge_segments()
1124 void DRD_(thread_new_segment)(const DrdThreadId tid) in DRD_() function
1131 tl_assert(thread_conflict_set_up_to_date(DRD_(g_drd_running_tid))); in DRD_()
1133 last_sg = DRD_(g_threadinfo)[tid].sg_last; in DRD_()
1134 new_sg = DRD_(sg_new)(tid, tid); in DRD_()
1136 if (tid == DRD_(g_drd_running_tid) && last_sg) in DRD_()
1138 DRD_(thread_update_conflict_set)(tid, &last_sg->vc); in DRD_()
1142 tl_assert(thread_conflict_set_up_to_date(DRD_(g_drd_running_tid))); in DRD_()
1153 void DRD_(thread_combine_vc_join)(DrdThreadId joiner, DrdThreadId joinee) in DRD_() function
1160 tl_assert(DRD_(g_threadinfo)[joiner].sg_first); in DRD_()
1161 tl_assert(DRD_(g_threadinfo)[joiner].sg_last); in DRD_()
1162 tl_assert(DRD_(g_threadinfo)[joinee].sg_first); in DRD_()
1163 tl_assert(DRD_(g_threadinfo)[joinee].sg_last); in DRD_()
1165 if (DRD_(sg_get_trace)()) in DRD_()
1168 str1 = DRD_(vc_aprint)(DRD_(thread_get_vc)(joiner)); in DRD_()
1169 str2 = DRD_(vc_aprint)(DRD_(thread_get_vc)(joinee)); in DRD_()
1175 if (joiner == DRD_(g_drd_running_tid)) { in DRD_()
1178 DRD_(vc_copy)(&old_vc, DRD_(thread_get_vc)(joiner)); in DRD_()
1179 DRD_(vc_combine)(DRD_(thread_get_vc)(joiner), in DRD_()
1180 DRD_(thread_get_vc)(joinee)); in DRD_()
1181 DRD_(thread_update_conflict_set)(joiner, &old_vc); in DRD_()
1183 DRD_(vc_cleanup)(&old_vc); in DRD_()
1185 DRD_(vc_combine)(DRD_(thread_get_vc)(joiner), in DRD_()
1186 DRD_(thread_get_vc)(joinee)); in DRD_()
1191 if (DRD_(sg_get_trace)()) { in DRD_()
1194 str = DRD_(vc_aprint)(DRD_(thread_get_vc)(joiner)); in DRD_()
1210 tl_assert(DRD_(g_threadinfo)[tid].sg_first); in thread_combine_vc_sync()
1211 tl_assert(DRD_(g_threadinfo)[tid].sg_last); in thread_combine_vc_sync()
1218 DRD_(vc_copy)(&old_vc, DRD_(thread_get_vc)(tid)); in thread_combine_vc_sync()
1219 DRD_(vc_combine)(DRD_(thread_get_vc)(tid), vc); in thread_combine_vc_sync()
1220 if (DRD_(sg_get_trace)()) { in thread_combine_vc_sync()
1222 str1 = DRD_(vc_aprint)(&old_vc); in thread_combine_vc_sync()
1223 str2 = DRD_(vc_aprint)(DRD_(thread_get_vc)(tid)); in thread_combine_vc_sync()
1231 DRD_(thread_update_conflict_set)(tid, &old_vc); in thread_combine_vc_sync()
1234 DRD_(vc_cleanup)(&old_vc); in thread_combine_vc_sync()
1236 tl_assert(DRD_(vc_lte)(vc, DRD_(thread_get_vc)(tid))); in thread_combine_vc_sync()
1246 void DRD_(thread_new_segment_and_combine_vc)(DrdThreadId tid, const Segment* sg) in DRD_() function
1250 tl_assert(thread_conflict_set_up_to_date(DRD_(g_drd_running_tid))); in DRD_()
1253 thread_append_segment(tid, DRD_(sg_new)(tid, tid)); in DRD_()
1270 void DRD_(thread_stop_using_mem)(const Addr a1, const Addr a2) in DRD_() function
1274 for (p = DRD_(g_sg_list); p; p = p->g_next) in DRD_()
1275 DRD_(bm_clear)(DRD_(sg_bm)(p), a1, a2); in DRD_()
1277 DRD_(bm_clear)(DRD_(g_conflict_set), a1, a2); in DRD_()
1281 void DRD_(thread_set_record_loads)(const DrdThreadId tid, const Bool enabled) in DRD_() function
1287 DRD_(g_threadinfo)[tid].is_recording_loads = enabled; in DRD_()
1291 void DRD_(thread_set_record_stores)(const DrdThreadId tid, const Bool enabled) in DRD_() function
1297 DRD_(g_threadinfo)[tid].is_recording_stores = enabled; in DRD_()
1305 void DRD_(thread_print_all)(void) in DRD_() function
1312 p = DRD_(g_threadinfo)[i].sg_first; in DRD_()
1318 DRD_(g_threadinfo)[i].valid, in DRD_()
1319 DRD_(g_threadinfo)[i].vg_thread_exists, in DRD_()
1320 DRD_(g_threadinfo)[i].vg_threadid, in DRD_()
1321 DRD_(g_threadinfo)[i].posix_thread_exists, in DRD_()
1322 DRD_(g_threadinfo)[i].pt_threadid, in DRD_()
1323 DRD_(g_threadinfo)[i].detached_posix_thread); in DRD_()
1325 DRD_(sg_print)(p); in DRD_()
1333 const ThreadId vg_tid = DRD_(DrdThreadIdToVgThreadId)(tid); in show_call_stack()
1365 for (q = DRD_(g_threadinfo)[i].sg_last; q; q = q->thr_prev) { in thread_report_conflicting_segments_segment()
1372 if (DRD_(vc_lte)(&q->vc, &p->vc)) in thread_report_conflicting_segments_segment()
1374 if (!DRD_(vc_lte)(&p->vc, &q->vc)) { in thread_report_conflicting_segments_segment()
1375 if (DRD_(bm_has_conflict_with)(DRD_(sg_bm)(q), addr, addr + size, in thread_report_conflicting_segments_segment()
1404 void DRD_(thread_report_conflicting_segments)(const DrdThreadId tid, in DRD_() function
1414 for (p = DRD_(g_threadinfo)[tid].sg_first; p; p = p->thr_next) { in DRD_()
1415 if (DRD_(bm_has)(DRD_(sg_bm)(p), addr, addr + size, access_type)) in DRD_()
1430 if (!DRD_(verify_conflict_set)) in thread_conflict_set_up_to_date()
1434 result = DRD_(bm_equal)(DRD_(g_conflict_set), computed_conflict_set); in thread_conflict_set_up_to_date()
1438 DRD_(bm_print)(DRD_(g_conflict_set)); in thread_conflict_set_up_to_date()
1441 DRD_(bm_print)(computed_conflict_set); in thread_conflict_set_up_to_date()
1444 DRD_(bm_delete)(computed_conflict_set); in thread_conflict_set_up_to_date()
1460 tl_assert(tid == DRD_(g_drd_running_tid)); in thread_compute_conflict_set()
1464 -= DRD_(bm_get_bitmap_creation_count)(); in thread_compute_conflict_set()
1466 -= DRD_(bm_get_bitmap2_creation_count)(); in thread_compute_conflict_set()
1469 DRD_(bm_cleanup)(*conflict_set); in thread_compute_conflict_set()
1470 DRD_(bm_init)(*conflict_set); in thread_compute_conflict_set()
1472 *conflict_set = DRD_(bm_new)(); in thread_compute_conflict_set()
1478 str = DRD_(vc_aprint)(DRD_(thread_get_vc)(tid)); in thread_compute_conflict_set()
1485 p = DRD_(g_threadinfo)[tid].sg_last; in thread_compute_conflict_set()
1492 vc = DRD_(vc_aprint)(&p->vc); in thread_compute_conflict_set()
1499 if (j != tid && DRD_(IsValidDrdThreadId)(j)) { in thread_compute_conflict_set()
1502 for (q = DRD_(g_threadinfo)[j].sg_last; q; q = q->thr_prev) { in thread_compute_conflict_set()
1503 if (!DRD_(vc_lte)(&q->vc, &p->vc) in thread_compute_conflict_set()
1504 && !DRD_(vc_lte)(&p->vc, &q->vc)) { in thread_compute_conflict_set()
1508 str = DRD_(vc_aprint)(&q->vc); in thread_compute_conflict_set()
1514 DRD_(bm_merge2)(*conflict_set, DRD_(sg_bm)(q)); in thread_compute_conflict_set()
1519 str = DRD_(vc_aprint)(&q->vc); in thread_compute_conflict_set()
1532 += DRD_(bm_get_bitmap_creation_count)(); in thread_compute_conflict_set()
1534 += DRD_(bm_get_bitmap2_creation_count)(); in thread_compute_conflict_set()
1538 DRD_(bm_print)(*conflict_set); in thread_compute_conflict_set()
1548 void DRD_(thread_update_conflict_set)(const DrdThreadId tid, in DRD_() function
1558 tl_assert(tid == DRD_(g_drd_running_tid)); in DRD_()
1559 tl_assert(DRD_(g_conflict_set)); in DRD_()
1564 str = DRD_(vc_aprint)(DRD_(thread_get_vc)(tid)); in DRD_()
1571 new_vc = DRD_(thread_get_vc)(tid); in DRD_()
1572 tl_assert(DRD_(vc_lte)(old_vc, new_vc)); in DRD_()
1574 DRD_(bm_unmark)(DRD_(g_conflict_set)); in DRD_()
1580 if (j == tid || ! DRD_(IsValidDrdThreadId)(j)) in DRD_()
1583 for (q = DRD_(g_threadinfo)[j].sg_last; in DRD_()
1584 q && !DRD_(vc_lte)(&q->vc, new_vc); in DRD_()
1587 = !DRD_(vc_lte)(old_vc, &q->vc); in DRD_()
1589 = !DRD_(vc_lte)(new_vc, &q->vc); in DRD_()
1594 str = DRD_(vc_aprint)(&q->vc); in DRD_()
1603 DRD_(bm_mark)(DRD_(g_conflict_set), DRD_(sg_bm)(q)); in DRD_()
1606 for ( ; q && !DRD_(vc_lte)(&q->vc, old_vc); q = q->thr_prev) { in DRD_()
1608 = !DRD_(vc_lte)(old_vc, &q->vc); in DRD_()
1610 = !DRD_(vc_lte)(&q->vc, new_vc) in DRD_()
1611 && !DRD_(vc_lte)(new_vc, &q->vc); in DRD_()
1616 str = DRD_(vc_aprint)(&q->vc); in DRD_()
1625 DRD_(bm_mark)(DRD_(g_conflict_set), DRD_(sg_bm)(q)); in DRD_()
1629 DRD_(bm_clear_marked)(DRD_(g_conflict_set)); in DRD_()
1631 p = DRD_(g_threadinfo)[tid].sg_last; in DRD_()
1633 if (j != tid && DRD_(IsValidDrdThreadId)(j)) { in DRD_()
1635 for (q = DRD_(g_threadinfo)[j].sg_last; in DRD_()
1636 q && !DRD_(vc_lte)(&q->vc, &p->vc); in DRD_()
1638 if (!DRD_(vc_lte)(&p->vc, &q->vc)) in DRD_()
1639 DRD_(bm_merge2_marked)(DRD_(g_conflict_set), DRD_(sg_bm)(q)); in DRD_()
1644 DRD_(bm_remove_cleared_marked)(DRD_(g_conflict_set)); in DRD_()
1651 DRD_(bm_print)(DRD_(g_conflict_set)); in DRD_()
1655 tl_assert(thread_conflict_set_up_to_date(DRD_(g_drd_running_tid))); in DRD_()
1659 ULong DRD_(thread_get_context_switch_count)(void) in DRD_() function
1665 ULong DRD_(thread_get_discard_ordered_segments_count)(void) in DRD_() function
1671 ULong DRD_(thread_get_compute_conflict_set_count)() in DRD_() function
1677 ULong DRD_(thread_get_update_conflict_set_count)(void) in DRD_() function
1686 ULong DRD_(thread_get_update_conflict_set_new_sg_count)(void) in DRD_() function
1696 ULong DRD_(thread_get_update_conflict_set_sync_count)(void) in DRD_() function
1705 ULong DRD_(thread_get_update_conflict_set_join_count)(void) in DRD_() function
1714 ULong DRD_(thread_get_conflict_set_bitmap_creation_count)(void) in DRD_() function
1723 ULong DRD_(thread_get_conflict_set_bitmap2_creation_count)(void) in DRD_() function