Skip to content

Commit

Permalink
Undef VERIFY_MATCH_LIST
Browse files Browse the repository at this point in the history
  • Loading branch information
linas committed May 30, 2024
1 parent 1317863 commit fac11ac
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion link-grammar/disjunct-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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). */
Expand Down
2 changes: 2 additions & 0 deletions link-grammar/parse/count.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
6 changes: 3 additions & 3 deletions link-grammar/parse/fast-match.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 2 additions & 0 deletions link-grammar/parse/fast-match.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

/**
Expand Down

0 comments on commit fac11ac

Please sign in to comment.