OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-link-grammar commits / fac11ac

Undef VERIFY_MATCH_LIST
fac11ac24b33244f5a524f2b23cbc7c1165d7341
by Linas Vepštas <linasvepstas@gmail.com> · 2024-05-30T17:56:52.000Z

Changed files (4) +8 -4

link-grammar/disjunct-utils.h +1 -1
……@@ -22,7 +22,7 @@
2222#include "parse/histogram.h" // count_t
2323
2424// Can undefine VERIFY_MATCH_LIST when done debugging...
25#define VERIFY_MATCH_LIST
25// #define VERIFY_MATCH_LIST
2626
2727/* On a 64-bit machine, this struct should be exactly (6+2)*8=64 bytes long.
2828 * Lets try to keep it that way (for performance). */
link-grammar/parse/count.c +2 -0
……@@ -779,8 +779,10 @@ static void lrcnt_cache_match_list(wordvecp lrcnt_cache, count_context_t *ctxt,
779779 }
780780 dassert(dcnt > 0, "No disjuncts to cache");
781781 //if (dcnt == i-mlb) return NULL;
782#ifdef VERIFY_MATCH_LIST
782783 lgdebug(+9, "MATCH_LIST %9d dir=%d mlb %zu cached %zu/%zu\n",
783784 get_match_list_element(mchxt, mlb)->match_id, dir, mlb, dcnt, i-mlb);
785#endif
784786
785787 match_list_cache *ml = pool_alloc_vec(ctxt->mlc_pool, dcnt + 1);
786788 if (ml == NULL) return; /* Cannot allocate cache array */
link-grammar/parse/fast-match.c +3 -3
……@@ -595,14 +595,14 @@ form_match_list(fast_matcher_t *ctxt, int w,
595595 }
596596
597597#ifdef VERIFY_MATCH_LIST
598 static uint16_t id = 0;
599 uint16_t lid = ++id; /* A stable local copy, for multi-threading support. */
598 static _Atomic(uint16_t) id = 0;
599 const uint16_t lid = ++id; /* A stable local copy, for multi-threading support. */
600600#else
601601 const uint16_t lid = 0;
602602#endif
603603
604604 lgdebug(+D_FAST_MATCHER, "MATCH_LIST %c%c %5d mlb %zu\n",
605 (mlcl == NULL) ? ' ' : 'L', (mlcr == NULL) ? ' ' : 'R', id, front);
605 (mlcl == NULL) ? ' ' : 'L', (mlcr == NULL) ? ' ' : 'R', lid, front);
606606
607607 if (mlcr == NULL)
608608 {
link-grammar/parse/fast-match.h +2 -0
……@@ -71,12 +71,14 @@ static inline Disjunct *get_match_list_element(fast_matcher_t *ctxt, size_t mli)
7171static inline void pop_match_list(fast_matcher_t *ctxt, size_t match_list_last)
7272{
7373 ctxt->match_list_end = match_list_last;
74#ifdef VERIFY_MATCH_LIST
7475 if (verbosity_level(9))
7576 {
7677 if (get_match_list_element(ctxt, match_list_last) != NULL)
7778 lgdebug(+9, "MATCH_LIST %9d pop\n",
7879 get_match_list_element(ctxt, match_list_last)->match_id);
7980 }
81#endif
8082}
8183
8284/**