fix excessive inlining
This commit is contained in:
parent
7be8130d05
commit
3977ceee60
@ -37,7 +37,7 @@ SO=@SO@
|
||||
CWD=$(PWD)
|
||||
#
|
||||
|
||||
OBJS=core_tries.o base_tries.o tries.o base_itries.o itries.o
|
||||
OBJS=core_tries.o base_tries.o base_dbtries.o tries.o base_itries.o itries.o
|
||||
SOBJS=tries.@SO@ itries.@SO@
|
||||
|
||||
#in some systems we just create a single object, in others we need to
|
||||
|
@ -210,10 +210,10 @@
|
||||
|
||||
static TrNode depth_reduction(TrEntry trie, TrNode depth_node, YAP_Int opt_level);
|
||||
static TrNode breadth_reduction(TrEntry trie, TrNode breadth_node, YAP_Int opt_level);
|
||||
inline int compare_label_nodes(TrData data1, TrData data2);
|
||||
inline void move_after(TrData data_source, TrData data_dest);
|
||||
inline void move_last_data_after(TrData moveto_data);
|
||||
inline void set_depth_breadth_reduction_current_data(TrData data);
|
||||
static inline int compare_label_nodes(TrData data1, TrData data2);
|
||||
static inline void move_after(TrData data_source, TrData data_dest);
|
||||
static inline void move_last_data_after(TrData moveto_data);
|
||||
static inline void set_depth_breadth_reduction_current_data(TrData data);
|
||||
|
||||
|
||||
/* -------------------------- */
|
||||
@ -227,7 +227,7 @@ static TrData CURRENT_DEPTH_BREADTH_DATA;
|
||||
/* API */
|
||||
/* -------------------------- */
|
||||
|
||||
inline
|
||||
|
||||
YAP_Term trie_depth_breadth(TrEntry trie, TrEntry db_trie, YAP_Int opt_level, YAP_Int start_counter, YAP_Int *end_counter) {
|
||||
TrNode depth_node, breadth_node, nested_trie;
|
||||
core_set_label_counter(start_counter);
|
||||
@ -257,32 +257,32 @@ YAP_Term trie_depth_breadth(TrEntry trie, TrEntry db_trie, YAP_Int opt_level, YA
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Int trie_get_db_opt_level_count(YAP_Int opt_level) {
|
||||
return core_db_trie_get_optimization_level_count(opt_level);
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrData trie_get_depth_breadth_reduction_current_data(void) {
|
||||
return CURRENT_DEPTH_BREADTH_DATA;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void trie_replace_nested_trie(TrEntry trie, YAP_Int nested_trie_id, YAP_Term new_term) {
|
||||
core_depth_breadth_trie_replace_nested_trie(TrNode_child(TrEntry_trie(trie)), nested_trie_id, new_term);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Int trie_get_db_opt_min_prefix(void) {
|
||||
return core_get_trie_db_opt_min_prefix();
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void trie_set_db_opt_min_prefix(YAP_Int min_prefix) {
|
||||
core_set_trie_db_opt_min_prefix(min_prefix);
|
||||
return;
|
||||
@ -294,7 +294,7 @@ void trie_set_db_opt_min_prefix(YAP_Int min_prefix) {
|
||||
/* -------------------------- */
|
||||
|
||||
|
||||
inline
|
||||
static inline
|
||||
void set_depth_breadth_reduction_current_data(TrData data) {
|
||||
CURRENT_DEPTH_BREADTH_DATA = data;
|
||||
return;
|
||||
@ -359,7 +359,7 @@ TrNode breadth_reduction(TrEntry trie, TrNode breadth_node, YAP_Int opt_level) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
static inline
|
||||
void move_last_data_after(TrData moveto_data) {
|
||||
TrEntry trie = CURRENT_TRIE;
|
||||
TrData last_data = TrEntry_last_data(trie);
|
||||
@ -378,7 +378,7 @@ void move_last_data_after(TrData moveto_data) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
static inline
|
||||
void move_after(TrData data_source, TrData data_dest) {
|
||||
TrEntry trie = CURRENT_TRIE;
|
||||
if (data_source == TrEntry_first_data(trie))
|
||||
@ -407,7 +407,6 @@ void move_after(TrData data_source, TrData data_dest) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void trie_data_order_correction(void) {
|
||||
TrEntry trie = CURRENT_TRIE;
|
||||
TrData inserted_data = TrEntry_last_data(trie);
|
||||
@ -434,7 +433,7 @@ void trie_data_order_correction(void) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
static inline
|
||||
int compare_label_nodes(TrData data1, TrData data2) {
|
||||
YAP_Term t1 = TrNode_entry(TrData_leaf(data1)), t2 = TrNode_entry(TrData_leaf(data2));
|
||||
YAP_Int i1 = atol(YAP_AtomName(YAP_AtomOfTerm(t1)) + 1), i2 = atol(YAP_AtomName(YAP_AtomOfTerm(t2)) + 1);
|
||||
|
@ -207,10 +207,10 @@
|
||||
/* API */
|
||||
/* --------------------------- */
|
||||
|
||||
inline YAP_Term trie_depth_breadth(TrEntry trie, TrEntry db_trie, YAP_Int opt_level, YAP_Int start_counter, YAP_Int *end_counter);
|
||||
inline void trie_data_order_correction(void);
|
||||
inline TrData trie_get_depth_breadth_reduction_current_data(void);
|
||||
inline YAP_Int trie_get_db_opt_level_count(YAP_Int opt_level);
|
||||
inline void trie_replace_nested_trie(TrEntry trie, YAP_Int nested_trie_id, YAP_Term new_term);
|
||||
inline YAP_Int trie_get_db_opt_min_prefix(void);
|
||||
inline void trie_set_db_opt_min_prefix(YAP_Int min_prefix);
|
||||
YAP_Term trie_depth_breadth(TrEntry trie, TrEntry db_trie, YAP_Int opt_level, YAP_Int start_counter, YAP_Int *end_counter);
|
||||
void trie_data_order_correction(void);
|
||||
TrData trie_get_depth_breadth_reduction_current_data(void);
|
||||
YAP_Int trie_get_db_opt_level_count(YAP_Int opt_level);
|
||||
void trie_replace_nested_trie(TrEntry trie, YAP_Int nested_trie_id, YAP_Term new_term);
|
||||
YAP_Int trie_get_db_opt_min_prefix(void);
|
||||
void trie_set_db_opt_min_prefix(YAP_Int min_prefix);
|
||||
|
@ -32,7 +32,7 @@ static TrEntry FIRST_ITRIE, CURRENT_ITRIE;
|
||||
/* API */
|
||||
/* -------------------------- */
|
||||
|
||||
inline
|
||||
|
||||
void itrie_init_module(void) {
|
||||
ITRIE_ENGINE = core_trie_init_module();
|
||||
FIRST_ITRIE = NULL;
|
||||
@ -40,7 +40,7 @@ void itrie_init_module(void) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_data_save(TrNode node, FILE *file) {
|
||||
TrData data;
|
||||
|
||||
@ -50,7 +50,7 @@ void itrie_data_save(TrNode node, FILE *file) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_data_load(TrNode node, YAP_Int depth, FILE *file) {
|
||||
TrData data;
|
||||
YAP_Int pos, neg, timestamp;
|
||||
@ -62,7 +62,7 @@ void itrie_data_load(TrNode node, YAP_Int depth, FILE *file) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_data_print(TrNode node) {
|
||||
TrData data;
|
||||
|
||||
@ -72,7 +72,7 @@ void itrie_data_print(TrNode node) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_data_copy(TrNode node_dest, TrNode node_source) {
|
||||
TrData data_dest, data_source;
|
||||
|
||||
@ -83,7 +83,7 @@ void itrie_data_copy(TrNode node_dest, TrNode node_source) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_data_destruct(TrNode node) {
|
||||
TrEntry itrie;
|
||||
TrData data;
|
||||
@ -102,7 +102,7 @@ void itrie_data_destruct(TrNode node) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_data_add(TrNode node_dest, TrNode node_source) {
|
||||
TrData data_dest, data_source;
|
||||
|
||||
@ -116,7 +116,7 @@ void itrie_data_add(TrNode node_dest, TrNode node_source) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_data_subtract(TrNode node_dest, TrNode node_source) {
|
||||
TrData data_dest, data_source;
|
||||
|
||||
@ -130,7 +130,7 @@ void itrie_data_subtract(TrNode node_dest, TrNode node_source) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrEntry itrie_open(void) {
|
||||
TrEntry itrie;
|
||||
TrNode node;
|
||||
@ -144,7 +144,7 @@ TrEntry itrie_open(void) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_close(TrEntry itrie) {
|
||||
core_trie_close(ITRIE_ENGINE, TrEntry_trie(itrie), &itrie_data_destruct);
|
||||
if (TrEntry_next(itrie)) {
|
||||
@ -157,7 +157,7 @@ void itrie_close(TrEntry itrie) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_close_all(void) {
|
||||
TrEntry itrie;
|
||||
|
||||
@ -171,33 +171,33 @@ void itrie_close_all(void) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_set_mode(TrEntry itrie, YAP_Int mode) {
|
||||
TrEntry_mode(itrie) = mode;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Int itrie_get_mode(TrEntry itrie) {
|
||||
return TrEntry_mode(itrie);
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_set_timestamp(TrEntry itrie, YAP_Int timestamp) {
|
||||
TrEntry_timestamp(itrie) = timestamp;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Int itrie_get_timestamp(TrEntry itrie) {
|
||||
return TrEntry_timestamp(itrie);
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_put_entry(TrEntry itrie, YAP_Term entry) {
|
||||
TrData data;
|
||||
TrNode node;
|
||||
@ -213,7 +213,7 @@ void itrie_put_entry(TrEntry itrie, YAP_Term entry) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_update_entry(TrEntry itrie, YAP_Term entry) {
|
||||
TrData data;
|
||||
TrNode node;
|
||||
@ -226,7 +226,7 @@ void itrie_update_entry(TrEntry itrie, YAP_Term entry) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrData itrie_check_entry(TrEntry itrie, YAP_Term entry) {
|
||||
TrNode node;
|
||||
|
||||
@ -236,13 +236,13 @@ TrData itrie_check_entry(TrEntry itrie, YAP_Term entry) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Term itrie_get_entry(TrData data) {
|
||||
return core_trie_get_entry(TrData_leaf(data));
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_get_data(TrData data, YAP_Int *pos, YAP_Int *neg, YAP_Int *timestamp) {
|
||||
*pos = TrData_pos(data);
|
||||
*neg = TrData_neg(data);
|
||||
@ -251,7 +251,7 @@ void itrie_get_data(TrData data, YAP_Int *pos, YAP_Int *neg, YAP_Int *timestamp)
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrData itrie_traverse_init(TrEntry itrie) {
|
||||
TrData data, *bucket;
|
||||
YAP_Int traverse_bucket = 0;
|
||||
@ -269,7 +269,7 @@ TrData itrie_traverse_init(TrEntry itrie) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrData itrie_traverse_cont(TrEntry itrie) {
|
||||
TrData data, *bucket;
|
||||
YAP_Int traverse_bucket;
|
||||
@ -294,35 +294,35 @@ TrData itrie_traverse_cont(TrEntry itrie) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_remove_entry(TrData data) {
|
||||
core_trie_remove_entry(ITRIE_ENGINE, TrData_leaf(data), &itrie_data_destruct);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_remove_subtree(TrData data) {
|
||||
core_trie_remove_subtree(ITRIE_ENGINE, TrData_leaf(data), &itrie_data_destruct);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_add(TrEntry itrie_dest, TrEntry itrie_source) {
|
||||
core_trie_add(TrEntry_trie(itrie_dest), TrEntry_trie(itrie_source), &itrie_data_add);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_subtract(TrEntry itrie_dest, TrEntry itrie_source) {
|
||||
core_trie_add(TrEntry_trie(itrie_dest), TrEntry_trie(itrie_source), &itrie_data_subtract);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_join(TrEntry itrie_dest, TrEntry itrie_source) {
|
||||
CURRENT_ITRIE = itrie_dest;
|
||||
core_trie_join(ITRIE_ENGINE, TrEntry_trie(itrie_dest), TrEntry_trie(itrie_source), &itrie_data_add, &itrie_data_copy);
|
||||
@ -330,40 +330,40 @@ void itrie_join(TrEntry itrie_dest, TrEntry itrie_source) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_intersect(TrEntry itrie_dest, TrEntry itrie_source) {
|
||||
core_trie_intersect(ITRIE_ENGINE, TrEntry_trie(itrie_dest), TrEntry_trie(itrie_source), &itrie_data_add, &itrie_data_destruct);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Int itrie_count_join(TrEntry itrie1, TrEntry itrie2) {
|
||||
return core_trie_count_join(TrEntry_trie(itrie1), TrEntry_trie(itrie2));
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Int itrie_count_intersect(TrEntry itrie1, TrEntry itrie2) {
|
||||
return core_trie_count_intersect(TrEntry_trie(itrie1), TrEntry_trie(itrie2));
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_save(TrEntry itrie, FILE *file) {
|
||||
core_trie_save(TrEntry_trie(itrie), file, &itrie_data_save);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_save_as_trie(TrEntry itrie, FILE *file) {
|
||||
core_trie_save(TrEntry_trie(itrie), file, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrEntry itrie_load(FILE *file) {
|
||||
TrEntry itrie;
|
||||
TrNode node;
|
||||
@ -382,28 +382,28 @@ TrEntry itrie_load(FILE *file) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes) {
|
||||
core_trie_stats(ITRIE_ENGINE, memory, tries, entries, nodes);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_max_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes) {
|
||||
core_trie_max_stats(ITRIE_ENGINE, memory, tries, entries, nodes);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_usage(TrEntry itrie, YAP_Int *entries, YAP_Int *nodes, YAP_Int *virtual_nodes) {
|
||||
core_trie_usage(TrEntry_trie(itrie), entries, nodes, virtual_nodes);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void itrie_print(TrEntry itrie) {
|
||||
core_trie_print(TrEntry_trie(itrie), &itrie_data_print);
|
||||
return;
|
||||
|
@ -168,40 +168,40 @@ typedef struct itrie_data {
|
||||
/* API */
|
||||
/* --------------------------- */
|
||||
|
||||
inline void itrie_init_module(void);
|
||||
inline void itrie_data_save(TrNode node, FILE *file);
|
||||
inline void itrie_data_load(TrNode node, YAP_Int depth, FILE *file);
|
||||
inline void itrie_data_print(TrNode node);
|
||||
inline void itrie_data_copy(TrNode node_dest, TrNode node_source);
|
||||
inline void itrie_data_destruct(TrNode node);
|
||||
inline void itrie_data_add(TrNode node_dest, TrNode node_source);
|
||||
inline void itrie_data_subtract(TrNode node_dest, TrNode node_source);
|
||||
inline TrEntry itrie_open(void);
|
||||
inline void itrie_close(TrEntry itrie);
|
||||
inline void itrie_close_all(void);
|
||||
inline void itrie_set_mode(TrEntry itrie, YAP_Int mode);
|
||||
inline YAP_Int itrie_get_mode(TrEntry itrie);
|
||||
inline void itrie_set_timestamp(TrEntry itrie, YAP_Int timestamp);
|
||||
inline YAP_Int itrie_get_timestamp(TrEntry itrie);
|
||||
inline void itrie_put_entry(TrEntry itrie, YAP_Term entry);
|
||||
inline void itrie_update_entry(TrEntry itrie, YAP_Term entry);
|
||||
inline TrData itrie_check_entry(TrEntry itrie, YAP_Term entry);
|
||||
inline YAP_Term itrie_get_entry(TrData data);
|
||||
inline void itrie_get_data(TrData data, YAP_Int *pos, YAP_Int *neg, YAP_Int *timestamp);
|
||||
inline TrData itrie_traverse_init(TrEntry itrie);
|
||||
inline TrData itrie_traverse_cont(TrEntry itrie);
|
||||
inline void itrie_remove_entry(TrData data);
|
||||
inline void itrie_remove_subtree(TrData data);
|
||||
inline void itrie_add(TrEntry itrie_dest, TrEntry itrie_source);
|
||||
inline void itrie_subtract(TrEntry itrie_dest, TrEntry itrie_source);
|
||||
inline void itrie_join(TrEntry itrie_dest, TrEntry itrie_source);
|
||||
inline void itrie_intersect(TrEntry itrie_dest, TrEntry itrie_source);
|
||||
inline YAP_Int itrie_count_join(TrEntry itrie1, TrEntry itrie2);
|
||||
inline YAP_Int itrie_count_intersect(TrEntry itrie1, TrEntry itrie2);
|
||||
inline void itrie_save(TrEntry itrie, FILE *file);
|
||||
inline void itrie_save_as_trie(TrEntry itrie, FILE *file);
|
||||
inline TrEntry itrie_load(FILE *file);
|
||||
inline void itrie_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
|
||||
inline void itrie_max_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
|
||||
inline void itrie_usage(TrEntry itrie, YAP_Int *entries, YAP_Int *nodes, YAP_Int *virtual_nodes);
|
||||
inline void itrie_print(TrEntry itrie);
|
||||
void itrie_init_module(void);
|
||||
void itrie_data_save(TrNode node, FILE *file);
|
||||
void itrie_data_load(TrNode node, YAP_Int depth, FILE *file);
|
||||
void itrie_data_print(TrNode node);
|
||||
void itrie_data_copy(TrNode node_dest, TrNode node_source);
|
||||
void itrie_data_destruct(TrNode node);
|
||||
void itrie_data_add(TrNode node_dest, TrNode node_source);
|
||||
void itrie_data_subtract(TrNode node_dest, TrNode node_source);
|
||||
TrEntry itrie_open(void);
|
||||
void itrie_close(TrEntry itrie);
|
||||
void itrie_close_all(void);
|
||||
void itrie_set_mode(TrEntry itrie, YAP_Int mode);
|
||||
YAP_Int itrie_get_mode(TrEntry itrie);
|
||||
void itrie_set_timestamp(TrEntry itrie, YAP_Int timestamp);
|
||||
YAP_Int itrie_get_timestamp(TrEntry itrie);
|
||||
void itrie_put_entry(TrEntry itrie, YAP_Term entry);
|
||||
void itrie_update_entry(TrEntry itrie, YAP_Term entry);
|
||||
TrData itrie_check_entry(TrEntry itrie, YAP_Term entry);
|
||||
YAP_Term itrie_get_entry(TrData data);
|
||||
void itrie_get_data(TrData data, YAP_Int *pos, YAP_Int *neg, YAP_Int *timestamp);
|
||||
TrData itrie_traverse_init(TrEntry itrie);
|
||||
TrData itrie_traverse_cont(TrEntry itrie);
|
||||
void itrie_remove_entry(TrData data);
|
||||
void itrie_remove_subtree(TrData data);
|
||||
void itrie_add(TrEntry itrie_dest, TrEntry itrie_source);
|
||||
void itrie_subtract(TrEntry itrie_dest, TrEntry itrie_source);
|
||||
void itrie_join(TrEntry itrie_dest, TrEntry itrie_source);
|
||||
void itrie_intersect(TrEntry itrie_dest, TrEntry itrie_source);
|
||||
YAP_Int itrie_count_join(TrEntry itrie1, TrEntry itrie2);
|
||||
YAP_Int itrie_count_intersect(TrEntry itrie1, TrEntry itrie2);
|
||||
void itrie_save(TrEntry itrie, FILE *file);
|
||||
void itrie_save_as_trie(TrEntry itrie, FILE *file);
|
||||
TrEntry itrie_load(FILE *file);
|
||||
void itrie_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
|
||||
void itrie_max_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
|
||||
void itrie_usage(TrEntry itrie, YAP_Int *entries, YAP_Int *nodes, YAP_Int *virtual_nodes);
|
||||
void itrie_print(TrEntry itrie);
|
||||
|
@ -39,7 +39,6 @@ static YAP_Int CURRENT_TRAVERSE_MODE;
|
||||
/* API */
|
||||
/* -------------------------- */
|
||||
|
||||
inline
|
||||
void trie_init_module(void) {
|
||||
TRIE_ENGINE = core_trie_init_module();
|
||||
FIRST_TRIE = NULL;
|
||||
@ -48,7 +47,7 @@ void trie_init_module(void) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void trie_data_load(TrNode node, YAP_Int depth, FILE *file) {
|
||||
TrData data;
|
||||
|
||||
@ -58,7 +57,7 @@ void trie_data_load(TrNode node, YAP_Int depth, FILE *file) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void trie_data_copy(TrNode node_dest, TrNode node_source) {
|
||||
TrData data_dest;
|
||||
|
||||
@ -68,7 +67,7 @@ void trie_data_copy(TrNode node_dest, TrNode node_source) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void trie_data_destruct(TrNode node) {
|
||||
TrEntry trie;
|
||||
TrData data;
|
||||
@ -89,7 +88,7 @@ void trie_data_destruct(TrNode node) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrEntry trie_open(void) {
|
||||
TrEntry trie;
|
||||
TrNode node;
|
||||
@ -103,7 +102,7 @@ TrEntry trie_open(void) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void trie_close(TrEntry trie) {
|
||||
core_trie_close(TRIE_ENGINE, TrEntry_trie(trie), &trie_data_destruct);
|
||||
if (TrEntry_next(trie)) {
|
||||
@ -116,7 +115,7 @@ void trie_close(TrEntry trie) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void trie_close_all(void) {
|
||||
TrEntry trie;
|
||||
|
||||
@ -130,20 +129,20 @@ void trie_close_all(void) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void trie_set_mode(YAP_Int mode) {
|
||||
core_trie_set_mode(mode);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Int trie_get_mode(void) {
|
||||
return core_trie_get_mode();
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrData trie_put_entry(TrEntry trie, YAP_Term entry) {
|
||||
TrData data;
|
||||
TrNode node;
|
||||
@ -157,7 +156,7 @@ TrData trie_put_entry(TrEntry trie, YAP_Term entry) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrData trie_check_entry(TrEntry trie, YAP_Term entry) {
|
||||
TrNode node;
|
||||
|
||||
@ -167,13 +166,13 @@ TrData trie_check_entry(TrEntry trie, YAP_Term entry) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Term trie_get_entry(TrData data) {
|
||||
return core_trie_get_entry(TrData_leaf(data));
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrData trie_get_first_entry(TrEntry trie) {
|
||||
TrData data;
|
||||
|
||||
@ -182,7 +181,7 @@ TrData trie_get_first_entry(TrEntry trie) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrData trie_get_last_entry(TrEntry trie) {
|
||||
TrData data;
|
||||
|
||||
@ -193,7 +192,7 @@ TrData trie_get_last_entry(TrEntry trie) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrData trie_traverse_init(TrEntry trie, TrData init_data) {
|
||||
TrData data;
|
||||
|
||||
@ -210,7 +209,7 @@ TrData trie_traverse_init(TrEntry trie, TrData init_data) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrData trie_traverse_cont(TrEntry trie) {
|
||||
TrData data;
|
||||
|
||||
@ -229,21 +228,21 @@ TrData trie_traverse_cont(TrEntry trie) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void trie_remove_entry(TrData data) {
|
||||
core_trie_remove_entry(TRIE_ENGINE, TrData_leaf(data), &trie_data_destruct);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void trie_remove_subtree(TrData data) {
|
||||
core_trie_remove_subtree(TRIE_ENGINE, TrData_leaf(data), &trie_data_destruct);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void trie_join(TrEntry trie_dest, TrEntry trie_source) {
|
||||
CURRENT_TRIE = trie_dest;
|
||||
core_trie_join(TRIE_ENGINE, TrEntry_trie(trie_dest), TrEntry_trie(trie_source), NULL, &trie_data_copy);
|
||||
@ -251,33 +250,33 @@ void trie_join(TrEntry trie_dest, TrEntry trie_source) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void trie_intersect(TrEntry trie_dest, TrEntry trie_source) {
|
||||
core_trie_intersect(TRIE_ENGINE, TrEntry_trie(trie_dest), TrEntry_trie(trie_source), NULL, &trie_data_destruct);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Int trie_count_join(TrEntry trie1, TrEntry trie2) {
|
||||
return core_trie_count_join(TrEntry_trie(trie1), TrEntry_trie(trie2));
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Int trie_count_intersect(TrEntry trie1, TrEntry trie2) {
|
||||
return core_trie_count_intersect(TrEntry_trie(trie1), TrEntry_trie(trie2));
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void trie_save(TrEntry trie, FILE *file) {
|
||||
core_trie_save(TrEntry_trie(trie), file, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrEntry trie_load(FILE *file) {
|
||||
TrEntry trie;
|
||||
TrNode node;
|
||||
@ -296,35 +295,34 @@ TrEntry trie_load(FILE *file) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void trie_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes) {
|
||||
core_trie_stats(TRIE_ENGINE, memory, tries, entries, nodes);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void trie_max_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes) {
|
||||
core_trie_max_stats(TRIE_ENGINE, memory, tries, entries, nodes);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void trie_usage(TrEntry trie, YAP_Int *entries, YAP_Int *nodes, YAP_Int *virtual_nodes) {
|
||||
core_trie_usage(TrEntry_trie(trie), entries, nodes, virtual_nodes);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void trie_print(TrEntry trie) {
|
||||
core_trie_print(TrEntry_trie(trie), NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void trie_data_construct(TrNode node) {
|
||||
TrData data;
|
||||
|
||||
@ -334,20 +332,20 @@ void trie_data_construct(TrNode node) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void trie_set_traverse_mode(YAP_Int mode) {
|
||||
CURRENT_TRAVERSE_MODE = mode;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Int trie_get_traverse_mode(void) {
|
||||
return CURRENT_TRAVERSE_MODE;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrData trie_traverse_first(TrEntry trie) {
|
||||
TrData data;
|
||||
if (CURRENT_TRAVERSE_MODE == TRAVERSE_MODE_FORWARD)
|
||||
@ -358,7 +356,7 @@ TrData trie_traverse_first(TrEntry trie) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrData trie_traverse_next(TrData cur) {
|
||||
TrData data = NULL;
|
||||
if (cur) {
|
||||
@ -374,14 +372,14 @@ TrData trie_traverse_next(TrData cur) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void trie_disable_hash_table(void) {
|
||||
core_disable_hash_table();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void trie_enable_hash_table(void) {
|
||||
core_enable_hash_table();
|
||||
return;
|
||||
@ -400,7 +398,7 @@ TrData get_data_from_trie_node(TrNode node) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Term trie_to_list(TrEntry trie) {
|
||||
return core_trie_to_list(TrEntry_trie(trie));
|
||||
}
|
||||
|
@ -106,43 +106,43 @@ typedef struct trie_data {
|
||||
/* API */
|
||||
/* --------------------------- */
|
||||
|
||||
inline void trie_init_module(void);
|
||||
inline void trie_data_load(TrNode node, YAP_Int depth, FILE *file);
|
||||
inline void trie_data_copy(TrNode node_dest, TrNode node_source);
|
||||
inline void trie_data_destruct(TrNode node);
|
||||
inline TrEntry trie_open(void);
|
||||
inline void trie_close(TrEntry trie);
|
||||
inline void trie_close_all(void);
|
||||
inline void trie_set_mode(YAP_Int mode);
|
||||
inline YAP_Int trie_get_mode(void);
|
||||
inline TrData trie_put_entry(TrEntry trie, YAP_Term entry);
|
||||
inline TrData trie_check_entry(TrEntry trie, YAP_Term entry);
|
||||
inline YAP_Term trie_get_entry(TrData data);
|
||||
inline TrData trie_get_first_entry(TrEntry trie);
|
||||
inline TrData trie_get_last_entry(TrEntry trie);
|
||||
inline TrData trie_traverse_init(TrEntry trie, TrData init_data);
|
||||
inline TrData trie_traverse_cont(TrEntry trie);
|
||||
inline void trie_remove_entry(TrData data);
|
||||
inline void trie_remove_subtree(TrData data);
|
||||
inline void trie_join(TrEntry trie_dest, TrEntry trie_source);
|
||||
inline void trie_intersect(TrEntry trie_dest, TrEntry trie_source);
|
||||
inline YAP_Int trie_count_join(TrEntry trie1, TrEntry trie2);
|
||||
inline YAP_Int trie_count_intersect(TrEntry trie1, TrEntry trie2);
|
||||
inline void trie_save(TrEntry trie, FILE *file);
|
||||
inline TrEntry trie_load(FILE *file);
|
||||
inline void trie_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
|
||||
inline void trie_max_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
|
||||
inline void trie_usage(TrEntry trie, YAP_Int *entries, YAP_Int *nodes, YAP_Int *virtual_nodes);
|
||||
inline void trie_print(TrEntry trie);
|
||||
void trie_init_module(void);
|
||||
void trie_data_load(TrNode node, YAP_Int depth, FILE *file);
|
||||
void trie_data_copy(TrNode node_dest, TrNode node_source);
|
||||
void trie_data_destruct(TrNode node);
|
||||
TrEntry trie_open(void);
|
||||
void trie_close(TrEntry trie);
|
||||
void trie_close_all(void);
|
||||
void trie_set_mode(YAP_Int mode);
|
||||
YAP_Int trie_get_mode(void);
|
||||
TrData trie_put_entry(TrEntry trie, YAP_Term entry);
|
||||
TrData trie_check_entry(TrEntry trie, YAP_Term entry);
|
||||
YAP_Term trie_get_entry(TrData data);
|
||||
TrData trie_get_first_entry(TrEntry trie);
|
||||
TrData trie_get_last_entry(TrEntry trie);
|
||||
TrData trie_traverse_init(TrEntry trie, TrData init_data);
|
||||
TrData trie_traverse_cont(TrEntry trie);
|
||||
void trie_remove_entry(TrData data);
|
||||
void trie_remove_subtree(TrData data);
|
||||
void trie_join(TrEntry trie_dest, TrEntry trie_source);
|
||||
void trie_intersect(TrEntry trie_dest, TrEntry trie_source);
|
||||
YAP_Int trie_count_join(TrEntry trie1, TrEntry trie2);
|
||||
YAP_Int trie_count_intersect(TrEntry trie1, TrEntry trie2);
|
||||
void trie_save(TrEntry trie, FILE *file);
|
||||
TrEntry trie_load(FILE *file);
|
||||
void trie_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
|
||||
void trie_max_stats(YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
|
||||
void trie_usage(TrEntry trie, YAP_Int *entries, YAP_Int *nodes, YAP_Int *virtual_nodes);
|
||||
void trie_print(TrEntry trie);
|
||||
|
||||
inline void trie_data_construct(TrNode node);
|
||||
inline void trie_set_traverse_mode(YAP_Int mode);
|
||||
inline YAP_Int trie_get_traverse_mode(void);
|
||||
inline TrData trie_traverse_first(TrEntry trie);
|
||||
inline TrData trie_traverse_next(TrData data);
|
||||
inline void trie_disable_hash_table(void);
|
||||
inline void trie_enable_hash_table(void);
|
||||
void trie_data_construct(TrNode node);
|
||||
void trie_set_traverse_mode(YAP_Int mode);
|
||||
YAP_Int trie_get_traverse_mode(void);
|
||||
TrData trie_traverse_first(TrEntry trie);
|
||||
TrData trie_traverse_next(TrData data);
|
||||
void trie_disable_hash_table(void);
|
||||
void trie_enable_hash_table(void);
|
||||
|
||||
inline YAP_Term trie_to_list(TrEntry trie);
|
||||
YAP_Term trie_to_list(TrEntry trie);
|
||||
|
||||
#include "base_dbtries.h"
|
||||
|
@ -209,10 +209,10 @@
|
||||
inline void displaynode(TrNode node);
|
||||
inline int traverse_get_counter(TrNode node);
|
||||
inline YAP_Term generate_label(YAP_Int Index);
|
||||
inline YAP_Term update_depth_breadth_trie(TrEngine engine, TrNode root, YAP_Int opt_level, void (*construct_function)(TrNode), void (*destruct_function)(TrNode), void (*copy_function)(TrNode, TrNode), void (*correct_order_function)(void));
|
||||
inline YAP_Term get_return_node_term(TrNode node);
|
||||
inline void traverse_and_replace_nested_trie(TrNode node, YAP_Int nested_trie_id, YAP_Term new_term);
|
||||
inline TrNode replace_nested_trie(TrNode node, TrNode child, YAP_Term new_term);
|
||||
YAP_Term update_depth_breadth_trie(TrEngine engine, TrNode root, YAP_Int opt_level, void (*construct_function)(TrNode), void (*destruct_function)(TrNode), void (*copy_function)(TrNode, TrNode), void (*correct_order_function)(void));
|
||||
YAP_Term get_return_node_term(TrNode node);
|
||||
void traverse_and_replace_nested_trie(TrNode node, YAP_Int nested_trie_id, YAP_Term new_term);
|
||||
TrNode replace_nested_trie(TrNode node, TrNode child, YAP_Term new_term);
|
||||
|
||||
|
||||
/* -------------------------- */
|
||||
@ -229,20 +229,20 @@ static YAP_Int TRIE_DEPTH_BREADTH_OPT_COUNT[3];
|
||||
/* depth-breadth Trie */
|
||||
/* -------------------------- */
|
||||
|
||||
inline
|
||||
|
||||
YAP_Int core_get_trie_db_opt_min_prefix(void) {
|
||||
return TRIE_DEPTH_BREADTH_MIN_PREFIX;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void core_set_trie_db_opt_min_prefix(YAP_Int min_prefix) {
|
||||
TRIE_DEPTH_BREADTH_MIN_PREFIX = min_prefix;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void core_depth_breadth_trie_replace_nested_trie(TrNode node, YAP_Int nested_trie_id, YAP_Term new_term) {
|
||||
traverse_and_replace_nested_trie(node, nested_trie_id, new_term);
|
||||
return;
|
||||
@ -350,7 +350,6 @@ void traverse_and_replace_nested_trie(TrNode node, YAP_Int nested_trie_id, YAP_T
|
||||
}
|
||||
|
||||
/* fixmeeee */
|
||||
inline
|
||||
TrNode replace_nested_trie(TrNode node, TrNode child, YAP_Term new_term) {
|
||||
TrNode newnode, temp, newnodef = NULL;
|
||||
if (YAP_IsApplTerm(new_term)) {
|
||||
@ -409,31 +408,31 @@ TrNode replace_nested_trie(TrNode node, TrNode child, YAP_Term new_term) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Term core_get_trie_db_return_term(void) {
|
||||
return TRIE_DEPTH_BREADTH_RETURN_TERM;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void core_set_trie_db_return_term(YAP_Term return_value){
|
||||
TRIE_DEPTH_BREADTH_RETURN_TERM = return_value;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void core_set_label_counter(YAP_Int value) {
|
||||
LABEL_COUNTER = value; // Initialize the counter
|
||||
return;
|
||||
}
|
||||
|
||||
inline
|
||||
|
||||
YAP_Int core_get_label_counter(void) {
|
||||
return LABEL_COUNTER;
|
||||
}
|
||||
|
||||
inline
|
||||
|
||||
void core_initialize_depth_breadth_trie(TrNode node, TrNode *depth_node, TrNode *breadth_node) {
|
||||
TrNode root = node;
|
||||
YAP_Functor f;
|
||||
@ -450,7 +449,7 @@ void core_initialize_depth_breadth_trie(TrNode node, TrNode *depth_node, TrNode
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void core_finalize_depth_breadth_trie(TrNode depth_node, TrNode breadth_node) {
|
||||
depth_node = trie_node_check_insert(depth_node, YAP_MkIntTerm(1));
|
||||
depth_node = trie_node_check_insert(depth_node, PairEndTag);
|
||||
@ -464,7 +463,7 @@ void core_finalize_depth_breadth_trie(TrNode depth_node, TrNode breadth_node) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrNode core_depth_reduction(TrEngine engine, TrNode node, TrNode depth_node, YAP_Int opt_level, void (*construct_function)(TrNode), void (*destruct_function)(TrNode), void (*copy_function)(TrNode, TrNode), void (*correct_order_function)(void)) {
|
||||
TrNode leaf = node;
|
||||
YAP_Term t, *stack_top;
|
||||
@ -530,7 +529,7 @@ TrNode core_depth_reduction(TrEngine engine, TrNode node, TrNode depth_node, YAP
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrNode core_breadth_reduction(TrEngine engine, TrNode node, TrNode breadth_node, YAP_Int opt_level, void (*construct_function)(TrNode), void (*destruct_function)(TrNode), void (*copy_function)(TrNode, TrNode), void (*correct_order_function)(void)) {
|
||||
YAP_Term t, *stack_top;
|
||||
int count = -1;
|
||||
@ -760,7 +759,7 @@ YAP_Term generate_label(YAP_Int Index) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Term update_depth_breadth_trie(TrEngine engine, TrNode root, YAP_Int opt_level, void (*construct_function)(TrNode), void (*destruct_function)(TrNode), void (*copy_function)(TrNode, TrNode), void (*correct_order_function)(void)) {
|
||||
TrNode node = root, remember = NULL;
|
||||
int count = -1, cnt = -1, c_cnt = 0, f_cnt = 0;
|
||||
@ -903,7 +902,7 @@ YAP_Term update_depth_breadth_trie(TrEngine engine, TrNode root, YAP_Int opt_lev
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Int core_db_trie_get_optimization_level_count(YAP_Int opt_level) {
|
||||
return TRIE_DEPTH_BREADTH_OPT_COUNT[opt_level - 1];
|
||||
}
|
||||
|
@ -215,15 +215,15 @@
|
||||
/* API */
|
||||
/* --------------------------- */
|
||||
|
||||
inline void core_set_label_counter(YAP_Int value);
|
||||
inline YAP_Int core_get_label_counter(void);
|
||||
inline void core_initialize_depth_breadth_trie(TrNode node, TrNode *depth_node, TrNode *breadth_node);
|
||||
inline void core_finalize_depth_breadth_trie(TrNode depth_node, TrNode breadth_node);
|
||||
inline TrNode core_depth_reduction(TrEngine engine, TrNode node, TrNode depth_node, YAP_Int opt_level, void (*construct_function)(TrNode), void (*destruct_function)(TrNode), void (*copy_function)(TrNode, TrNode), void (*correct_order_function)(void));
|
||||
inline TrNode core_breadth_reduction(TrEngine engine, TrNode node, TrNode breadth_node, YAP_Int opt_level, void (*construct_function)(TrNode), void (*destruct_function)(TrNode), void (*copy_function)(TrNode, TrNode), void (*correct_order_function)(void));
|
||||
inline YAP_Term core_get_trie_db_return_term(void);
|
||||
inline void core_set_trie_db_return_term(YAP_Term return_value);
|
||||
inline YAP_Int core_db_trie_get_optimization_level_count(YAP_Int opt_level);
|
||||
inline void core_depth_breadth_trie_replace_nested_trie(TrNode node, YAP_Int nested_trie_id, YAP_Term new_term);
|
||||
inline YAP_Int core_get_trie_db_opt_min_prefix(void);
|
||||
inline void core_set_trie_db_opt_min_prefix(YAP_Int min_prefix);
|
||||
void core_set_label_counter(YAP_Int value);
|
||||
YAP_Int core_get_label_counter(void);
|
||||
void core_initialize_depth_breadth_trie(TrNode node, TrNode *depth_node, TrNode *breadth_node);
|
||||
void core_finalize_depth_breadth_trie(TrNode depth_node, TrNode breadth_node);
|
||||
TrNode core_depth_reduction(TrEngine engine, TrNode node, TrNode depth_node, YAP_Int opt_level, void (*construct_function)(TrNode), void (*destruct_function)(TrNode), void (*copy_function)(TrNode, TrNode), void (*correct_order_function)(void));
|
||||
TrNode core_breadth_reduction(TrEngine engine, TrNode node, TrNode breadth_node, YAP_Int opt_level, void (*construct_function)(TrNode), void (*destruct_function)(TrNode), void (*copy_function)(TrNode, TrNode), void (*correct_order_function)(void));
|
||||
YAP_Term core_get_trie_db_return_term(void);
|
||||
void core_set_trie_db_return_term(YAP_Term return_value);
|
||||
YAP_Int core_db_trie_get_optimization_level_count(YAP_Int opt_level);
|
||||
void core_depth_breadth_trie_replace_nested_trie(TrNode node, YAP_Int nested_trie_id, YAP_Term new_term);
|
||||
YAP_Int core_get_trie_db_opt_min_prefix(void);
|
||||
void core_set_trie_db_opt_min_prefix(YAP_Int min_prefix);
|
||||
|
@ -49,10 +49,11 @@ static YAP_Term trie_to_list_floats(TrNode node);
|
||||
/* -------------------------- */
|
||||
|
||||
static TrEngine CURRENT_TRIE_ENGINE;
|
||||
|
||||
static YAP_Int USAGE_ENTRIES, USAGE_NODES, USAGE_VIRTUAL_NODES;
|
||||
static YAP_Int CURRENT_AUXILIARY_TERM_STACK_SIZE, CURRENT_TRIE_MODE, CURRENT_LOAD_VERSION, CURRENT_DEPTH, CURRENT_INDEX;
|
||||
static YAP_Term *AUXILIARY_TERM_STACK;
|
||||
static YAP_Term *stack_args, *stack_args_base, *stack_vars, *stack_vars_base;
|
||||
YAP_Term *stack_args, *stack_args_base, *stack_vars, *stack_vars_base;
|
||||
static YAP_Functor FunctorComma;
|
||||
static void (*DATA_SAVE_FUNCTION)(TrNode, FILE *);
|
||||
static void (*DATA_LOAD_FUNCTION)(TrNode, YAP_Int, FILE *);
|
||||
@ -68,7 +69,7 @@ static YAP_Int TRIE_DISABLE_HASH_TABLE = 0;
|
||||
/* Inline Procedures */
|
||||
/* -------------------------- */
|
||||
|
||||
static inline
|
||||
static
|
||||
TrNode trie_node_check_insert(TrNode parent, YAP_Term t) {
|
||||
TrNode child;
|
||||
|
||||
@ -156,7 +157,7 @@ TrNode trie_node_check_insert(TrNode parent, YAP_Term t) {
|
||||
}
|
||||
|
||||
|
||||
static inline
|
||||
static
|
||||
TrNode trie_node_insert(TrNode parent, YAP_Term t, TrHash hash) {
|
||||
TrNode child;
|
||||
|
||||
@ -180,7 +181,7 @@ TrNode trie_node_insert(TrNode parent, YAP_Term t, TrHash hash) {
|
||||
}
|
||||
|
||||
|
||||
static inline
|
||||
static
|
||||
TrNode trie_node_check(TrNode parent, YAP_Term t) {
|
||||
TrNode child;
|
||||
|
||||
@ -203,7 +204,7 @@ TrNode trie_node_check(TrNode parent, YAP_Term t) {
|
||||
}
|
||||
|
||||
|
||||
static inline
|
||||
static
|
||||
YAP_Term trie_to_list_create_simple(const char *atom_name, TrNode node) {
|
||||
YAP_Functor f = YAP_MkFunctor(YAP_LookupAtom(atom_name), 1);
|
||||
YAP_Term child = trie_to_list(TrNode_child(node));
|
||||
@ -212,7 +213,7 @@ YAP_Term trie_to_list_create_simple(const char *atom_name, TrNode node) {
|
||||
}
|
||||
|
||||
|
||||
static inline
|
||||
static
|
||||
YAP_Term trie_to_list_create_simple_end(const char *atom_name, TrNode node) {
|
||||
YAP_Atom atom = YAP_LookupAtom(atom_name);
|
||||
|
||||
@ -226,7 +227,7 @@ YAP_Term trie_to_list_create_simple_end(const char *atom_name, TrNode node) {
|
||||
}
|
||||
|
||||
|
||||
static inline
|
||||
static
|
||||
YAP_Term trie_to_list_create_two(const char *atom_name, TrNode node, YAP_Term operand) {
|
||||
YAP_Atom atom = YAP_LookupAtom(atom_name);
|
||||
|
||||
@ -247,7 +248,6 @@ YAP_Term trie_to_list_create_two(const char *atom_name, TrNode node, YAP_Term op
|
||||
/* API */
|
||||
/* -------------------------- */
|
||||
|
||||
inline
|
||||
TrEngine core_trie_init_module(void) {
|
||||
static int init_once = 1;
|
||||
TrEngine engine;
|
||||
@ -264,7 +264,7 @@ TrEngine core_trie_init_module(void) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrNode core_trie_open(TrEngine engine) {
|
||||
TrNode node;
|
||||
|
||||
@ -278,7 +278,7 @@ TrNode core_trie_open(TrEngine engine) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void core_trie_close(TrEngine engine, TrNode node, void (*destruct_function)(TrNode)) {
|
||||
CURRENT_TRIE_ENGINE = engine;
|
||||
DATA_DESTRUCT_FUNCTION = destruct_function;
|
||||
@ -295,7 +295,7 @@ void core_trie_close(TrEngine engine, TrNode node, void (*destruct_function)(TrN
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void core_trie_close_all(TrEngine engine, void (*destruct_function)(TrNode)) {
|
||||
while (TrEngine_trie(engine))
|
||||
core_trie_close(engine, TrEngine_trie(engine), destruct_function);
|
||||
@ -303,20 +303,20 @@ void core_trie_close_all(TrEngine engine, void (*destruct_function)(TrNode)) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void core_trie_set_mode(YAP_Int mode) {
|
||||
CURRENT_TRIE_MODE = mode;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Int core_trie_get_mode(void) {
|
||||
return CURRENT_TRIE_MODE;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrNode core_trie_put_entry(TrEngine engine, TrNode node, YAP_Term entry, YAP_Int *depth) {
|
||||
CURRENT_TRIE_ENGINE = engine;
|
||||
CURRENT_DEPTH = 0;
|
||||
@ -338,7 +338,7 @@ TrNode core_trie_put_entry(TrEngine engine, TrNode node, YAP_Term entry, YAP_Int
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrNode core_trie_check_entry(TrNode node, YAP_Term entry) {
|
||||
if (!TrNode_child(node))
|
||||
return NULL;
|
||||
@ -354,7 +354,7 @@ TrNode core_trie_check_entry(TrNode node, YAP_Term entry) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Term core_trie_get_entry(TrNode node) {
|
||||
CURRENT_INDEX = -1;
|
||||
stack_vars_base = stack_vars = AUXILIARY_TERM_STACK;
|
||||
@ -363,7 +363,7 @@ YAP_Term core_trie_get_entry(TrNode node) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void core_trie_remove_entry(TrEngine engine, TrNode node, void (*destruct_function)(TrNode)) {
|
||||
CURRENT_TRIE_ENGINE = engine;
|
||||
DATA_DESTRUCT_FUNCTION = destruct_function;
|
||||
@ -375,7 +375,7 @@ void core_trie_remove_entry(TrEngine engine, TrNode node, void (*destruct_functi
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void core_trie_remove_subtree(TrEngine engine, TrNode node, void (*destruct_function)(TrNode)) {
|
||||
TrNode parent;
|
||||
|
||||
@ -388,7 +388,7 @@ void core_trie_remove_subtree(TrEngine engine, TrNode node, void (*destruct_func
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void core_trie_add(TrNode node_dest, TrNode node_source, void (*add_function)(TrNode, TrNode)) {
|
||||
DATA_ADD_FUNCTION = add_function;
|
||||
if (TrNode_child(node_dest) && TrNode_child(node_source))
|
||||
@ -397,7 +397,7 @@ void core_trie_add(TrNode node_dest, TrNode node_source, void (*add_function)(Tr
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void core_trie_join(TrEngine engine, TrNode node_dest, TrNode node_source, void (*add_function)(TrNode, TrNode), void (*copy_function)(TrNode, TrNode)) {
|
||||
CURRENT_TRIE_ENGINE = engine;
|
||||
DATA_ADD_FUNCTION = add_function;
|
||||
@ -411,7 +411,7 @@ void core_trie_join(TrEngine engine, TrNode node_dest, TrNode node_source, void
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void core_trie_intersect(TrEngine engine, TrNode node_dest, TrNode node_source, void (*add_function)(TrNode, TrNode), void (*destruct_function)(TrNode)) {
|
||||
CURRENT_TRIE_ENGINE = engine;
|
||||
DATA_ADD_FUNCTION = add_function;
|
||||
@ -428,7 +428,7 @@ void core_trie_intersect(TrEngine engine, TrNode node_dest, TrNode node_source,
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Int core_trie_count_join(TrNode node1, TrNode node2) {
|
||||
YAP_Int count = 0;
|
||||
|
||||
@ -444,7 +444,7 @@ YAP_Int core_trie_count_join(TrNode node1, TrNode node2) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Int core_trie_count_intersect(TrNode node1, TrNode node2) {
|
||||
YAP_Int count = 0;
|
||||
|
||||
@ -455,7 +455,7 @@ YAP_Int core_trie_count_intersect(TrNode node1, TrNode node2) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void core_trie_save(TrNode node, FILE *file, void (*save_function)(TrNode, FILE *)) {
|
||||
CURRENT_INDEX = -1;
|
||||
DATA_SAVE_FUNCTION = save_function;
|
||||
@ -469,7 +469,7 @@ void core_trie_save(TrNode node, FILE *file, void (*save_function)(TrNode, FILE
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
TrNode core_trie_load(TrEngine engine, FILE *file, void (*load_function)(TrNode, YAP_Int, FILE *)) {
|
||||
TrNode node;
|
||||
char version[15];
|
||||
@ -523,7 +523,7 @@ TrNode core_trie_load(TrEngine engine, FILE *file, void (*load_function)(TrNode,
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void core_trie_stats(TrEngine engine, YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes) {
|
||||
*memory = TrEngine_memory(engine);
|
||||
*tries = TrEngine_tries(engine);
|
||||
@ -533,7 +533,7 @@ void core_trie_stats(TrEngine engine, YAP_Int *memory, YAP_Int *tries, YAP_Int *
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void core_trie_max_stats(TrEngine engine, YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes) {
|
||||
*memory = TrEngine_memory_max(engine);
|
||||
*tries = TrEngine_tries_max(engine);
|
||||
@ -543,7 +543,7 @@ void core_trie_max_stats(TrEngine engine, YAP_Int *memory, YAP_Int *tries, YAP_I
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void core_trie_usage(TrNode node, YAP_Int *entries, YAP_Int *nodes, YAP_Int *virtual_nodes) {
|
||||
USAGE_ENTRIES = 0;
|
||||
USAGE_NODES = 0;
|
||||
@ -557,7 +557,7 @@ void core_trie_usage(TrNode node, YAP_Int *entries, YAP_Int *nodes, YAP_Int *vir
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void core_trie_print(TrNode node, void (*print_function)(TrNode)) {
|
||||
DATA_PRINT_FUNCTION = print_function;
|
||||
if (TrNode_child(node)) {
|
||||
@ -572,19 +572,19 @@ void core_trie_print(TrNode node, void (*print_function)(TrNode)) {
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void core_disable_hash_table(void) {
|
||||
TRIE_DISABLE_HASH_TABLE = 1;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
void core_enable_hash_table(void) {
|
||||
TRIE_DISABLE_HASH_TABLE = 0;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
|
||||
YAP_Term core_trie_to_list(TrNode node) {
|
||||
TrNode root = TrNode_child(node);
|
||||
|
||||
@ -1724,7 +1724,7 @@ YAP_Term trie_to_list_node(TrNode node) {
|
||||
|
||||
|
||||
#ifdef TAG_LOW_BITS_32
|
||||
static inline
|
||||
|
||||
YAP_Term trie_to_list_floats_tag_low_32(YAP_Term result, TrNode node, volatile YAP_Term *p, volatile double *f) {
|
||||
if(IS_HASH_NODE(node)) {
|
||||
TrNode *first_bucket, *bucket;
|
||||
|
@ -287,32 +287,32 @@ typedef struct trie_hash {
|
||||
/* API */
|
||||
/* --------------------------- */
|
||||
|
||||
inline TrEngine core_trie_init_module(void);
|
||||
inline TrNode core_trie_open(TrEngine engine);
|
||||
inline void core_trie_close(TrEngine engine, TrNode node, void (*destruct_function)(TrNode));
|
||||
inline void core_trie_close_all(TrEngine engine, void (*destruct_function)(TrNode));
|
||||
inline void core_trie_set_mode(YAP_Int mode);
|
||||
inline YAP_Int core_trie_get_mode(void);
|
||||
inline TrNode core_trie_put_entry(TrEngine engine, TrNode node, YAP_Term entry, YAP_Int *depth);
|
||||
inline TrNode core_trie_check_entry(TrNode node, YAP_Term entry);
|
||||
inline YAP_Term core_trie_get_entry(TrNode node);
|
||||
inline void core_trie_remove_entry(TrEngine engine, TrNode node, void (*destruct_function)(TrNode));
|
||||
inline void core_trie_remove_subtree(TrEngine engine, TrNode node, void (*destruct_function)(TrNode));
|
||||
inline void core_trie_add(TrNode node_dest, TrNode node_source, void (*add_function)(TrNode, TrNode));
|
||||
inline void core_trie_join(TrEngine engine, TrNode node_dest, TrNode node_source, void (*add_function)(TrNode, TrNode), void (*copy_function)(TrNode, TrNode));
|
||||
inline void core_trie_intersect(TrEngine engine, TrNode node_dest, TrNode node_source, void (*add_function)(TrNode, TrNode), void (*destruct_function)(TrNode));
|
||||
inline YAP_Int core_trie_count_join(TrNode node1, TrNode node2);
|
||||
inline YAP_Int core_trie_count_intersect(TrNode node1, TrNode node2);
|
||||
inline void core_trie_save(TrNode node, FILE *file, void (*save_function)(TrNode, FILE *));
|
||||
inline TrNode core_trie_load(TrEngine engine, FILE *file, void (*load_function)(TrNode, YAP_Int, FILE *));
|
||||
inline void core_trie_stats(TrEngine engine, YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
|
||||
inline void core_trie_max_stats(TrEngine engine, YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
|
||||
inline void core_trie_usage(TrNode node, YAP_Int *entries, YAP_Int *nodes, YAP_Int *virtual_nodes);
|
||||
inline void core_trie_print(TrNode node, void (*print_function)(TrNode));
|
||||
TrEngine core_trie_init_module(void);
|
||||
TrNode core_trie_open(TrEngine engine);
|
||||
void core_trie_close(TrEngine engine, TrNode node, void (*destruct_function)(TrNode));
|
||||
void core_trie_close_all(TrEngine engine, void (*destruct_function)(TrNode));
|
||||
void core_trie_set_mode(YAP_Int mode);
|
||||
YAP_Int core_trie_get_mode(void);
|
||||
TrNode core_trie_put_entry(TrEngine engine, TrNode node, YAP_Term entry, YAP_Int *depth);
|
||||
TrNode core_trie_check_entry(TrNode node, YAP_Term entry);
|
||||
YAP_Term core_trie_get_entry(TrNode node);
|
||||
void core_trie_remove_entry(TrEngine engine, TrNode node, void (*destruct_function)(TrNode));
|
||||
void core_trie_remove_subtree(TrEngine engine, TrNode node, void (*destruct_function)(TrNode));
|
||||
void core_trie_add(TrNode node_dest, TrNode node_source, void (*add_function)(TrNode, TrNode));
|
||||
void core_trie_join(TrEngine engine, TrNode node_dest, TrNode node_source, void (*add_function)(TrNode, TrNode), void (*copy_function)(TrNode, TrNode));
|
||||
void core_trie_intersect(TrEngine engine, TrNode node_dest, TrNode node_source, void (*add_function)(TrNode, TrNode), void (*destruct_function)(TrNode));
|
||||
YAP_Int core_trie_count_join(TrNode node1, TrNode node2);
|
||||
YAP_Int core_trie_count_intersect(TrNode node1, TrNode node2);
|
||||
void core_trie_save(TrNode node, FILE *file, void (*save_function)(TrNode, FILE *));
|
||||
TrNode core_trie_load(TrEngine engine, FILE *file, void (*load_function)(TrNode, YAP_Int, FILE *));
|
||||
void core_trie_stats(TrEngine engine, YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
|
||||
void core_trie_max_stats(TrEngine engine, YAP_Int *memory, YAP_Int *tries, YAP_Int *entries, YAP_Int *nodes);
|
||||
void core_trie_usage(TrNode node, YAP_Int *entries, YAP_Int *nodes, YAP_Int *virtual_nodes);
|
||||
void core_trie_print(TrNode node, void (*print_function)(TrNode));
|
||||
|
||||
inline void core_disable_hash_table(void);
|
||||
inline void core_enable_hash_table(void);
|
||||
void core_disable_hash_table(void);
|
||||
void core_enable_hash_table(void);
|
||||
|
||||
inline YAP_Term core_trie_to_list(TrNode node);
|
||||
YAP_Term core_trie_to_list(TrNode node);
|
||||
|
||||
#include "core_dbtries.h"
|
||||
|
@ -903,7 +903,7 @@ static int p_trie_get_db_opt_level_count_cont(void) {
|
||||
YAP_PRESERVED_DATA(opt_level, db_trie_opt_level);
|
||||
opt_level->value = YAP_MkIntTerm(YAP_IntOfTerm(opt_level->value) + 1);
|
||||
if (YAP_IntOfTerm(opt_level->value) < 4) {
|
||||
if (YAP_Unify(arg_opt_level, opt_level->value));
|
||||
if (YAP_Unify(arg_opt_level, opt_level->value))
|
||||
return YAP_Unify(arg_count, YAP_MkIntTerm(trie_get_db_opt_level_count(YAP_IntOfTerm(arg_opt_level))));
|
||||
YAP_cut_fail();
|
||||
return FALSE;
|
||||
|
Reference in New Issue
Block a user