Maat_hierarchy_region_compile按照用户传入的结果数量申请缓存,当bool mactcher返回的结果中包含之前命中过的compile时, 可能导致bool matcher未返回全部的命中结果。

This commit is contained in:
zhengchao
2021-04-13 19:20:41 +08:00
parent 0f6eccbb47
commit ac4b39e6f5
3 changed files with 22 additions and 40 deletions

View File

@@ -7,7 +7,7 @@
* All rights reserved
*
* Written by: LIU YANBING (liuyanbing@iie.ac.cn)
* Last modification: 2021-01-01
* Last modification: 2018-12-31
*
* This code is the exclusive and proprietary property of IIE-CAS and NELIST.
* Usage for direct or indirect commercial advantage is not allowed without
@@ -25,35 +25,27 @@ extern "C"
#endif
#define MAX_ITEMS_PER_BOOL_EXPR 8
/* not_flag=0表示布尔项item_id必须出现not_flag=1表示布尔项item_id不能出现 */
/*not_flag=0表示布尔项item_id必须出现not_flag=1表示布尔项item_id不能出现*/
struct bool_item
{
unsigned long long item_id;
unsigned char not_flag;
};
/* At least one item's not_flag should be 0. */
/*注意:不支持布尔项全“非”的情形*/
struct bool_expr
{
unsigned long long expr_id;
void * user_tag;
size_t item_num;
struct bool_item items[MAX_ITEMS_PER_BOOL_EXPR];
};
struct bool_expr_match
{
unsigned long long expr_id;
void * user_tag;
};
struct bool_matcher;
/* The elements in exprs array will be swapped to different indexes. */
/*注意本函数调用会交换bool_exprs中元素的位置*/
struct bool_matcher * bool_matcher_new(struct bool_expr * exprs, size_t expr_num, unsigned int max_thread_num, size_t * mem_size);
/* Returned results are sorted by expr_id in descending order. */
int bool_matcher_match(struct bool_matcher * matcher, unsigned int thread_id, const unsigned long long * item_ids, size_t item_num, struct bool_expr_match * results, size_t n_result);
int bool_matcher_match(struct bool_matcher * matcher, unsigned int thread_id, const unsigned long long * item_ids, size_t item_num, void ** result, size_t size);
void bool_matcher_free(struct bool_matcher * matcher);