]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Minor cleanup (no functional change): rename 'struct _Thr :: opaque'
authorJulian Seward <jseward@acm.org>
Thu, 10 Mar 2011 15:14:37 +0000 (15:14 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 10 Mar 2011 15:14:37 +0000 (15:14 +0000)
to 'hgthread', since that's what it is really.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11619

helgrind/hg_errors.c
helgrind/hg_lock_n_thread.h
helgrind/hg_main.c
helgrind/libhb.h
helgrind/libhb_core.c

index 6bc9482cc8c01924b5a0852356e289173f714f1a..6076f475d7ed3c17d9705ba0293732b2aa009a69 100644 (file)
@@ -341,7 +341,7 @@ UInt HG_(update_extra) ( Error* err )
             Thread* threadp;
             tl_assert(wherep);
             tl_assert(thrp);
-            threadp = libhb_get_Thr_opaque( thrp );
+            threadp = libhb_get_Thr_hgthread( thrp );
             tl_assert(threadp);
             xe->XE.Race.h2_ct_accEC  = wherep;
             xe->XE.Race.h2_ct        = threadp;
index 78948fe11206989bfddabbe0808d1e5d01ae1498..e109b551eb6e371c72e445b391b6c8e84743051e 100644 (file)
@@ -83,8 +83,8 @@ typedef
       /* ADMIN */
       struct _Thread* admin;
       UInt            magic;
-      Thr*            hbthr;
-      ThreadId        coretid;
+      Thr*            hbthr; /* which in turn points back here .. */
+      ThreadId        coretid;  /* .. via its hgthread field */
       /* USEFUL */
       WordSetID locksetA; /* WordSet of Lock* currently held by thread */
       WordSetID locksetW; /* subset of locksetA held in w-mode */
index e2e4a981ce4565eb18347ceb168b560932c2733b..1b17f6f9ef0ceea793d5ee570e3a677bc5f6c47e 100644 (file)
@@ -590,8 +590,8 @@ static void initialise_data_structures ( Thr* hbthr_root )
    thr = mk_Thread(hbthr_root);
    thr->coretid = 1; /* FIXME: hardwires an assumption about the
                         identity of the root thread. */
-   tl_assert( libhb_get_Thr_opaque(hbthr_root) == NULL );
-   libhb_set_Thr_opaque(hbthr_root, thr);
+   tl_assert( libhb_get_Thr_hgthread(hbthr_root) == NULL );
+   libhb_set_Thr_hgthread(hbthr_root, thr);
 
    /* and bind it in the thread-map table. */
    tl_assert(HG_(is_sane_ThreadId)(thr->coretid));
@@ -1620,15 +1620,15 @@ void evh__pre_thread_ll_create ( ThreadId parent, ThreadId child )
 
       hbthr_p = thr_p->hbthr;
       tl_assert(hbthr_p != NULL);
-      tl_assert( libhb_get_Thr_opaque(hbthr_p) == thr_p );
+      tl_assert( libhb_get_Thr_hgthread(hbthr_p) == thr_p );
 
       hbthr_c = libhb_create ( hbthr_p );
 
       /* Create a new thread record for the child. */
       /* a Thread for the new thread ... */
       thr_c = mk_Thread( hbthr_c );
-      tl_assert( libhb_get_Thr_opaque(hbthr_c) == NULL );
-      libhb_set_Thr_opaque(hbthr_c, thr_c);
+      tl_assert( libhb_get_Thr_hgthread(hbthr_c) == NULL );
+      libhb_set_Thr_hgthread(hbthr_c, thr_c);
 
       /* and bind it in the thread-map table */
       map_threads[child] = thr_c;
@@ -1765,8 +1765,8 @@ void evh__HG_PTHREAD_JOIN_POST ( ThreadId stay_tid, Thread* quit_thr )
    hbthr_s = thr_s->hbthr;
    hbthr_q = thr_q->hbthr;
    tl_assert(hbthr_s != hbthr_q);
-   tl_assert( libhb_get_Thr_opaque(hbthr_s) == thr_s );
-   tl_assert( libhb_get_Thr_opaque(hbthr_q) == thr_q );
+   tl_assert( libhb_get_Thr_hgthread(hbthr_s) == thr_s );
+   tl_assert( libhb_get_Thr_hgthread(hbthr_q) == thr_q );
 
    /* Allocate a temporary synchronisation object and use it to send
       an imaginary message from the quitter to the stayer, the purpose
@@ -4838,7 +4838,7 @@ void for_libhb__get_stacktrace ( Thr* hbt, Addr* frames, UWord nRequest )
    ThreadId    tid;
    UWord       nActual;
    tl_assert(hbt);
-   thr = libhb_get_Thr_opaque( hbt );
+   thr = libhb_get_Thr_hgthread( hbt );
    tl_assert(thr);
    tid = map_threads_maybe_reverse_lookup_SLOW(thr);
    nActual = (UWord)VG_(get_StackTrace)( tid, frames, (UInt)nRequest,
@@ -4855,7 +4855,7 @@ ExeContext* for_libhb__get_EC ( Thr* hbt )
    ThreadId    tid;
    ExeContext* ec;
    tl_assert(hbt);
-   thr = libhb_get_Thr_opaque( hbt );
+   thr = libhb_get_Thr_hgthread( hbt );
    tl_assert(thr);
    tid = map_threads_maybe_reverse_lookup_SLOW(thr);
    /* this will assert if tid is invalid */
index 8d88de63937ede8a165f2b7f69bf5ad3a302e726..39711b52e485309f8be925de02b4179364ef47f6 100644 (file)
@@ -129,10 +129,10 @@ void libhb_srange_new      ( Thr*, Addr, SizeT );
 void libhb_srange_noaccess ( Thr*, Addr, SizeT ); /* IS IGNORED */
 void libhb_srange_untrack  ( Thr*, Addr, SizeT );
 
-/* For the convenience of callers, we offer to store one void* item in
-   a Thr, which we ignore, but the caller can get or set any time. */
-void* libhb_get_Thr_opaque ( Thr* );
-void  libhb_set_Thr_opaque ( Thr*, void* );
+/* Get and set the hgthread (pointer to corresponding Thread
+   structure). */
+void* libhb_get_Thr_hgthread ( Thr* );
+void  libhb_set_Thr_hgthread ( Thr*, void* );
 
 /* Low level copy of shadow state from [src,src+len) to [dst,dst+len).
    Overlapping moves are checked for and asserted against. */
index 2e878ebf400463d82034b3334150b248739d4f54..05fda56a3e4b966d96c710e293ef5feec3587dc9 100644 (file)
@@ -3060,8 +3060,11 @@ struct _Thr {
       race. */
    Filter* filter;
 
-   /* opaque (to us) data we hold on behalf of the library's user. */
-   void* opaque;
+   /* A pointer back to the top level Thread structure.  There is a
+      1-1 mapping between Thread and Thr structures -- each Thr points
+      at its corresponding Thread, and vice versa.  Really, Thr and
+      Thread should be merged into a single structure. */
+   Thread* hgthread;
 
    /* The ULongs (scalar Kws) in this accumulate in strictly
       increasing order, without duplicates.  This is important because
@@ -4359,7 +4362,8 @@ static void record_race_info ( Thr* acc_thr,
    Thread*     hist1_conf_thr  = NULL;
 
    tl_assert(acc_thr);
-   tl_assert(acc_thr->opaque);
+   tl_assert(acc_thr->hgthread);
+   tl_assert(acc_thr->hgthread->hbthr == acc_thr);
    tl_assert(HG_(clo_history_level) >= 0 && HG_(clo_history_level) <= 2);
 
    if (HG_(clo_history_level) == 1) {
@@ -4443,11 +4447,11 @@ static void record_race_info ( Thr* acc_thr,
          // seg_start could be NULL iff this is the first stack in the thread
          //if (seg_start) VG_(pp_ExeContext)(seg_start);
          //if (seg_end)   VG_(pp_ExeContext)(seg_end);
-         hist1_conf_thr = confThr->opaque;
+         hist1_conf_thr = confThr->hgthread;
       }
    }
 
-   HG_(record_error_Race)( acc_thr->opaque, acc_addr,
+   HG_(record_error_Race)( acc_thr->hgthread, acc_addr,
                            szB, isWrite,
                            hist1_conf_thr, hist1_seg_start, hist1_seg_end );
 }
@@ -5976,14 +5980,14 @@ void libhb_srange_untrack ( Thr* thr, Addr a, SizeT szB )
    if (0 && TRACEME(a,szB)) trace(thr,a,szB,"untrack-after ");
 }
 
-void* libhb_get_Thr_opaque ( Thr* thr ) {
+void* libhb_get_Thr_hgthread ( Thr* thr ) {
    tl_assert(thr);
-   return thr->opaque;
+   return thr->hgthread;
 }
 
-void libhb_set_Thr_opaque ( Thr* thr, void* v ) {
+void libhb_set_Thr_hgthread ( Thr* thr, void* v ) {
    tl_assert(thr);
-   thr->opaque = v;
+   thr->hgthread = v;
 }
 
 void libhb_copy_shadow_state ( Thr* thr, Addr src, Addr dst, SizeT len )