diff --git a/src/maat_compile.c b/src/maat_compile.c index 203785f..db2c1d0 100644 --- a/src/maat_compile.c +++ b/src/maat_compile.c @@ -1867,19 +1867,19 @@ int maat_compile_state_update(struct rcu_hash_table *item_htable, int vtable_id, void *compile_rt = table_manager_get_runtime(state->maat_instance->tbl_mgr, compile_table_id); assert(compile_rt != NULL); - for (size_t i = 0; i < hit_group_cnt; i++) { - long long top_group_ids[MAX_SCANNER_HIT_GROUP_NUM]; - memset(top_group_ids, 0, sizeof(top_group_ids)); - int top_group_cnt = group2group_runtime_get_top_groups(g2g_rt, &hit_group_ids[i], - 1, top_group_ids); - if (top_group_cnt >= MAX_SCANNER_HIT_GROUP_NUM) { - top_group_cnt = MAX_SCANNER_HIT_GROUP_NUM; - } - for (int j = 0; j < top_group_cnt; j++) { - maat_compile_state_update_hit_clause(state->compile_state, compile_rt, - top_group_ids[j], vtable_id); - } + long long top_group_ids[MAX_SCANNER_HIT_GROUP_NUM]; + memset(top_group_ids, -1, sizeof(top_group_ids)); + int top_group_cnt = group2group_runtime_get_top_groups(g2g_rt, hit_group_ids, + hit_group_cnt, + top_group_ids); + if (top_group_cnt >= MAX_SCANNER_HIT_GROUP_NUM) { + top_group_cnt = MAX_SCANNER_HIT_GROUP_NUM; + } + + for (int j = 0; j < top_group_cnt; j++) { + maat_compile_state_update_hit_clause(state->compile_state, compile_rt, + top_group_ids[j], vtable_id); } return 0; diff --git a/src/maat_group.c b/src/maat_group.c index 705cd83..adee629 100644 --- a/src/maat_group.c +++ b/src/maat_group.c @@ -498,9 +498,9 @@ int group2group_runtime_build_top_groups(void *g2g_runtime) struct maat_group *group = NULL, *tmp = NULL; struct maat_group *super_group = NULL; - int tmp_vid=0; - size_t top_group_cnt=0; - int *temp_group_ids=NULL; + int tmp_vid = 0; + size_t top_group_cnt = 0; + long long *temp_group_ids = NULL; struct group2group_runtime *g2g_rt = (struct group2group_runtime *)g2g_runtime; pthread_rwlock_wrlock(&(g2g_rt->rwlock)); @@ -538,14 +538,14 @@ int group2group_runtime_build_top_groups(void *g2g_runtime) if (0 == group->ref_by_super_group_cnt) { //fast path, group is only referenced by compile rules. top_group_cnt = 1; - temp_group_ids = ALLOC(int, top_group_cnt); + temp_group_ids = ALLOC(long long, top_group_cnt); temp_group_ids[0] = group->group_id; } else { igraph_vector_t *vids = &(group_topo->dfs_vids); igraph_dfs(&group_topo->group_graph, group->vertex_id, IGRAPH_OUT, 0, vids, NULL, NULL, NULL, NULL, NULL, NULL); - temp_group_ids = ALLOC(int, effective_vertices_count(vids)); + temp_group_ids = ALLOC(long long, effective_vertices_count(vids)); for (size_t i = 0; i < (size_t)igraph_vector_size(vids); i++) { tmp_vid = (int) VECTOR(*vids)[i]; diff --git a/src/maat_table.c b/src/maat_table.c index 135c7e1..36e4f54 100644 --- a/src/maat_table.c +++ b/src/maat_table.c @@ -587,14 +587,13 @@ int table_manager_runtime_create(struct table_manager *tbl_mgr, int max_thread_n table_type = table_manager_get_table_type(tbl_mgr, i); void *runtime = table_manager_get_runtime(tbl_mgr, i); + tbl_mgr->tbl[i]->runtime = maat_table_runtime_new(schema, table_type, max_thread_num, + garbage_bin, tbl_mgr->logger); if (runtime != NULL) { enum table_type *arg = ALLOC(enum table_type, 1); *arg = table_type; maat_garbage_bagging(garbage_bin, runtime, arg, garbage_maat_table_runtime_free); } - - tbl_mgr->tbl[i]->runtime = maat_table_runtime_new(schema, table_type, max_thread_num, - garbage_bin, tbl_mgr->logger); } /* group2compile runtime depends on associated compile runtime, diff --git a/test/maat_framework_gtest.cpp b/test/maat_framework_gtest.cpp index ac232e3..a05a71f 100644 --- a/test/maat_framework_gtest.cpp +++ b/test/maat_framework_gtest.cpp @@ -2780,7 +2780,7 @@ TEST_F(Policy, CompileEXData) { maat_state_free(state); state = NULL; } -#if 0 + TEST_F(Policy, SubGroup) { long long results[ARRAY_SIZE] = {0}; size_t n_hit_result = 0; @@ -2811,7 +2811,7 @@ TEST_F(Policy, SubGroup) { maat_state_free(state); } -#endif + TEST_F(Policy, EvaluationOrder) { const char *url = "cavemancircus.com/2019/12/27/pretty-girls-6/"; long long results[ARRAY_SIZE] = {0};