From: Julian Seward Date: Mon, 26 Jan 2009 15:13:44 +0000 (+0000) Subject: merge r9063 Helgrind: Initialise laog and laog__exposition (properly). X-Git-Tag: svn/VALGRIND_3_4_1~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3176b668cef5e20a6a37cea67395f5453c93e8b7;p=thirdparty%2Fvalgrind.git merge r9063 Helgrind: Initialise laog and laog__exposition (properly). git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_3_4_BRANCH@9076 --- diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c index cac940f7b9..51fa2f8e2d 100644 --- a/helgrind/hg_main.c +++ b/helgrind/hg_main.c @@ -2849,6 +2849,21 @@ static WordFM* laog_exposition = NULL; /* WordFM LAOGLinkExposition* NULL */ /* end EXPOSITION ONLY */ +__attribute__((noinline)) +static void laog__init ( void ) +{ + tl_assert(!laog); + tl_assert(!laog_exposition); + + laog = VG_(newFM)( HG_(zalloc), "hg.laog__init.1", + HG_(free), NULL/*unboxedcmp*/ ); + + laog_exposition = VG_(newFM)( HG_(zalloc), "hg.laog__init.2", HG_(free), + cmp_LAOGLinkExposition ); + tl_assert(laog); + tl_assert(laog_exposition); +} + static void laog__show ( Char* who ) { Word i, ws_size; UWord* ws_words; @@ -3015,8 +3030,8 @@ static void laog__sanity_check ( Char* who ) { UWord* ws_words; Lock* me; LAOGLinks* links; - if ( !laog ) - return; /* nothing much we can do */ + if (UNLIKELY(!laog || !laog_exposition)) + laog__init(); VG_(initIterFM)( laog ); me = NULL; links = NULL; @@ -3128,12 +3143,8 @@ static void laog__pre_thread_acquires_lock ( if (HG_(elemWS)( univ_lsets, thr->locksetA, (Word)lk )) return; - if (!laog) - laog = VG_(newFM)( HG_(zalloc), "hg.lptal.1", - HG_(free), NULL/*unboxedcmp*/ ); - if (!laog_exposition) - laog_exposition = VG_(newFM)( HG_(zalloc), "hg.lptal.2", HG_(free), - cmp_LAOGLinkExposition ); + if (UNLIKELY(!laog || !laog_exposition)) + laog__init(); /* First, the check. Complain if there is any path in laog from lk to any of the locks already held by thr, since if any such path @@ -3206,6 +3217,9 @@ static void laog__handle_one_lock_deletion ( Lock* lk ) Word preds_size, succs_size, i, j; UWord *preds_words, *succs_words; + if (UNLIKELY(!laog || !laog_exposition)) + laog__init(); + preds = laog__preds( lk ); succs = laog__succs( lk ); @@ -3237,11 +3251,8 @@ static void laog__handle_one_lock_deletion ( Lock* lk ) // Word i, ws_size; // UWord* ws_words; // -// if (!laog) -// laog = VG_(newFM)( HG_(zalloc), "hg.lhld.1", HG_(free), NULL/*unboxedcmp*/ ); -// if (!laog_exposition) -// laog_exposition = VG_(newFM)( HG_(zalloc), "hg.lhld.2", HG_(free), -// cmp_LAOGLinkExposition ); +// if (UNLIKELY(!laog || !laog_exposition)) +// laog__init(); // // HG_(getPayloadWS)( &ws_words, &ws_size, univ_lsets, locksToDelete ); // for (i = 0; i < ws_size; i++)