Minor cleanup (no functional change): rename 'struct _Thr :: opaque'

to 'hgthread', since that's what it is really.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11619
This commit is contained in:
Julian Seward 2011-03-10 15:14:37 +00:00
parent c9ed16792f
commit f4b08e78ed
5 changed files with 29 additions and 25 deletions

View 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;

View 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 */

View 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 */

View 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. */

View 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 )