diff --git a/link-grammar/disjunct-utils.h b/link-grammar/disjunct-utils.h index 9dceb149c..e1fd74333 100644 --- a/link-grammar/disjunct-utils.h +++ b/link-grammar/disjunct-utils.h @@ -22,7 +22,7 @@ #include "parse/histogram.h" // count_t // Can undefine VERIFY_MATCH_LIST when done debugging... -#define VERIFY_MATCH_LIST +// #define VERIFY_MATCH_LIST /* On a 64-bit machine, this struct should be exactly (6+2)*8=64 bytes long. * Lets try to keep it that way (for performance). */ diff --git a/link-grammar/parse/count.c b/link-grammar/parse/count.c index 1c636f672..3233cbe2a 100644 --- a/link-grammar/parse/count.c +++ b/link-grammar/parse/count.c @@ -779,8 +779,10 @@ static void lrcnt_cache_match_list(wordvecp lrcnt_cache, count_context_t *ctxt, } dassert(dcnt > 0, "No disjuncts to cache"); //if (dcnt == i-mlb) return NULL; +#ifdef VERIFY_MATCH_LIST lgdebug(+9, "MATCH_LIST %9d dir=%d mlb %zu cached %zu/%zu\n", get_match_list_element(mchxt, mlb)->match_id, dir, mlb, dcnt, i-mlb); +#endif match_list_cache *ml = pool_alloc_vec(ctxt->mlc_pool, dcnt + 1); if (ml == NULL) return; /* Cannot allocate cache array */ diff --git a/link-grammar/parse/fast-match.c b/link-grammar/parse/fast-match.c index a6e9d0e7f..e41cf32e0 100644 --- a/link-grammar/parse/fast-match.c +++ b/link-grammar/parse/fast-match.c @@ -595,14 +595,14 @@ form_match_list(fast_matcher_t *ctxt, int w, } #ifdef VERIFY_MATCH_LIST - static uint16_t id = 0; - uint16_t lid = ++id; /* A stable local copy, for multi-threading support. */ + static _Atomic(uint16_t) id = 0; + const uint16_t lid = ++id; /* A stable local copy, for multi-threading support. */ #else const uint16_t lid = 0; #endif lgdebug(+D_FAST_MATCHER, "MATCH_LIST %c%c %5d mlb %zu\n", - (mlcl == NULL) ? ' ' : 'L', (mlcr == NULL) ? ' ' : 'R', id, front); + (mlcl == NULL) ? ' ' : 'L', (mlcr == NULL) ? ' ' : 'R', lid, front); if (mlcr == NULL) { diff --git a/link-grammar/parse/fast-match.h b/link-grammar/parse/fast-match.h index 37618b5d8..01c6cfaa1 100644 --- a/link-grammar/parse/fast-match.h +++ b/link-grammar/parse/fast-match.h @@ -71,12 +71,14 @@ static inline Disjunct *get_match_list_element(fast_matcher_t *ctxt, size_t mli) static inline void pop_match_list(fast_matcher_t *ctxt, size_t match_list_last) { ctxt->match_list_end = match_list_last; +#ifdef VERIFY_MATCH_LIST if (verbosity_level(9)) { if (get_match_list_element(ctxt, match_list_last) != NULL) lgdebug(+9, "MATCH_LIST %9d pop\n", get_match_list_element(ctxt, match_list_last)->match_id); } +#endif } /**