support for trie compact lists
This commit is contained in:
parent
3ccad9aff2
commit
eeb62b63b4
@ -347,26 +347,50 @@
|
||||
OPCODE(trie_trust_null ,e),
|
||||
OPCODE(trie_try_null ,e),
|
||||
OPCODE(trie_retry_null ,e),
|
||||
OPCODE(trie_do_null_in_new_list ,e),
|
||||
OPCODE(trie_trust_null_in_new_list,e),
|
||||
OPCODE(trie_try_null_in_new_list ,e),
|
||||
OPCODE(trie_retry_null_in_new_list,e),
|
||||
OPCODE(trie_do_var ,e),
|
||||
OPCODE(trie_trust_var ,e),
|
||||
OPCODE(trie_try_var ,e),
|
||||
OPCODE(trie_retry_var ,e),
|
||||
OPCODE(trie_do_var_in_new_list ,e),
|
||||
OPCODE(trie_trust_var_in_new_list ,e),
|
||||
OPCODE(trie_try_var_in_new_list ,e),
|
||||
OPCODE(trie_retry_var_in_new_list ,e),
|
||||
OPCODE(trie_do_val ,e),
|
||||
OPCODE(trie_trust_val ,e),
|
||||
OPCODE(trie_try_val ,e),
|
||||
OPCODE(trie_retry_val ,e),
|
||||
OPCODE(trie_do_val_in_new_list ,e),
|
||||
OPCODE(trie_trust_val_in_new_list ,e),
|
||||
OPCODE(trie_try_val_in_new_list ,e),
|
||||
OPCODE(trie_retry_val_in_new_list ,e),
|
||||
OPCODE(trie_do_atom ,e),
|
||||
OPCODE(trie_trust_atom ,e),
|
||||
OPCODE(trie_try_atom ,e),
|
||||
OPCODE(trie_retry_atom ,e),
|
||||
OPCODE(trie_do_atom_in_new_list ,e),
|
||||
OPCODE(trie_trust_atom_in_new_list,e),
|
||||
OPCODE(trie_try_atom_in_new_list ,e),
|
||||
OPCODE(trie_retry_atom_in_new_list,e),
|
||||
OPCODE(trie_do_list ,e),
|
||||
OPCODE(trie_trust_list ,e),
|
||||
OPCODE(trie_try_list ,e),
|
||||
OPCODE(trie_retry_list ,e),
|
||||
OPCODE(trie_do_list_in_new_list ,e),
|
||||
OPCODE(trie_trust_list_in_new_list,e),
|
||||
OPCODE(trie_try_list_in_new_list ,e),
|
||||
OPCODE(trie_retry_list_in_new_list,e),
|
||||
OPCODE(trie_do_struct ,e),
|
||||
OPCODE(trie_trust_struct ,e),
|
||||
OPCODE(trie_try_struct ,e),
|
||||
OPCODE(trie_retry_struct ,e),
|
||||
OPCODE(trie_do_struct_in_new_list ,e),
|
||||
OPCODE(trie_trust_struct_in_new_list,e),
|
||||
OPCODE(trie_try_struct_in_new_list,e),
|
||||
OPCODE(trie_retry_struct_in_new_list,e),
|
||||
OPCODE(trie_do_extension ,e),
|
||||
OPCODE(trie_trust_extension ,e),
|
||||
OPCODE(trie_try_extension ,e),
|
||||
|
24
H/rclause.h
24
H/rclause.h
@ -795,41 +795,65 @@ restore_opcodes(yamop *pc)
|
||||
break;
|
||||
/* instructions type e */
|
||||
case _trie_do_atom:
|
||||
case _trie_do_atom_in_new_list:
|
||||
case _trie_do_extension:
|
||||
case _trie_do_float:
|
||||
case _trie_do_list:
|
||||
case _trie_do_list_in_new_list:
|
||||
case _trie_do_long:
|
||||
case _trie_do_null:
|
||||
case _trie_do_null_in_new_list:
|
||||
case _trie_do_struct:
|
||||
case _trie_do_struct_in_new_list:
|
||||
case _trie_do_val:
|
||||
case _trie_do_val_in_new_list:
|
||||
case _trie_do_var:
|
||||
case _trie_do_var_in_new_list:
|
||||
case _trie_retry_atom:
|
||||
case _trie_retry_atom_in_new_list:
|
||||
case _trie_retry_extension:
|
||||
case _trie_retry_float:
|
||||
case _trie_retry_list:
|
||||
case _trie_retry_list_in_new_list:
|
||||
case _trie_retry_long:
|
||||
case _trie_retry_null:
|
||||
case _trie_retry_null_in_new_list:
|
||||
case _trie_retry_struct:
|
||||
case _trie_retry_struct_in_new_list:
|
||||
case _trie_retry_val:
|
||||
case _trie_retry_val_in_new_list:
|
||||
case _trie_retry_var:
|
||||
case _trie_retry_var_in_new_list:
|
||||
case _trie_trust_atom:
|
||||
case _trie_trust_atom_in_new_list:
|
||||
case _trie_trust_extension:
|
||||
case _trie_trust_float:
|
||||
case _trie_trust_list:
|
||||
case _trie_trust_list_in_new_list:
|
||||
case _trie_trust_long:
|
||||
case _trie_trust_null:
|
||||
case _trie_trust_null_in_new_list:
|
||||
case _trie_trust_struct:
|
||||
case _trie_trust_struct_in_new_list:
|
||||
case _trie_trust_val:
|
||||
case _trie_trust_val_in_new_list:
|
||||
case _trie_trust_var:
|
||||
case _trie_trust_var_in_new_list:
|
||||
case _trie_try_atom:
|
||||
case _trie_try_atom_in_new_list:
|
||||
case _trie_try_extension:
|
||||
case _trie_try_float:
|
||||
case _trie_try_list:
|
||||
case _trie_try_list_in_new_list:
|
||||
case _trie_try_long:
|
||||
case _trie_try_null:
|
||||
case _trie_try_null_in_new_list:
|
||||
case _trie_try_struct:
|
||||
case _trie_try_struct_in_new_list:
|
||||
case _trie_try_val:
|
||||
case _trie_try_val_in_new_list:
|
||||
case _trie_try_var:
|
||||
case _trie_try_var_in_new_list:
|
||||
if (op == _Nstop || op == _copy_idb_term || op == _unify_idb_term) return;
|
||||
pc = NEXTOP(pc,e);
|
||||
break;
|
||||
|
@ -614,41 +614,65 @@
|
||||
break;
|
||||
/* instructions type e */
|
||||
case _trie_do_atom:
|
||||
case _trie_do_atom_in_new_list:
|
||||
case _trie_do_extension:
|
||||
case _trie_do_float:
|
||||
case _trie_do_list:
|
||||
case _trie_do_list_in_new_list:
|
||||
case _trie_do_long:
|
||||
case _trie_do_null:
|
||||
case _trie_do_null_in_new_list:
|
||||
case _trie_do_struct:
|
||||
case _trie_do_struct_in_new_list:
|
||||
case _trie_do_val:
|
||||
case _trie_do_val_in_new_list:
|
||||
case _trie_do_var:
|
||||
case _trie_do_var_in_new_list:
|
||||
case _trie_retry_atom:
|
||||
case _trie_retry_atom_in_new_list:
|
||||
case _trie_retry_extension:
|
||||
case _trie_retry_float:
|
||||
case _trie_retry_list:
|
||||
case _trie_retry_list_in_new_list:
|
||||
case _trie_retry_long:
|
||||
case _trie_retry_null:
|
||||
case _trie_retry_null_in_new_list:
|
||||
case _trie_retry_struct:
|
||||
case _trie_retry_struct_in_new_list:
|
||||
case _trie_retry_val:
|
||||
case _trie_retry_val_in_new_list:
|
||||
case _trie_retry_var:
|
||||
case _trie_retry_var_in_new_list:
|
||||
case _trie_trust_atom:
|
||||
case _trie_trust_atom_in_new_list:
|
||||
case _trie_trust_extension:
|
||||
case _trie_trust_float:
|
||||
case _trie_trust_list:
|
||||
case _trie_trust_list_in_new_list:
|
||||
case _trie_trust_long:
|
||||
case _trie_trust_null:
|
||||
case _trie_trust_null_in_new_list:
|
||||
case _trie_trust_struct:
|
||||
case _trie_trust_struct_in_new_list:
|
||||
case _trie_trust_val:
|
||||
case _trie_trust_val_in_new_list:
|
||||
case _trie_trust_var:
|
||||
case _trie_trust_var_in_new_list:
|
||||
case _trie_try_atom:
|
||||
case _trie_try_atom_in_new_list:
|
||||
case _trie_try_extension:
|
||||
case _trie_try_float:
|
||||
case _trie_try_list:
|
||||
case _trie_try_list_in_new_list:
|
||||
case _trie_try_long:
|
||||
case _trie_try_null:
|
||||
case _trie_try_null_in_new_list:
|
||||
case _trie_try_struct:
|
||||
case _trie_try_struct_in_new_list:
|
||||
case _trie_try_val:
|
||||
case _trie_try_val_in_new_list:
|
||||
case _trie_try_var:
|
||||
case _trie_try_var_in_new_list:
|
||||
pc = NEXTOP(pc,e);
|
||||
break;
|
||||
#endif
|
||||
|
@ -73,6 +73,11 @@
|
||||
** ----------------------------------------------- */
|
||||
/* #define INCOMPLETE_TABLING 1 */
|
||||
|
||||
/* ----------------------------------------------- **
|
||||
** support trie compact lists? (optional) **
|
||||
** ----------------------------------------------- */
|
||||
/* #define TRIE_COMPACT_LISTS 1 */
|
||||
|
||||
/* --------------------------------------- **
|
||||
** support inner cuts? (optional) **
|
||||
** --------------------------------------- */
|
||||
@ -169,6 +174,7 @@
|
||||
#undef BBREG_TRAIL_SCHEME
|
||||
#undef LIMIT_TABLING
|
||||
#undef INCOMPLETE_TABLING
|
||||
#undef TRIE_COMPACT_LISTS
|
||||
#undef TABLING_ERRORS
|
||||
#endif /* !TABLING */
|
||||
|
||||
|
@ -111,6 +111,11 @@ STD_PROTO(static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames, (tg_sol_fr_p
|
||||
#define IsTableVarTerm(TERM) \
|
||||
((CELL) TERM) >= GLOBAL_table_var_enumerator(0) && \
|
||||
((CELL) TERM) <= GLOBAL_table_var_enumerator(MAX_TABLE_VARS - 1)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
#define PairTermMark NULL
|
||||
#define PairTermInit ((Term *) 0)
|
||||
#define PairTermLast ((Term *) (LowTagBits + 1))
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
|
||||
#define HASH_TABLE_LOCK(NODE) ((((unsigned long int)NODE) >> 5) & (TABLE_LOCK_BUCKETS - 1))
|
||||
#define LOCK_TABLE(NODE) LOCK(GLOBAL_table_lock(HASH_TABLE_LOCK(NODE)))
|
||||
|
@ -714,10 +714,35 @@ sg_fr_ptr subgoal_search(yamop *preg, CELL **Yaddr) {
|
||||
} else if (IsAtomOrIntTerm(t)) {
|
||||
current_sg_node = subgoal_trie_node_check_insert(tab_ent, current_sg_node, t);
|
||||
} else if (IsPairTerm(t)) {
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
CELL *aux = RepPair(t);
|
||||
if (aux == PairTermMark) {
|
||||
t = Deref(STACK_POP_DOWN(stack_terms));
|
||||
if (IsPairTerm(t)) {
|
||||
aux = RepPair(t);
|
||||
/* STACK_CHECK_EXPAND(stack_terms, stack_terms_limit + 2, stack_terms_base); */
|
||||
/* STACK_CHECK_EXPAND is not necessary here because the situation of pushing **
|
||||
** up 3 terms has already initially checked for the PairTermInit term */
|
||||
STACK_PUSH_UP(*(aux + 1), stack_terms);
|
||||
STACK_PUSH_UP(AbsPair(PairTermMark), stack_terms);
|
||||
STACK_PUSH_UP(*(aux), stack_terms);
|
||||
} else {
|
||||
current_sg_node = subgoal_trie_node_check_insert(tab_ent, current_sg_node, AbsPair(PairTermLast));
|
||||
STACK_PUSH_UP(t, stack_terms);
|
||||
}
|
||||
} else {
|
||||
current_sg_node = subgoal_trie_node_check_insert(tab_ent, current_sg_node, AbsPair(PairTermInit));
|
||||
STACK_CHECK_EXPAND(stack_terms, stack_terms_limit + 2, stack_terms_base);
|
||||
STACK_PUSH_UP(*(aux + 1), stack_terms);
|
||||
STACK_PUSH_UP(AbsPair(PairTermMark), stack_terms);
|
||||
STACK_PUSH_UP(*(aux), stack_terms);
|
||||
}
|
||||
#else
|
||||
current_sg_node = subgoal_trie_node_check_insert(tab_ent, current_sg_node, AbsPair(NULL));
|
||||
STACK_CHECK_EXPAND(stack_terms, stack_terms_limit + 1, stack_terms_base);
|
||||
STACK_PUSH_UP(*(RepPair(t) + 1), stack_terms);
|
||||
STACK_PUSH_UP(*(RepPair(t)), stack_terms);
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
} else if (IsApplTerm(t)) {
|
||||
Functor f = FunctorOfTerm(t);
|
||||
current_sg_node = subgoal_trie_node_check_insert(tab_ent, current_sg_node, AbsAppl((Term *)f));
|
||||
@ -782,6 +807,11 @@ ans_node_ptr answer_search(sg_fr_ptr sg_fr, CELL *subs_ptr) {
|
||||
int i, j, count_vars, subs_arity;
|
||||
CELL *stack_vars, *stack_terms_base, *stack_terms;
|
||||
ans_node_ptr current_ans_node;
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
int in_new_list = 0;
|
||||
#else
|
||||
#define in_new_list 0
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
|
||||
count_vars = 0;
|
||||
subs_arity = *subs_ptr;
|
||||
@ -801,7 +831,7 @@ ans_node_ptr answer_search(sg_fr_ptr sg_fr, CELL *subs_ptr) {
|
||||
if (IsVarTerm(t)) {
|
||||
if (IsTableVarTerm(t)) {
|
||||
t = MakeTableVarTerm(VarIndexOfTerm(t));
|
||||
current_ans_node = answer_trie_node_check_insert(sg_fr, current_ans_node, t, _trie_retry_val);
|
||||
current_ans_node = answer_trie_node_check_insert(sg_fr, current_ans_node, t, _trie_retry_val + in_new_list);
|
||||
} else {
|
||||
if (count_vars == MAX_TABLE_VARS)
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "MAX_TABLE_VARS exceeded (answer_search)");
|
||||
@ -809,21 +839,54 @@ ans_node_ptr answer_search(sg_fr_ptr sg_fr, CELL *subs_ptr) {
|
||||
*((CELL *)t) = GLOBAL_table_var_enumerator(count_vars);
|
||||
t = MakeTableVarTerm(count_vars);
|
||||
count_vars++;
|
||||
current_ans_node = answer_trie_node_check_insert(sg_fr, current_ans_node, t, _trie_retry_var);
|
||||
current_ans_node = answer_trie_node_check_insert(sg_fr, current_ans_node, t, _trie_retry_var + in_new_list);
|
||||
}
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
in_new_list = 0;
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
} else if (IsAtomOrIntTerm(t)) {
|
||||
current_ans_node = answer_trie_node_check_insert(sg_fr, current_ans_node, t, _trie_retry_atom);
|
||||
current_ans_node = answer_trie_node_check_insert(sg_fr, current_ans_node, t, _trie_retry_atom + in_new_list);
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
in_new_list = 0;
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
} else if (IsPairTerm(t)) {
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
CELL *aux = RepPair(t);
|
||||
if (aux == PairTermMark) {
|
||||
t = Deref(STACK_POP_DOWN(stack_terms));
|
||||
if (IsPairTerm(t)) {
|
||||
aux = RepPair(t);
|
||||
/* STACK_CHECK_EXPAND(stack_terms, stack_vars + 2, stack_terms_base); */
|
||||
/* STACK_CHECK_EXPAND is not necessary here because the situation of pushing **
|
||||
** up 3 terms has already initially checked for the PairTermInit term */
|
||||
STACK_PUSH_UP(*(aux + 1), stack_terms);
|
||||
STACK_PUSH_UP(AbsPair(PairTermMark), stack_terms);
|
||||
STACK_PUSH_UP(*(aux), stack_terms);
|
||||
in_new_list = 4;
|
||||
} else {
|
||||
current_ans_node = answer_trie_node_check_insert(sg_fr, current_ans_node, AbsPair(PairTermLast), _trie_retry_null);
|
||||
STACK_PUSH_UP(t, stack_terms);
|
||||
}
|
||||
} else {
|
||||
current_ans_node = answer_trie_node_check_insert(sg_fr, current_ans_node, AbsPair(PairTermInit), _trie_retry_list + in_new_list);
|
||||
STACK_CHECK_EXPAND(stack_terms, stack_vars + 2, stack_terms_base);
|
||||
STACK_PUSH_UP(*(aux + 1), stack_terms);
|
||||
STACK_PUSH_UP(AbsPair(PairTermMark), stack_terms);
|
||||
STACK_PUSH_UP(*(aux), stack_terms);
|
||||
in_new_list = 0;
|
||||
}
|
||||
#else
|
||||
current_ans_node = answer_trie_node_check_insert(sg_fr, current_ans_node, AbsPair(NULL), _trie_retry_list);
|
||||
STACK_CHECK_EXPAND(stack_terms, stack_vars + 1, stack_terms_base);
|
||||
STACK_PUSH_UP(*(RepPair(t) + 1), stack_terms);
|
||||
STACK_PUSH_UP(*(RepPair(t)), stack_terms);
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
} else if (IsApplTerm(t)) {
|
||||
Functor f = FunctorOfTerm(t);
|
||||
if (f == FunctorDouble) {
|
||||
volatile Float dbl = FloatOfTerm(t);
|
||||
volatile Term *t_dbl = (Term *)((void *) &dbl);
|
||||
current_ans_node = answer_trie_node_check_insert(sg_fr, current_ans_node, AbsAppl((Term *)f), _trie_retry_null);
|
||||
current_ans_node = answer_trie_node_check_insert(sg_fr, current_ans_node, AbsAppl((Term *)f), _trie_retry_null + in_new_list);
|
||||
#if SIZEOF_DOUBLE == 2 * SIZEOF_INT_P
|
||||
current_ans_node = answer_trie_node_check_insert(sg_fr, current_ans_node, *(t_dbl + 1), _trie_retry_extension);
|
||||
#endif /* SIZEOF_DOUBLE x SIZEOF_INT_P */
|
||||
@ -831,15 +894,18 @@ ans_node_ptr answer_search(sg_fr_ptr sg_fr, CELL *subs_ptr) {
|
||||
current_ans_node = answer_trie_node_check_insert(sg_fr, current_ans_node, AbsAppl((Term *)f), _trie_retry_float);
|
||||
} else if (f == FunctorLongInt) {
|
||||
Int li = LongIntOfTerm (t);
|
||||
current_ans_node = answer_trie_node_check_insert(sg_fr, current_ans_node, AbsAppl((Term *)f), _trie_retry_null);
|
||||
current_ans_node = answer_trie_node_check_insert(sg_fr, current_ans_node, AbsAppl((Term *)f), _trie_retry_null + in_new_list);
|
||||
current_ans_node = answer_trie_node_check_insert(sg_fr, current_ans_node, li, _trie_retry_extension);
|
||||
current_ans_node = answer_trie_node_check_insert(sg_fr, current_ans_node, AbsAppl((Term *)f), _trie_retry_long);
|
||||
} else {
|
||||
current_ans_node = answer_trie_node_check_insert(sg_fr, current_ans_node, AbsAppl((Term *)f), _trie_retry_struct);
|
||||
current_ans_node = answer_trie_node_check_insert(sg_fr, current_ans_node, AbsAppl((Term *)f), _trie_retry_struct + in_new_list);
|
||||
STACK_CHECK_EXPAND(stack_terms, stack_vars + ArityOfFunctor(f) - 1, stack_terms_base);
|
||||
for (j = ArityOfFunctor(f); j >= 1; j--)
|
||||
STACK_PUSH_UP(*(RepAppl(t) + j), stack_terms);
|
||||
}
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
in_new_list = 0;
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
} else {
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "unknown type tag (answer_search)");
|
||||
}
|
||||
@ -860,6 +926,9 @@ void load_answer_trie(ans_node_ptr ans_node, CELL *subs_ptr) {
|
||||
CELL *stack_vars_base, *stack_vars, *stack_terms_base, *stack_terms;
|
||||
int subs_arity, i, n_vars = -1;
|
||||
Term t;
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
int stack_terms_pair_offset = 0;
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
|
||||
if ((subs_arity = *subs_ptr) == 0)
|
||||
return;
|
||||
@ -890,10 +959,31 @@ void load_answer_trie(ans_node_ptr ans_node, CELL *subs_ptr) {
|
||||
STACK_CHECK_EXPAND(stack_terms, stack_vars, stack_terms_base);
|
||||
STACK_PUSH_UP(t, stack_terms);
|
||||
} else if (IsPairTerm(t)) {
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
if (t == AbsPair(PairTermInit)) {
|
||||
Term *stack_aux = stack_terms_base - stack_terms_pair_offset;
|
||||
Term head, tail = STACK_POP_UP(stack_aux);
|
||||
while (STACK_NOT_EMPTY(stack_aux, stack_terms)) {
|
||||
head = STACK_POP_UP(stack_aux);
|
||||
tail = MkPairTerm(head, tail);
|
||||
}
|
||||
stack_terms = stack_terms_base - stack_terms_pair_offset;
|
||||
stack_terms_pair_offset = (int) STACK_POP_DOWN(stack_terms);
|
||||
STACK_PUSH_UP(tail, stack_terms);
|
||||
} else { /* AbsPair(PairTermLast)) */
|
||||
Term last;
|
||||
STACK_CHECK_EXPAND(stack_terms, stack_vars, stack_terms_base);
|
||||
last = STACK_POP_DOWN(stack_terms);
|
||||
STACK_PUSH_UP(stack_terms_pair_offset, stack_terms);
|
||||
stack_terms_pair_offset = (int) (stack_terms_base - stack_terms);
|
||||
STACK_PUSH_UP(last, stack_terms);
|
||||
}
|
||||
#else
|
||||
Term head = STACK_POP_DOWN(stack_terms);
|
||||
Term tail = STACK_POP_DOWN(stack_terms);
|
||||
t = MkPairTerm(head, tail);
|
||||
STACK_PUSH_UP(t, stack_terms);
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
} else if (IsApplTerm(t)) {
|
||||
Functor f = (Functor) RepAppl(t);
|
||||
if (f == FunctorDouble) {
|
||||
@ -1286,6 +1376,12 @@ void traverse_subgoal_trie(sg_node_ptr sg_node, char *str, int str_index, int *a
|
||||
sg_node = *bucket;
|
||||
traverse_subgoal_trie(sg_node, str, str_index, arity, depth, mode);
|
||||
memcpy(arity, current_arity, sizeof(int) * (current_arity[0] + 1));
|
||||
if (arity[arity[0]] == -1)
|
||||
str[str_index - 1] = '|';
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
else if (arity[arity[0]] == -2 && str[str_index - 1] != '[')
|
||||
str[str_index - 1] = ',';
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
}
|
||||
} while (++bucket != last_bucket);
|
||||
free(current_arity);
|
||||
@ -1301,6 +1397,10 @@ void traverse_subgoal_trie(sg_node_ptr sg_node, char *str, int str_index, int *a
|
||||
free(current_arity);
|
||||
if (arity[arity[0]] == -1)
|
||||
str[str_index - 1] = '|';
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
else if (arity[arity[0]] == -2 && str[str_index - 1] != '[')
|
||||
str[str_index - 1] = ',';
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
}
|
||||
|
||||
/* test the node type */
|
||||
@ -1334,13 +1434,17 @@ void traverse_subgoal_trie(sg_node_ptr sg_node, char *str, int str_index, int *a
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
arity[arity[0]]++;
|
||||
if (arity[arity[0]] == 0) {
|
||||
if (arity[arity[0]] == -2) {
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
str_index += sprintf(& str[str_index], ",");
|
||||
#else
|
||||
str_index += sprintf(& str[str_index], "|");
|
||||
arity[arity[0]] = -1;
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
break;
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "]");
|
||||
arity[0]--;
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "|");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1363,13 +1467,17 @@ void traverse_subgoal_trie(sg_node_ptr sg_node, char *str, int str_index, int *a
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
arity[arity[0]]++;
|
||||
if (arity[arity[0]] == 0) {
|
||||
if (arity[arity[0]] == -2) {
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
str_index += sprintf(& str[str_index], ",");
|
||||
#else
|
||||
str_index += sprintf(& str[str_index], "|");
|
||||
arity[arity[0]] = -1;
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
break;
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "]");
|
||||
arity[0]--;
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "|");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1391,13 +1499,17 @@ void traverse_subgoal_trie(sg_node_ptr sg_node, char *str, int str_index, int *a
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
arity[arity[0]]++;
|
||||
if (arity[arity[0]] == 0) {
|
||||
if (arity[arity[0]] == -2) {
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
str_index += sprintf(& str[str_index], ",");
|
||||
#else
|
||||
str_index += sprintf(& str[str_index], "|");
|
||||
arity[arity[0]] = -1;
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
break;
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "]");
|
||||
arity[0]--;
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "|");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1418,13 +1530,17 @@ void traverse_subgoal_trie(sg_node_ptr sg_node, char *str, int str_index, int *a
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
arity[arity[0]]++;
|
||||
if (arity[arity[0]] == 0) {
|
||||
if (arity[arity[0]] == -2) {
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
str_index += sprintf(& str[str_index], ",");
|
||||
#else
|
||||
str_index += sprintf(& str[str_index], "|");
|
||||
arity[arity[0]] = -1;
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
break;
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "]");
|
||||
arity[0]--;
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "|");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1445,20 +1561,30 @@ void traverse_subgoal_trie(sg_node_ptr sg_node, char *str, int str_index, int *a
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
arity[arity[0]]++;
|
||||
if (arity[arity[0]] == 0) {
|
||||
if (arity[arity[0]] == -2) {
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
str_index += sprintf(& str[str_index], ",");
|
||||
#else
|
||||
str_index += sprintf(& str[str_index], "|");
|
||||
arity[arity[0]] = -1;
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
break;
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "]");
|
||||
arity[0]--;
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "|");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (IsPairTerm(t)) {
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
if (t == AbsPair(PairTermLast)) {
|
||||
str[str_index - 1] = '|';
|
||||
arity[arity[0]] = -1;
|
||||
#else
|
||||
if (arity[arity[0]] == -1) {
|
||||
str[str_index - 1] = ',';
|
||||
arity[arity[0]] = -2;
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "[");
|
||||
arity[0]++;
|
||||
@ -1549,6 +1675,12 @@ void traverse_answer_trie(ans_node_ptr ans_node, char *str, int str_index, int *
|
||||
ans_node = *bucket;
|
||||
traverse_answer_trie(ans_node, str, str_index, arity, var_index, depth, mode);
|
||||
memcpy(arity, current_arity, sizeof(int) * (current_arity[0] + 1));
|
||||
if (arity[arity[0]] == -1)
|
||||
str[str_index - 1] = '|';
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
else if (arity[arity[0]] == -2 && str[str_index - 1] != '[')
|
||||
str[str_index - 1] = ',';
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
}
|
||||
} while (++bucket != last_bucket);
|
||||
free(current_arity);
|
||||
@ -1564,6 +1696,10 @@ void traverse_answer_trie(ans_node_ptr ans_node, char *str, int str_index, int *
|
||||
free(current_arity);
|
||||
if (arity[arity[0]] == -1)
|
||||
str[str_index - 1] = '|';
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
else if (arity[arity[0]] == -2 && str[str_index - 1] != '[')
|
||||
str[str_index - 1] = ',';
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
}
|
||||
|
||||
/* print VAR when starting a term */
|
||||
@ -1602,13 +1738,17 @@ void traverse_answer_trie(ans_node_ptr ans_node, char *str, int str_index, int *
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
arity[arity[0]]++;
|
||||
if (arity[arity[0]] == 0) {
|
||||
if (arity[arity[0]] == -2) {
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
str_index += sprintf(& str[str_index], ",");
|
||||
#else
|
||||
str_index += sprintf(& str[str_index], "|");
|
||||
arity[arity[0]] = -1;
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
break;
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "]");
|
||||
arity[0]--;
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "|");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1633,13 +1773,17 @@ void traverse_answer_trie(ans_node_ptr ans_node, char *str, int str_index, int *
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
arity[arity[0]]++;
|
||||
if (arity[arity[0]] == 0) {
|
||||
if (arity[arity[0]] == -2) {
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
str_index += sprintf(& str[str_index], ",");
|
||||
#else
|
||||
str_index += sprintf(& str[str_index], "|");
|
||||
arity[arity[0]] = -1;
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
break;
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "]");
|
||||
arity[0]--;
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "|");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1663,13 +1807,17 @@ void traverse_answer_trie(ans_node_ptr ans_node, char *str, int str_index, int *
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
arity[arity[0]]++;
|
||||
if (arity[arity[0]] == 0) {
|
||||
if (arity[arity[0]] == -2) {
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
str_index += sprintf(& str[str_index], ",");
|
||||
#else
|
||||
str_index += sprintf(& str[str_index], "|");
|
||||
arity[arity[0]] = -1;
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
break;
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "]");
|
||||
arity[0]--;
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "|");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1690,13 +1838,17 @@ void traverse_answer_trie(ans_node_ptr ans_node, char *str, int str_index, int *
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
arity[arity[0]]++;
|
||||
if (arity[arity[0]] == 0) {
|
||||
if (arity[arity[0]] == -2) {
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
str_index += sprintf(& str[str_index], ",");
|
||||
#else
|
||||
str_index += sprintf(& str[str_index], "|");
|
||||
arity[arity[0]] = -1;
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
break;
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "]");
|
||||
arity[0]--;
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "|");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1717,20 +1869,30 @@ void traverse_answer_trie(ans_node_ptr ans_node, char *str, int str_index, int *
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
arity[arity[0]]++;
|
||||
if (arity[arity[0]] == 0) {
|
||||
if (arity[arity[0]] == -2) {
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
str_index += sprintf(& str[str_index], ",");
|
||||
#else
|
||||
str_index += sprintf(& str[str_index], "|");
|
||||
arity[arity[0]] = -1;
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
break;
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "]");
|
||||
arity[0]--;
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "|");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (IsPairTerm(t)) {
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
if (t == AbsPair(PairTermLast)) {
|
||||
str[str_index - 1] = '|';
|
||||
arity[arity[0]] = -1;
|
||||
#else
|
||||
if (arity[arity[0]] == -1) {
|
||||
str[str_index - 1] = ',';
|
||||
arity[arity[0]] = -2;
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
} else {
|
||||
str_index += sprintf(& str[str_index], "[");
|
||||
arity[0]++;
|
||||
|
@ -105,7 +105,7 @@
|
||||
SET_BB(NORM_CP(YENV)); \
|
||||
copy_arity_stack()
|
||||
|
||||
#define pop_trie_node() \
|
||||
#define really_pop_trie_node() \
|
||||
YENV = (CELL *) PROTECT_FROZEN_B((B + 1)); \
|
||||
H = PROTECT_FROZEN_H(B); \
|
||||
pop_yaam_reg_cpdepth(B); \
|
||||
@ -119,6 +119,17 @@
|
||||
copy_arity_stack(); \
|
||||
}
|
||||
|
||||
#ifdef YAPOR
|
||||
#define pop_trie_node() \
|
||||
if (SCH_top_shared_cp(B)) { \
|
||||
restore_trie_node(NULL); \
|
||||
} else { \
|
||||
really_pop_trie_node(); \
|
||||
}
|
||||
#else
|
||||
#define pop_trie_node() really_pop_trie_node()
|
||||
#endif /* YAPOR */
|
||||
|
||||
|
||||
|
||||
/* ------------------- **
|
||||
@ -126,17 +137,28 @@
|
||||
** ------------------- */
|
||||
|
||||
#define stack_trie_null_instr() \
|
||||
*aux_ptr = 0; \
|
||||
*--aux_ptr = heap_arity + 1; \
|
||||
next_trie_instruction(node)
|
||||
|
||||
#define stack_trie_null_in_new_list_instr() \
|
||||
aux_ptr++; \
|
||||
Bind_Global((CELL *) *aux_ptr, AbsPair(H)); \
|
||||
H += 2; \
|
||||
*aux_ptr-- = (CELL) (H - 1); \
|
||||
*aux_ptr-- = (CELL) (H - 2); \
|
||||
*aux_ptr = heap_arity - 1 + 2; \
|
||||
YENV = aux_ptr; \
|
||||
next_trie_instruction(node)
|
||||
/*
|
||||
#define cp_trie_null_instr() \
|
||||
aux_ptr += heap_arity + subs_arity + vars_arity + 2; \
|
||||
for (i = 0; i < heap_arity + subs_arity + vars_arity + 2; i++) \
|
||||
*--YENV = *aux_ptr--; \
|
||||
*--YENV = 0; \
|
||||
*--YENV = heap_arity + 1; \
|
||||
#define stack_trie_null_in_new_list_instr() \
|
||||
aux_ptr++; \
|
||||
Bind_Global((CELL *) *aux_ptr, AbsPair(H)); \
|
||||
H += 2; \
|
||||
*aux_ptr-- = (CELL) (H - 1); \
|
||||
*aux_ptr-- = (CELL) (H - 2); \
|
||||
heap_arity = heap_arity - 1 + 2; \
|
||||
*aux_ptr = heap_arity; \
|
||||
YENV = aux_ptr; \
|
||||
\
|
||||
next_trie_instruction(node)
|
||||
*/
|
||||
|
||||
@ -168,33 +190,53 @@
|
||||
*++aux_ptr = subs_arity - 1; \
|
||||
next_instruction(subs_arity - 1, node); \
|
||||
}
|
||||
|
||||
#define stack_trie_var_in_new_list_instr() \
|
||||
RESET_VARIABLE((CELL) H); \
|
||||
*aux_ptr-- = (CELL) (H + 1); \
|
||||
*aux_ptr = heap_arity; \
|
||||
YENV = aux_ptr; \
|
||||
aux_ptr += 2; \
|
||||
Bind_Global((CELL *) *aux_ptr, AbsPair(H)); \
|
||||
for (i = 0; i < heap_arity - 1; i++) { \
|
||||
*aux_ptr = *(aux_ptr + 1); \
|
||||
aux_ptr++; \
|
||||
} \
|
||||
*aux_ptr++ = vars_arity + 1; \
|
||||
*aux_ptr++ = subs_arity; \
|
||||
for (i = 0; i < subs_arity; i++) { \
|
||||
*aux_ptr = *(aux_ptr + 1); \
|
||||
aux_ptr++; \
|
||||
} \
|
||||
*aux_ptr = (CELL) H; \
|
||||
H += 2; \
|
||||
next_trie_instruction(node)
|
||||
/*
|
||||
#define cp_trie_var_instr() \
|
||||
if (heap_arity) { \
|
||||
#define stack_trie_var_in_new_list_instr() \
|
||||
aux_ptr++; \
|
||||
Bind_Global((CELL *) *aux_ptr, AbsPair(H)); \
|
||||
H += 2; \
|
||||
*aux_ptr-- = (CELL) (H - 1); \
|
||||
*aux_ptr-- = (CELL) (H - 2); \
|
||||
heap_arity = heap_arity - 1 + 2; \
|
||||
*aux_ptr = heap_arity; \
|
||||
YENV = aux_ptr; \
|
||||
\
|
||||
*aux_ptr = heap_arity - 1; \
|
||||
var_ptr = *++aux_ptr; \
|
||||
RESET_VARIABLE(var_ptr); \
|
||||
aux_ptr += heap_arity + subs_arity + vars_arity + 1; \
|
||||
for (i = 0; i < vars_arity; i++) \
|
||||
*--YENV = *aux_ptr--; \
|
||||
*--YENV = var_ptr; \
|
||||
for (i = 0; i < subs_arity; i++) \
|
||||
*--YENV = *aux_ptr--; \
|
||||
*--YENV = subs_arity; \
|
||||
*--YENV = vars_arity + 1; \
|
||||
aux_ptr--; \
|
||||
for (i = 1; i < heap_arity; i++) \
|
||||
*--YENV = *--aux_ptr; \
|
||||
*--YENV = heap_arity - 1; \
|
||||
next_instruction(heap_arity - 1 || subs_arity, node); \
|
||||
} else { \
|
||||
aux_ptr += 2 + subs_arity + vars_arity; \
|
||||
for (i = 0; i < subs_arity + vars_arity; i++) \
|
||||
*--YENV = *aux_ptr--; \
|
||||
*--YENV = subs_arity - 1; \
|
||||
*--YENV = vars_arity + 1; \
|
||||
*--YENV = 0; \
|
||||
next_instruction(subs_arity - 1, node); \
|
||||
}
|
||||
for (i = 0; i < heap_arity - 1; i++) { \
|
||||
*aux_ptr = *(aux_ptr + 1); \
|
||||
aux_ptr++; \
|
||||
} \
|
||||
*aux_ptr++ = vars_arity + 1; \
|
||||
*aux_ptr++ = subs_arity; \
|
||||
for (i = 0; i < subs_arity; i++) { \
|
||||
*aux_ptr = *(aux_ptr + 1); \
|
||||
aux_ptr++; \
|
||||
} \
|
||||
*aux_ptr = var_ptr; \
|
||||
next_instruction(heap_arity - 1 || subs_arity, node)
|
||||
*/
|
||||
|
||||
|
||||
@ -251,10 +293,35 @@
|
||||
} \
|
||||
next_instruction(subs_arity - 1, node); \
|
||||
}
|
||||
/*
|
||||
#define cp_trie_val_instr() \
|
||||
if (heap_arity) { \
|
||||
|
||||
#define stack_trie_val_in_new_list_instr() \
|
||||
aux_ptr++; \
|
||||
Bind_Global((CELL *) *aux_ptr, AbsPair(H)); \
|
||||
H += 2; \
|
||||
*aux_ptr = (CELL) (H - 1); \
|
||||
aux = (CELL) (H - 2); \
|
||||
subs_ptr = aux_ptr + heap_arity + 1 + subs_arity + vars_arity - var_index; \
|
||||
subs = *subs_ptr; \
|
||||
if (aux > subs) { \
|
||||
Bind_Global((CELL *) aux, subs); \
|
||||
} else { \
|
||||
RESET_VARIABLE(aux); \
|
||||
Bind_Local((CELL *) subs, aux); \
|
||||
*subs_ptr = aux; \
|
||||
} \
|
||||
next_trie_instruction(node)
|
||||
/*
|
||||
#define stack_trie_val_in_new_list_instr() \
|
||||
aux_ptr++; \
|
||||
Bind_Global((CELL *) *aux_ptr, AbsPair(H)); \
|
||||
H += 2; \
|
||||
*aux_ptr-- = (CELL) (H - 1); \
|
||||
*aux_ptr-- = (CELL) (H - 2); \
|
||||
heap_arity = heap_arity - 1 + 2; \
|
||||
*aux_ptr = heap_arity; \
|
||||
YENV = aux_ptr; \
|
||||
\
|
||||
YENV = ++aux_ptr; \
|
||||
subs_ptr = aux_ptr + heap_arity + 1 + subs_arity + vars_arity - var_index; \
|
||||
aux = *aux_ptr; \
|
||||
subs = *subs_ptr; \
|
||||
@ -265,46 +332,8 @@
|
||||
Bind_Local((CELL *) subs, aux); \
|
||||
*subs_ptr = aux; \
|
||||
} \
|
||||
aux_ptr += heap_arity + subs_arity + vars_arity + 1; \
|
||||
for (i = 0; i < heap_arity + subs_arity + vars_arity + 1; i++) \
|
||||
*--YENV = *aux_ptr--; \
|
||||
*--YENV = heap_arity - 1; \
|
||||
next_instruction(heap_arity - 1 || subs_arity, node); \
|
||||
} else { \
|
||||
aux_ptr += 2 + subs_arity; \
|
||||
subs_ptr = aux_ptr + vars_arity - var_index; \
|
||||
aux = *aux_ptr; \
|
||||
subs = *subs_ptr; \
|
||||
if (aux > subs) { \
|
||||
if ((CELL *) aux <= H) { \
|
||||
Bind_Global((CELL *) aux, subs); \
|
||||
} else if ((CELL *) subs <= H) { \
|
||||
Bind_Local((CELL *) aux, subs); \
|
||||
} else { \
|
||||
Bind_Local((CELL *) subs, aux); \
|
||||
*subs_ptr = aux; \
|
||||
} \
|
||||
} else { \
|
||||
if ((CELL *) subs <= H) { \
|
||||
Bind_Global((CELL *) subs, aux); \
|
||||
*subs_ptr = aux; \
|
||||
} else if ((CELL *) aux <= H) { \
|
||||
Bind_Local((CELL *) subs, aux); \
|
||||
*subs_ptr = aux; \
|
||||
} else { \
|
||||
Bind_Local((CELL *) aux, subs); \
|
||||
} \
|
||||
} \
|
||||
aux_ptr += vars_arity; \
|
||||
for (i = 0; i < vars_arity; i++) \
|
||||
*--YENV = *aux_ptr--; \
|
||||
for (i = 1; i < subs_arity; i++) \
|
||||
*--YENV = *--aux_ptr; \
|
||||
*--YENV = subs_arity - 1; \
|
||||
*--YENV = vars_arity; \
|
||||
*--YENV = 0; \
|
||||
next_instruction(subs_arity - 1, node); \
|
||||
}
|
||||
*aux_ptr = heap_arity - 1; \
|
||||
next_instruction(heap_arity - 1 || subs_arity, node)
|
||||
*/
|
||||
|
||||
|
||||
@ -330,29 +359,29 @@
|
||||
} \
|
||||
next_instruction(subs_arity - 1, node); \
|
||||
}
|
||||
/*
|
||||
#define cp_trie_atom_instr() \
|
||||
if (heap_arity) { \
|
||||
|
||||
#define stack_trie_atom_in_new_list_instr() \
|
||||
aux_ptr++; \
|
||||
Bind_Global((CELL *) *aux_ptr, AbsPair(H)); \
|
||||
H += 2; \
|
||||
*aux_ptr = (CELL) (H - 1); \
|
||||
Bind_Global((H - 2), TrNode_entry(node)); \
|
||||
next_trie_instruction(node)
|
||||
/*
|
||||
#define stack_trie_atom_in_new_list_instr() \
|
||||
aux_ptr++; \
|
||||
Bind_Global((CELL *) *aux_ptr, AbsPair(H)); \
|
||||
H += 2; \
|
||||
*aux_ptr-- = (CELL) (H - 1); \
|
||||
*aux_ptr-- = (CELL) (H - 2); \
|
||||
heap_arity = heap_arity - 1 + 2; \
|
||||
*aux_ptr = heap_arity; \
|
||||
YENV = aux_ptr; \
|
||||
\
|
||||
YENV = ++aux_ptr; \
|
||||
Bind_Global((CELL *) *aux_ptr, TrNode_entry(node)); \
|
||||
aux_ptr += heap_arity + subs_arity + vars_arity + 1; \
|
||||
for (i = 0; i < heap_arity + subs_arity + vars_arity + 1; i++) \
|
||||
*--YENV = *aux_ptr--; \
|
||||
*--YENV = heap_arity - 1; \
|
||||
next_instruction(heap_arity - 1 || subs_arity, node); \
|
||||
} else { \
|
||||
aux_ptr += 2 + subs_arity; \
|
||||
Bind((CELL *) *aux_ptr, TrNode_entry(node)); \
|
||||
aux_ptr += vars_arity; \
|
||||
for (i = 0; i < vars_arity; i++) \
|
||||
*--YENV = *aux_ptr--; \
|
||||
for (i = 1; i < subs_arity; i++) \
|
||||
*--YENV = *--aux_ptr; \
|
||||
*--YENV = subs_arity - 1; \
|
||||
*--YENV = vars_arity; \
|
||||
*--YENV = 0; \
|
||||
next_instruction(subs_arity - 1, node); \
|
||||
}
|
||||
*aux_ptr = heap_arity - 1; \
|
||||
next_instruction(heap_arity - 1 || subs_arity, node)
|
||||
*/
|
||||
|
||||
|
||||
@ -386,33 +415,37 @@
|
||||
} \
|
||||
} \
|
||||
next_trie_instruction(node)
|
||||
/*
|
||||
#define cp_trie_list_instr() \
|
||||
if (heap_arity) { \
|
||||
|
||||
#define stack_trie_list_in_new_list_instr() \
|
||||
aux_ptr++; \
|
||||
Bind_Global((CELL *) *aux_ptr, AbsPair(H)); \
|
||||
aux_ptr += heap_arity + subs_arity + vars_arity + 1; \
|
||||
for (i = 0; i < vars_arity + subs_arity + heap_arity + 1; i++) \
|
||||
*--YENV = *aux_ptr--; \
|
||||
H += 2; \
|
||||
*--YENV = (CELL) (H - 1); \
|
||||
*--YENV = (CELL) (H - 2); \
|
||||
*--YENV = heap_arity + 1; \
|
||||
} else { \
|
||||
aux_ptr += 2 + subs_arity; \
|
||||
Bind((CELL *) *aux_ptr, AbsPair(H)); \
|
||||
aux_ptr += vars_arity; \
|
||||
for (i = 0; i < vars_arity; i++) \
|
||||
*--YENV = *aux_ptr--; \
|
||||
for (i = 1; i < subs_arity; i++) \
|
||||
*--YENV = *--aux_ptr; \
|
||||
*--YENV = subs_arity - 1; \
|
||||
*--YENV = vars_arity; \
|
||||
*aux_ptr-- = (CELL) (H - 1); \
|
||||
Bind_Global((H - 2), AbsPair(H)); \
|
||||
H += 2; \
|
||||
*--YENV = (CELL) (H - 1); \
|
||||
*--YENV = (CELL) (H - 2); \
|
||||
*--YENV = 2; \
|
||||
} \
|
||||
*aux_ptr-- = (CELL) (H - 1); \
|
||||
*aux_ptr-- = (CELL) (H - 2); \
|
||||
*aux_ptr = heap_arity - 1 + 1 + 2; \
|
||||
YENV = aux_ptr; \
|
||||
next_trie_instruction(node)
|
||||
/*
|
||||
#define stack_trie_list_in_new_list_instr() \
|
||||
aux_ptr++; \
|
||||
Bind_Global((CELL *) *aux_ptr, AbsPair(H)); \
|
||||
H += 2; \
|
||||
*aux_ptr-- = (CELL) (H - 1); \
|
||||
*aux_ptr-- = (CELL) (H - 2); \
|
||||
heap_arity = heap_arity - 1 + 2; \
|
||||
*aux_ptr = heap_arity; \
|
||||
YENV = aux_ptr; \
|
||||
\
|
||||
aux_ptr++; \
|
||||
Bind_Global((CELL *) *aux_ptr, AbsPair(H)); \
|
||||
H += 2; \
|
||||
*aux_ptr-- = (CELL) (H - 1); \
|
||||
*aux_ptr-- = (CELL) (H - 2); \
|
||||
*aux_ptr = heap_arity - 1 + 2; \
|
||||
YENV = aux_ptr; \
|
||||
next_trie_instruction(node)
|
||||
*/
|
||||
|
||||
@ -449,35 +482,39 @@
|
||||
} \
|
||||
} \
|
||||
next_trie_instruction(node)
|
||||
|
||||
#define stack_trie_struct_in_new_list_instr() \
|
||||
aux_ptr++; \
|
||||
Bind_Global((CELL *) *aux_ptr, AbsPair(H)); \
|
||||
H += 2; \
|
||||
*aux_ptr-- = (CELL) (H - 1); \
|
||||
Bind_Global((H - 2), AbsAppl(H)); \
|
||||
*H++ = (CELL) func; \
|
||||
H += func_arity; \
|
||||
for (i = 1; i <= func_arity; i++) \
|
||||
*aux_ptr-- = (CELL) (H - i); \
|
||||
*aux_ptr = heap_arity - 1 + 1 + func_arity; \
|
||||
YENV = aux_ptr; \
|
||||
next_trie_instruction(node)
|
||||
/*
|
||||
#define cp_trie_struct_instr() \
|
||||
if (heap_arity) { \
|
||||
#define stack_trie_struct_in_new_list_instr() \
|
||||
aux_ptr++; \
|
||||
Bind_Global((CELL *) *aux_ptr, AbsPair(H)); \
|
||||
H += 2; \
|
||||
*aux_ptr-- = (CELL) (H - 1); \
|
||||
*aux_ptr-- = (CELL) (H - 2); \
|
||||
heap_arity = heap_arity - 1 + 2; \
|
||||
*aux_ptr = heap_arity; \
|
||||
YENV = aux_ptr; \
|
||||
\
|
||||
aux_ptr++; \
|
||||
Bind_Global((CELL *) *aux_ptr, AbsAppl(H)); \
|
||||
aux_ptr += heap_arity + subs_arity + vars_arity + 1; \
|
||||
for (i = 0; i < vars_arity + subs_arity + heap_arity + 1; i++) \
|
||||
*--YENV = *aux_ptr--; \
|
||||
*H++ = (CELL) func; \
|
||||
H += func_arity; \
|
||||
for (i = 1; i <= func_arity; i++) \
|
||||
*--YENV = (CELL) (H - i); \
|
||||
*--YENV = heap_arity + func_arity - 1; \
|
||||
} else { \
|
||||
aux_ptr += 2 + subs_arity; \
|
||||
Bind((CELL *) *aux_ptr, AbsAppl(H)); \
|
||||
aux_ptr += vars_arity; \
|
||||
for (i = 0; i < vars_arity; i++) \
|
||||
*--YENV = *aux_ptr--; \
|
||||
for (i = 1; i < subs_arity; i++) \
|
||||
*--YENV = *--aux_ptr; \
|
||||
*--YENV = subs_arity - 1; \
|
||||
*--YENV = vars_arity; \
|
||||
*H++ = (CELL) func; \
|
||||
H += func_arity; \
|
||||
for (i = 1; i <= func_arity; i++) \
|
||||
*--YENV = (CELL) (H - i); \
|
||||
*--YENV = func_arity; \
|
||||
} \
|
||||
*aux_ptr-- = (CELL) (H - i); \
|
||||
*aux_ptr = heap_arity - 1 + func_arity; \
|
||||
YENV = aux_ptr; \
|
||||
next_trie_instruction(node)
|
||||
*/
|
||||
|
||||
@ -492,15 +529,6 @@
|
||||
*--aux_ptr = heap_arity + 1; \
|
||||
YENV = aux_ptr; \
|
||||
next_trie_instruction(node)
|
||||
/*
|
||||
#define cp_trie_extension_instr() \
|
||||
aux_ptr += heap_arity + subs_arity + vars_arity + 2; \
|
||||
for (i = 0; i < heap_arity + subs_arity + vars_arity + 2; i++) \
|
||||
*--YENV = *aux_ptr--; \
|
||||
*--YENV = TrNode_entry(node); \
|
||||
*--YENV = heap_arity + 1; \
|
||||
next_trie_instruction(node)
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@ -510,13 +538,12 @@
|
||||
|
||||
#define stack_trie_float_longint_instr() \
|
||||
if (heap_arity) { \
|
||||
aux_ptr++; \
|
||||
YENV = ++aux_ptr; \
|
||||
Bind_Global((CELL *) *aux_ptr, t); \
|
||||
*aux_ptr = heap_arity - 1; \
|
||||
next_instruction(heap_arity - 1 || subs_arity, node); \
|
||||
} else { \
|
||||
YENV = ++aux_ptr; \
|
||||
YENV = aux_ptr; \
|
||||
*aux_ptr = 0; \
|
||||
aux_ptr += 2; \
|
||||
*aux_ptr = subs_arity - 1; \
|
||||
@ -527,7 +554,7 @@
|
||||
aux_ptr++; \
|
||||
} \
|
||||
next_instruction(subs_arity - 1, node); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -537,8 +564,6 @@
|
||||
|
||||
PBOp(trie_do_null, e)
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = YENV;
|
||||
int heap_arity = *aux_ptr;
|
||||
|
||||
stack_trie_null_instr();
|
||||
ENDPBOp();
|
||||
@ -551,14 +576,7 @@
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
|
||||
#ifdef YAPOR
|
||||
if (SCH_top_shared_cp(B)) {
|
||||
restore_trie_node(NULL);
|
||||
} else
|
||||
#endif /* YAPOR */
|
||||
{
|
||||
pop_trie_node();
|
||||
}
|
||||
stack_trie_null_instr();
|
||||
ENDPBOp();
|
||||
|
||||
@ -587,6 +605,67 @@
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_do_null_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = YENV;
|
||||
int heap_arity = *aux_ptr;
|
||||
|
||||
stack_trie_null_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_do_null_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_trust_null_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = (CELL *) (B + 1);
|
||||
int heap_arity = *aux_ptr;
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
|
||||
pop_trie_node();
|
||||
stack_trie_null_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_trust_null_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_try_null_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = YENV;
|
||||
int heap_arity = *aux_ptr;
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
|
||||
store_trie_node(TrNode_next(node));
|
||||
stack_trie_null_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_try_null_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_retry_null_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = (CELL *) (B + 1);
|
||||
int heap_arity = *aux_ptr;
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
|
||||
restore_trie_node(TrNode_next(node));
|
||||
stack_trie_null_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_retry_null_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_do_var, e)
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = YENV;
|
||||
@ -609,14 +688,7 @@
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
int i;
|
||||
|
||||
#ifdef YAPOR
|
||||
if (SCH_top_shared_cp(B)) {
|
||||
restore_trie_node(NULL);
|
||||
} else
|
||||
#endif /* YAPOR */
|
||||
{
|
||||
pop_trie_node();
|
||||
}
|
||||
stack_trie_var_instr();
|
||||
ENDPBOp();
|
||||
|
||||
@ -649,6 +721,73 @@
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_do_var_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = YENV;
|
||||
int heap_arity = *aux_ptr;
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
int i;
|
||||
|
||||
stack_trie_var_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_do_var_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_trust_var_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = (CELL *) (B + 1);
|
||||
int heap_arity = *aux_ptr;
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
int i;
|
||||
|
||||
pop_trie_node();
|
||||
stack_trie_var_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_trust_var_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_try_var_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = YENV;
|
||||
int heap_arity = *aux_ptr;
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
int i;
|
||||
|
||||
store_trie_node(TrNode_next(node));
|
||||
stack_trie_var_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_try_var_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_retry_var_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = (CELL *) (B + 1);
|
||||
int heap_arity = *aux_ptr;
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
int i;
|
||||
|
||||
restore_trie_node(TrNode_next(node));
|
||||
stack_trie_var_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_try_var_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_do_val, e)
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = YENV, *subs_ptr;
|
||||
@ -673,14 +812,7 @@
|
||||
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
||||
int i;
|
||||
|
||||
#ifdef YAPOR
|
||||
if (SCH_top_shared_cp(B)) {
|
||||
restore_trie_node(NULL);
|
||||
} else
|
||||
#endif /* YAPOR */
|
||||
{
|
||||
pop_trie_node();
|
||||
}
|
||||
stack_trie_val_instr();
|
||||
ENDPBOp();
|
||||
|
||||
@ -715,6 +847,77 @@
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_do_val_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = YENV, *subs_ptr;
|
||||
register CELL aux, subs;
|
||||
int heap_arity = *aux_ptr;
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
||||
|
||||
stack_trie_val_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_do_val_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_trust_val_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = (CELL *) (B + 1), *subs_ptr;
|
||||
register CELL aux, subs;
|
||||
int heap_arity = *aux_ptr;
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
||||
|
||||
pop_trie_node();
|
||||
stack_trie_val_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_trust_val_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_try_val_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = YENV, *subs_ptr;
|
||||
register CELL aux, subs;
|
||||
int heap_arity = *aux_ptr;
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
||||
|
||||
store_trie_node(TrNode_next(node));
|
||||
stack_trie_val_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_try_val_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_retry_val_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = (CELL *) (B + 1), *subs_ptr;
|
||||
register CELL aux, subs;
|
||||
int heap_arity = *aux_ptr;
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
||||
|
||||
restore_trie_node(TrNode_next(node));
|
||||
stack_trie_val_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_retry_val_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_do_atom, e)
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = YENV;
|
||||
@ -735,14 +938,7 @@
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
int i;
|
||||
|
||||
#ifdef YAPOR
|
||||
if (SCH_top_shared_cp(B)) {
|
||||
restore_trie_node(NULL);
|
||||
} else
|
||||
#endif /* YAPOR */
|
||||
{
|
||||
pop_trie_node();
|
||||
}
|
||||
stack_trie_atom_instr();
|
||||
ENDPBOp();
|
||||
|
||||
@ -773,6 +969,66 @@
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_do_atom_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = YENV;
|
||||
|
||||
stack_trie_atom_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_do_atom_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_trust_atom_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = (CELL *) (B + 1);
|
||||
int heap_arity = *aux_ptr;
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
|
||||
pop_trie_node();
|
||||
stack_trie_atom_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_trust_atom_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_try_atom_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = YENV;
|
||||
int heap_arity = *aux_ptr;
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
|
||||
store_trie_node(TrNode_next(node));
|
||||
stack_trie_atom_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_try_atom_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_retry_atom_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = (CELL *) (B + 1);
|
||||
int heap_arity = *aux_ptr;
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
|
||||
restore_trie_node(TrNode_next(node));
|
||||
stack_trie_atom_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_retry_atom_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_do_list, e)
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = YENV;
|
||||
@ -793,14 +1049,7 @@
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
int i;
|
||||
|
||||
#ifdef YAPOR
|
||||
if (SCH_top_shared_cp(B)) {
|
||||
restore_trie_node(NULL);
|
||||
} else
|
||||
#endif /* YAPOR */
|
||||
{
|
||||
pop_trie_node();
|
||||
}
|
||||
stack_trie_list_instr();
|
||||
ENDPBOp();
|
||||
|
||||
@ -831,6 +1080,67 @@
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_do_list_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = YENV;
|
||||
int heap_arity = *aux_ptr;
|
||||
|
||||
stack_trie_list_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_do_list_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_trust_list_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = (CELL *) (B + 1);
|
||||
int heap_arity = *aux_ptr;
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
|
||||
pop_trie_node();
|
||||
stack_trie_list_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_trust_list_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_try_list_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = YENV;
|
||||
int heap_arity = *aux_ptr;
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
|
||||
store_trie_node(TrNode_next(node));
|
||||
stack_trie_list_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_try_list_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_retry_list_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = (CELL *) (B + 1);
|
||||
int heap_arity = *aux_ptr;
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
|
||||
restore_trie_node(TrNode_next(node));
|
||||
stack_trie_list_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_retry_list_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_do_struct, e)
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = YENV;
|
||||
@ -855,14 +1165,7 @@
|
||||
int func_arity = ArityOfFunctor(func);
|
||||
int i;
|
||||
|
||||
#ifdef YAPOR
|
||||
if (SCH_top_shared_cp(B)) {
|
||||
restore_trie_node(NULL);
|
||||
} else
|
||||
#endif /* YAPOR */
|
||||
{
|
||||
pop_trie_node();
|
||||
}
|
||||
stack_trie_struct_instr();
|
||||
ENDPBOp();
|
||||
|
||||
@ -897,6 +1200,79 @@
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_do_struct_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = YENV;
|
||||
int heap_arity = *aux_ptr;
|
||||
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
||||
int func_arity = ArityOfFunctor(func);
|
||||
int i;
|
||||
|
||||
stack_trie_struct_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_do_struct_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_trust_struct_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = (CELL *) (B + 1);
|
||||
int heap_arity = *aux_ptr;
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
||||
int func_arity = ArityOfFunctor(func);
|
||||
int i;
|
||||
|
||||
pop_trie_node();
|
||||
stack_trie_struct_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_trust_struct_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_try_struct_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = YENV;
|
||||
int heap_arity = *aux_ptr;
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
||||
int func_arity = ArityOfFunctor(func);
|
||||
int i;
|
||||
|
||||
store_trie_node(TrNode_next(node));
|
||||
stack_trie_struct_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_try_struct_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_retry_struct_in_new_list, e)
|
||||
#ifdef TRIE_COMPACT_LISTS
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = (CELL *) (B + 1);
|
||||
int heap_arity = *aux_ptr;
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
||||
int func_arity = ArityOfFunctor(func);
|
||||
int i;
|
||||
|
||||
restore_trie_node(TrNode_next(node));
|
||||
stack_trie_struct_in_new_list_instr();
|
||||
#else
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_retry_struct_in_new_list)");
|
||||
#endif /* TRIE_COMPACT_LISTS */
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(trie_do_extension, e)
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_ptr = YENV;
|
||||
@ -913,14 +1289,7 @@
|
||||
int vars_arity = *(aux_ptr + heap_arity + 1);
|
||||
int subs_arity = *(aux_ptr + heap_arity + 2);
|
||||
|
||||
#ifdef YAPOR
|
||||
if (SCH_top_shared_cp(B)) {
|
||||
restore_trie_node(NULL);
|
||||
} else
|
||||
#endif /* YAPOR */
|
||||
{
|
||||
pop_trie_node();
|
||||
}
|
||||
stack_trie_extension_instr();
|
||||
ENDPBOp();
|
||||
|
||||
@ -963,10 +1332,10 @@
|
||||
#if SIZEOF_DOUBLE == 2 * SIZEOF_INT_P
|
||||
*t_dbl = *++aux_ptr;
|
||||
*(t_dbl + 1) = *++aux_ptr;
|
||||
heap_arity -= 3;
|
||||
heap_arity -= 2;
|
||||
#else /* SIZEOF_DOUBLE == SIZEOF_INT_P */
|
||||
*t_dbl = *++aux_ptr;
|
||||
heap_arity -= 2;
|
||||
heap_arity -= 1;
|
||||
#endif /* SIZEOF_DOUBLE x SIZEOF_INT_P */
|
||||
t = MkFloatTerm(dbl);
|
||||
stack_trie_float_longint_instr();
|
||||
@ -997,7 +1366,7 @@
|
||||
int i;
|
||||
Term t = MkLongIntTerm(*++aux_ptr);
|
||||
|
||||
heap_arity -= 2;
|
||||
heap_arity -= 1;
|
||||
stack_trie_float_longint_instr();
|
||||
ENDPBOp();
|
||||
|
||||
|
Reference in New Issue
Block a user