Inlined thread_conflicting_access(). Changed thread_get_danger_set() and thread_get_segment() from extern to inline.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7673 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/exp-drd/drd_main.c b/exp-drd/drd_main.c
index 7ad153d..8ad045f 100644
--- a/exp-drd/drd_main.c
+++ b/exp-drd/drd_main.c
@@ -181,7 +181,8 @@
 #endif
    sg = thread_get_segment(thread_get_running_tid());
    bm_access_range(sg->bm, addr, size, eLoad);
-   if (thread_conflicting_access(addr, size, eLoad))
+   if (bm_has_conflict_with(thread_get_danger_set(), addr, addr + size, eLoad)
+       && ! drd_is_suppressed(addr, addr + size))
    {
       DataRaceErrInfo drei;
       drei.tid  = VG_(get_running_tid)();
@@ -230,7 +231,8 @@
 #endif
    sg = thread_get_segment(thread_get_running_tid());
    bm_access_range(sg->bm, addr, size, eStore);
-   if (thread_conflicting_access(addr, size, eStore))
+   if (bm_has_conflict_with(thread_get_danger_set(), addr, addr + size, eStore)
+       && ! drd_is_suppressed(addr, addr + size))
    {
       DataRaceErrInfo drei;
       drei.tid  = VG_(get_running_tid)();
diff --git a/exp-drd/drd_thread.c b/exp-drd/drd_thread.c
index c5e95d1..19a8fcc 100644
--- a/exp-drd/drd_thread.c
+++ b/exp-drd/drd_thread.c
@@ -55,7 +55,7 @@
 static ThreadId    s_vg_running_tid  = VG_INVALID_THREADID;
 DrdThreadId s_drd_running_tid = DRD_INVALID_THREADID;
 ThreadInfo s_threadinfo[DRD_N_THREADS];
-static struct bitmap* s_danger_set;
+struct bitmap* s_danger_set;
 static Bool s_trace_context_switches = False;
 static Bool s_trace_danger_set = False;
 
@@ -465,24 +465,7 @@
    return s_threadinfo[tid].synchr_nesting;
 }
 
-/**
- * Return a pointer to the latest segment for the specified thread.
- */
-Segment* thread_get_segment(const DrdThreadId tid)
-{
-   tl_assert(0 <= tid && tid < DRD_N_THREADS
-             && tid != DRD_INVALID_THREADID);
-   if (s_threadinfo[tid].last == 0)
-   {
-      VG_(message)(Vg_DebugMsg, "threadid = %d", tid);
-      thread_print_all();
-   }
-   tl_assert(s_threadinfo[tid].last);
-   return s_threadinfo[tid].last;
-}
-
-/** Append a new segment at the end of the segment list.
- */
+/** Append a new segment at the end of the segment list. */
 static void thread_append_segment(const DrdThreadId tid, Segment* const sg)
 {
    tl_assert(0 <= tid && tid < DRD_N_THREADS
@@ -968,15 +951,6 @@
    }
 }
 
-Bool thread_conflicting_access(const Addr a,
-                               const SizeT size,
-                               const BmAccessTypeT access_type)
-{
-   tl_assert(s_danger_set);
-   return (bm_has_conflict_with(s_danger_set, a, a + size, access_type)
-           && ! drd_is_suppressed(a, a + size));
-}
-
 ULong thread_get_context_switch_count(void)
 {
    return s_context_switch_count;
diff --git a/exp-drd/drd_thread.h b/exp-drd/drd_thread.h
index 550daaf..5c5aae0 100644
--- a/exp-drd/drd_thread.h
+++ b/exp-drd/drd_thread.h
@@ -56,26 +56,26 @@
 
 typedef struct
 {
-   Segment*  first;
-   Segment*  last;
-   ThreadId  vg_threadid;
-   PThreadId pt_threadid;
-   Addr      stack_min_min;
-   Addr      stack_min;
-   Addr      stack_startup;
-   Addr      stack_max;
-   char      name[32];
-   /// Indicates whether the Valgrind core knows about this thread.
-   Bool      vg_thread_exists;
-   /// Indicates whether there is an associated POSIX thread ID.
-   Bool      posix_thread_exists;
-   /// If true, indicates that there is a corresponding POSIX thread ID and
-   /// a corresponding OS thread that is detached.
-   Bool      detached_posix_thread;
-   /// Wether recording of memory accesses is active.
-   Bool      is_recording;
-   /// Nesting level of synchronization functions called by the client.
-   Int       synchr_nesting;
+  Segment*  first;
+  Segment*  last;
+  ThreadId  vg_threadid;
+  PThreadId pt_threadid;
+  Addr      stack_min_min;
+  Addr      stack_min;
+  Addr      stack_startup;
+  Addr      stack_max;
+  char      name[32];
+  /// Indicates whether the Valgrind core knows about this thread.
+  Bool      vg_thread_exists;
+  /// Indicates whether there is an associated POSIX thread ID.
+  Bool      posix_thread_exists;
+  /// If true, indicates that there is a corresponding POSIX thread ID and
+  /// a corresponding OS thread that is detached.
+  Bool      detached_posix_thread;
+  /// Wether recording of memory accesses is active.
+  Bool      is_recording;
+  /// Nesting level of synchronization functions called by the client.
+  Int       synchr_nesting;
 } ThreadInfo;
 
 
@@ -84,6 +84,7 @@
 
 extern DrdThreadId s_drd_running_tid;
 extern ThreadInfo s_threadinfo[DRD_N_THREADS];
+extern struct bitmap* s_danger_set;
 
 
 // Function declarations.
@@ -121,7 +122,6 @@
 int thread_enter_synchr(const DrdThreadId tid);
 int thread_leave_synchr(const DrdThreadId tid);
 int thread_get_synchr_nesting_count(const DrdThreadId tid);
-Segment* thread_get_segment(const DrdThreadId tid);
 void thread_new_segment(const DrdThreadId tid);
 VectorClock* thread_get_vc(const DrdThreadId tid);
 void thread_combine_vc(const DrdThreadId joiner, const DrdThreadId joinee);
@@ -134,9 +134,6 @@
 void thread_report_races_segment(const DrdThreadId tid,
                                  const Segment* const p);
 void thread_report_all_races(void);
-Bool thread_conflicting_access(Addr const a,
-                               SizeT const size,
-                               BmAccessTypeT access_type);
 void thread_report_conflicting_segments(const DrdThreadId tid,
                                         const Addr addr,
                                         const SizeT size,
@@ -149,13 +146,29 @@
 ULong thread_get_danger_set_bitmap2_creation_count(void);
 
 
+static
+inline struct bitmap* thread_get_danger_set(void)
+{
+  return s_danger_set;
+}
+
 static inline
 Bool running_thread_is_recording(void)
 {
-   tl_assert(0 <= s_drd_running_tid && s_drd_running_tid < DRD_N_THREADS
-             && s_drd_running_tid != DRD_INVALID_THREADID);
-   return (s_threadinfo[s_drd_running_tid].synchr_nesting == 0
-           && s_threadinfo[s_drd_running_tid].is_recording);
+  tl_assert(0 <= s_drd_running_tid && s_drd_running_tid < DRD_N_THREADS
+            && s_drd_running_tid != DRD_INVALID_THREADID);
+  return (s_threadinfo[s_drd_running_tid].synchr_nesting == 0
+          && s_threadinfo[s_drd_running_tid].is_recording);
+}
+
+/** Return a pointer to the latest segment for the specified thread. */
+static inline
+Segment* thread_get_segment(const DrdThreadId tid)
+{
+  tl_assert(0 <= tid && tid < DRD_N_THREADS
+            && tid != DRD_INVALID_THREADID);
+  tl_assert(s_threadinfo[tid].last);
+  return s_threadinfo[tid].last;
 }