2005-05-31 09:19:31 +01:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
The OPTYap Prolog system
|
|
|
|
OPTYap extends the Yap Prolog system to support or-parallel tabling
|
|
|
|
|
|
|
|
Copyright: R. Rocha and NCC - University of Porto, Portugal
|
|
|
|
File: tab.tries.insts.i
|
2007-04-26 15:13:21 +01:00
|
|
|
version: $Id: tab.tries.insts.i,v 1.12 2007-04-26 14:11:08 ricroc Exp $
|
2005-05-31 09:19:31 +01:00
|
|
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
/* ----------------------------------------------- **
|
|
|
|
** Trie instructions: stack organization **
|
2005-06-03 19:28:11 +01:00
|
|
|
** ----------------------------------------------- **
|
|
|
|
-------------------
|
|
|
|
| ha = heap_arity |
|
|
|
|
------------------- --
|
|
|
|
| heap ptr 1 | |
|
|
|
|
------------------- |
|
|
|
|
| ... | -- heap_arity
|
|
|
|
------------------- |
|
|
|
|
| heap ptr ha | |
|
|
|
|
------------------- --
|
|
|
|
| va = vars_arity |
|
|
|
|
-------------------
|
|
|
|
| sa = subs_arity |
|
|
|
|
------------------- --
|
|
|
|
| subs ptr sa | |
|
|
|
|
------------------- |
|
|
|
|
| ... | -- subs_arity
|
2005-07-06 20:34:12 +01:00
|
|
|
------------------- |
|
2005-06-03 19:28:11 +01:00
|
|
|
| subs ptr 1 | |
|
|
|
|
------------------- --
|
|
|
|
| var ptr va | |
|
|
|
|
------------------- |
|
|
|
|
| ... | -- vars_arity
|
|
|
|
------------------- |
|
|
|
|
| var ptr 1 | |
|
|
|
|
------------------- --
|
2001-04-09 20:54:03 +01:00
|
|
|
** ----------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* --------------------------------------------- **
|
|
|
|
** Trie instructions: auxiliary macros **
|
|
|
|
** --------------------------------------------- */
|
|
|
|
|
2009-06-17 17:14:16 +01:00
|
|
|
#define copy_arity_stack() \
|
|
|
|
{ int size = heap_arity + subs_arity + vars_arity + 3; \
|
|
|
|
YENV -= size; \
|
|
|
|
memcpy(YENV, aux_ptr, size * sizeof(CELL *)); \
|
|
|
|
aux_ptr = YENV; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define next_trie_instruction(NODE) \
|
|
|
|
PREG = (yamop *) TrNode_child(NODE); \
|
|
|
|
PREFETCH_OP(PREG); \
|
2001-04-09 20:54:03 +01:00
|
|
|
GONext()
|
|
|
|
|
2009-06-17 17:14:16 +01:00
|
|
|
#define next_instruction(CONDITION, NODE) \
|
|
|
|
if (CONDITION) { \
|
|
|
|
PREG = (yamop *) TrNode_child(NODE); \
|
|
|
|
} else { \
|
|
|
|
/* procceed */ \
|
|
|
|
PREG = (yamop *) CPREG; \
|
|
|
|
YENV = ENV; \
|
|
|
|
} \
|
|
|
|
PREFETCH_OP(PREG); \
|
2001-04-09 20:54:03 +01:00
|
|
|
GONext()
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-07-06 20:34:12 +01:00
|
|
|
/* ---------------------------------------------------------------------------- **
|
|
|
|
** the 'store_trie_node', 'restore_trie_node' and 'pop_trie_node' macros do not **
|
|
|
|
** include the 'set_cut' macro because there are no cuts in trie instructions. **
|
|
|
|
** ---------------------------------------------------------------------------- */
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2005-07-06 20:34:12 +01:00
|
|
|
#define store_trie_node(AP) \
|
2005-06-03 09:19:18 +01:00
|
|
|
{ register choiceptr cp; \
|
|
|
|
YENV = (CELL *) (NORM_CP(YENV) - 1); \
|
|
|
|
cp = NORM_CP(YENV); \
|
|
|
|
HBREG = H; \
|
|
|
|
store_yaam_reg_cpdepth(cp); \
|
|
|
|
cp->cp_tr = TR; \
|
|
|
|
cp->cp_h = H; \
|
|
|
|
cp->cp_b = B; \
|
|
|
|
cp->cp_cp = CPREG; \
|
|
|
|
cp->cp_ap = (yamop *) AP; \
|
|
|
|
cp->cp_env= ENV; \
|
|
|
|
B = cp; \
|
|
|
|
YAPOR_SET_LOAD(B); \
|
|
|
|
SET_BB(B); \
|
2005-07-06 20:34:12 +01:00
|
|
|
TABLING_ERRORS_check_stack; \
|
2009-06-17 17:14:16 +01:00
|
|
|
} \
|
|
|
|
copy_arity_stack()
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2005-07-06 20:34:12 +01:00
|
|
|
#define restore_trie_node(AP) \
|
2001-04-09 20:54:03 +01:00
|
|
|
H = HBREG = PROTECT_FROZEN_H(B); \
|
2005-04-07 18:56:58 +01:00
|
|
|
restore_yaam_reg_cpdepth(B); \
|
2001-04-09 20:54:03 +01:00
|
|
|
CPREG = B->cp_cp; \
|
|
|
|
ENV = B->cp_env; \
|
|
|
|
YAPOR_update_alternative(PREG, (yamop *) AP) \
|
|
|
|
B->cp_ap = (yamop *) AP; \
|
2002-11-26 22:19:48 +00:00
|
|
|
YENV = (CELL *) PROTECT_FROZEN_B(B); \
|
2009-06-17 17:14:16 +01:00
|
|
|
SET_BB(NORM_CP(YENV)); \
|
|
|
|
copy_arity_stack()
|
2002-11-26 22:19:48 +00:00
|
|
|
|
2009-06-24 20:04:16 +01:00
|
|
|
#define really_pop_trie_node() \
|
2009-06-17 17:14:16 +01:00
|
|
|
YENV = (CELL *) PROTECT_FROZEN_B((B + 1)); \
|
2005-06-03 09:19:18 +01:00
|
|
|
H = PROTECT_FROZEN_H(B); \
|
|
|
|
pop_yaam_reg_cpdepth(B); \
|
|
|
|
CPREG = B->cp_cp; \
|
2009-06-17 17:14:16 +01:00
|
|
|
TABLING_close_alt(B); \
|
2005-06-03 09:19:18 +01:00
|
|
|
ENV = B->cp_env; \
|
2009-06-17 17:14:16 +01:00
|
|
|
B = B->cp_b; \
|
2005-06-03 09:19:18 +01:00
|
|
|
HBREG = PROTECT_FROZEN_H(B); \
|
2009-06-17 17:14:16 +01:00
|
|
|
SET_BB(PROTECT_FROZEN_B(B)); \
|
|
|
|
if ((choiceptr) YENV == B_FZ) { \
|
|
|
|
copy_arity_stack(); \
|
|
|
|
}
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2009-06-24 20:04:16 +01:00
|
|
|
#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 */
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
|
2005-07-06 20:34:12 +01:00
|
|
|
/* ------------------- **
|
|
|
|
** trie_null **
|
|
|
|
** ------------------- */
|
2005-06-03 09:19:18 +01:00
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
#define stack_trie_null_instr() \
|
2009-06-24 20:04:16 +01:00
|
|
|
next_trie_instruction(node)
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
|
|
|
/* trie compiled code for term 'CompactPairInit' */
|
|
|
|
#define stack_trie_null_in_new_pair_instr() \
|
|
|
|
if (heap_arity) { \
|
|
|
|
aux_ptr++; \
|
|
|
|
Bind_Global((CELL *) *aux_ptr, AbsPair(H)); \
|
|
|
|
*aux_ptr-- = (CELL) (H + 1); \
|
|
|
|
*aux_ptr-- = (CELL) H; \
|
|
|
|
*aux_ptr = heap_arity - 1 + 2; \
|
|
|
|
YENV = aux_ptr; \
|
|
|
|
} else { \
|
|
|
|
int i; \
|
|
|
|
*aux_ptr-- = (CELL) (H + 1); \
|
|
|
|
*aux_ptr-- = (CELL) H; \
|
|
|
|
*aux_ptr = 2; \
|
|
|
|
YENV = aux_ptr; \
|
|
|
|
aux_ptr += 2 + 2; \
|
|
|
|
*aux_ptr = subs_arity - 1; \
|
|
|
|
aux_ptr += subs_arity; \
|
|
|
|
Bind((CELL *) *aux_ptr, AbsPair(H)); \
|
|
|
|
for (i = 0; i < vars_arity; i++) { \
|
|
|
|
*aux_ptr = *(aux_ptr + 1); \
|
|
|
|
aux_ptr++; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
H += 2; \
|
2005-06-03 09:19:18 +01:00
|
|
|
next_trie_instruction(node)
|
2009-07-05 05:14:08 +01:00
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2005-06-03 09:19:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ------------------ **
|
|
|
|
** trie_var **
|
|
|
|
** ------------------ */
|
|
|
|
|
2009-06-17 17:14:16 +01:00
|
|
|
#define stack_trie_var_instr() \
|
2005-06-03 09:19:18 +01:00
|
|
|
if (heap_arity) { \
|
2009-07-05 05:14:08 +01:00
|
|
|
CELL var; \
|
|
|
|
int i; \
|
2005-06-03 09:19:18 +01:00
|
|
|
*aux_ptr = heap_arity - 1; \
|
2009-07-05 05:14:08 +01:00
|
|
|
var = *++aux_ptr; \
|
|
|
|
RESET_VARIABLE(var); \
|
2005-06-03 09:19:18 +01:00
|
|
|
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++; \
|
|
|
|
} \
|
2009-07-05 05:14:08 +01:00
|
|
|
*aux_ptr = var; \
|
2005-06-03 09:19:18 +01:00
|
|
|
next_instruction(heap_arity - 1 || subs_arity, node); \
|
|
|
|
} else { \
|
|
|
|
*++aux_ptr = vars_arity + 1; \
|
|
|
|
*++aux_ptr = subs_arity - 1; \
|
|
|
|
next_instruction(subs_arity - 1, node); \
|
|
|
|
}
|
2009-06-24 20:04:16 +01:00
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
|
|
|
#define stack_trie_var_in_new_pair_instr() \
|
|
|
|
if (heap_arity) { \
|
|
|
|
int i; \
|
|
|
|
*aux_ptr-- = (CELL) (H + 1); \
|
|
|
|
*aux_ptr = heap_arity - 1 + 1; \
|
|
|
|
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; \
|
|
|
|
} else { \
|
|
|
|
*aux_ptr-- = (CELL) (H + 1); \
|
|
|
|
*aux_ptr = 1; \
|
|
|
|
YENV = aux_ptr; \
|
|
|
|
aux_ptr += 2; \
|
|
|
|
*aux_ptr++ = vars_arity + 1; \
|
|
|
|
*aux_ptr = subs_arity - 1; \
|
|
|
|
aux_ptr += subs_arity; \
|
|
|
|
Bind((CELL *) *aux_ptr, AbsPair(H)); \
|
|
|
|
*aux_ptr = (CELL) H; \
|
2009-06-24 20:04:16 +01:00
|
|
|
} \
|
2009-07-05 05:14:08 +01:00
|
|
|
RESET_VARIABLE((CELL) H); \
|
2009-06-24 20:04:16 +01:00
|
|
|
H += 2; \
|
|
|
|
next_trie_instruction(node)
|
2009-07-05 05:14:08 +01:00
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
|
2005-06-03 09:19:18 +01:00
|
|
|
|
|
|
|
/* ------------------ **
|
|
|
|
** trie_val **
|
|
|
|
** ------------------ */
|
|
|
|
|
2009-06-17 17:14:16 +01:00
|
|
|
#define stack_trie_val_instr() \
|
2001-04-09 20:54:03 +01:00
|
|
|
if (heap_arity) { \
|
2009-07-05 05:14:08 +01:00
|
|
|
CELL aux, subs, *subs_ptr; \
|
2005-06-03 09:19:18 +01:00
|
|
|
YENV = ++aux_ptr; \
|
2001-04-09 20:54:03 +01:00
|
|
|
subs_ptr = aux_ptr + heap_arity + 1 + subs_arity + vars_arity - var_index; \
|
|
|
|
aux = *aux_ptr; \
|
|
|
|
subs = *subs_ptr; \
|
|
|
|
if (aux > subs) { \
|
2005-06-03 09:19:18 +01:00
|
|
|
Bind_Global((CELL *) aux, subs); \
|
2001-04-09 20:54:03 +01:00
|
|
|
} else { \
|
2005-06-03 09:19:18 +01:00
|
|
|
RESET_VARIABLE(aux); \
|
2001-04-09 20:54:03 +01:00
|
|
|
Bind_Local((CELL *) subs, aux); \
|
|
|
|
*subs_ptr = aux; \
|
|
|
|
} \
|
|
|
|
*aux_ptr = heap_arity - 1; \
|
2005-06-03 09:19:18 +01:00
|
|
|
next_instruction(heap_arity - 1 || subs_arity, node); \
|
2001-04-09 20:54:03 +01:00
|
|
|
} else { \
|
2009-07-05 05:14:08 +01:00
|
|
|
CELL aux, subs, *subs_ptr; \
|
|
|
|
int i; \
|
2001-04-09 20:54:03 +01:00
|
|
|
aux_ptr += 2; \
|
|
|
|
*aux_ptr = subs_arity - 1; \
|
|
|
|
aux_ptr += 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); \
|
|
|
|
} \
|
|
|
|
} \
|
2005-06-03 09:19:18 +01:00
|
|
|
for (i = 0; i < vars_arity; i++) { \
|
|
|
|
*aux_ptr = *(aux_ptr + 1); \
|
|
|
|
aux_ptr++; \
|
|
|
|
} \
|
|
|
|
next_instruction(subs_arity - 1, node); \
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
2009-06-24 20:04:16 +01:00
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
|
|
|
#define stack_trie_val_in_new_pair_instr() \
|
|
|
|
if (heap_arity) { \
|
|
|
|
CELL aux, subs, *subs_ptr; \
|
|
|
|
aux_ptr++; \
|
|
|
|
Bind_Global((CELL *) *aux_ptr, AbsPair(H)); \
|
|
|
|
*aux_ptr = (CELL) (H + 1); \
|
|
|
|
aux = (CELL) H; \
|
|
|
|
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; \
|
|
|
|
} \
|
2009-06-24 20:04:16 +01:00
|
|
|
} else { \
|
2009-07-05 05:14:08 +01:00
|
|
|
CELL aux, subs, *subs_ptr; \
|
|
|
|
int i; \
|
|
|
|
*aux_ptr-- = (CELL) (H + 1); \
|
|
|
|
*aux_ptr = 1; \
|
|
|
|
YENV = aux_ptr; \
|
|
|
|
aux_ptr += 1 + 2; \
|
|
|
|
aux = (CELL) H; \
|
|
|
|
subs_ptr = aux_ptr + 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; \
|
|
|
|
} \
|
|
|
|
*aux_ptr = subs_arity - 1; \
|
|
|
|
aux_ptr += subs_arity; \
|
|
|
|
Bind((CELL *) *aux_ptr, AbsPair(H)); \
|
|
|
|
for (i = 0; i < vars_arity; i++) { \
|
|
|
|
*aux_ptr = *(aux_ptr + 1); \
|
|
|
|
aux_ptr++; \
|
|
|
|
} \
|
2009-06-24 20:04:16 +01:00
|
|
|
} \
|
|
|
|
H += 2; \
|
2009-07-05 05:14:08 +01:00
|
|
|
next_trie_instruction(node)
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-06-03 09:19:18 +01:00
|
|
|
/* ------------------- **
|
|
|
|
** trie_atom **
|
|
|
|
** ------------------- */
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
#define stack_trie_atom_instr() \
|
|
|
|
if (heap_arity) { \
|
|
|
|
YENV = ++aux_ptr; \
|
|
|
|
Bind_Global((CELL *) *aux_ptr, TrNode_entry(node)); \
|
|
|
|
*aux_ptr = heap_arity - 1; \
|
|
|
|
next_instruction(heap_arity - 1 || subs_arity, node); \
|
|
|
|
} else { \
|
|
|
|
int i; \
|
|
|
|
aux_ptr += 2; \
|
|
|
|
*aux_ptr = subs_arity - 1; \
|
|
|
|
aux_ptr += subs_arity; \
|
|
|
|
Bind((CELL *) *aux_ptr, TrNode_entry(node)); \
|
|
|
|
for (i = 0; i < vars_arity; i++) { \
|
|
|
|
*aux_ptr = *(aux_ptr + 1); \
|
|
|
|
aux_ptr++; \
|
|
|
|
} \
|
|
|
|
next_instruction(subs_arity - 1, node); \
|
2005-06-03 09:19:18 +01:00
|
|
|
}
|
2009-06-24 20:04:16 +01:00
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
|
|
|
#define stack_trie_atom_in_new_pair_instr() \
|
|
|
|
if (heap_arity) { \
|
|
|
|
aux_ptr++; \
|
|
|
|
Bind_Global((CELL *) *aux_ptr, AbsPair(H)); \
|
|
|
|
*aux_ptr = (CELL) (H + 1); \
|
|
|
|
} else { \
|
|
|
|
int i; \
|
|
|
|
*aux_ptr-- = (CELL) (H + 1); \
|
|
|
|
*aux_ptr = 1; \
|
|
|
|
YENV = aux_ptr; \
|
|
|
|
aux_ptr += 1 + 2; \
|
|
|
|
*aux_ptr = subs_arity - 1; \
|
|
|
|
aux_ptr += subs_arity; \
|
|
|
|
Bind((CELL *) *aux_ptr, AbsPair(H)); \
|
|
|
|
for (i = 0; i < vars_arity; i++) { \
|
|
|
|
*aux_ptr = *(aux_ptr + 1); \
|
|
|
|
aux_ptr++; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
Bind_Global(H, TrNode_entry(node)); \
|
|
|
|
H += 2; \
|
2009-06-24 20:04:16 +01:00
|
|
|
next_trie_instruction(node)
|
2009-07-05 05:14:08 +01:00
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-06-03 09:19:18 +01:00
|
|
|
/* ------------------- **
|
2009-07-05 05:14:08 +01:00
|
|
|
** trie_pair **
|
2005-06-03 09:19:18 +01:00
|
|
|
** ------------------- */
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
|
|
|
/* trie compiled code for term 'CompactPairEndList' */
|
|
|
|
#define stack_trie_pair_instr() \
|
|
|
|
if (heap_arity) { \
|
|
|
|
aux_ptr++; \
|
|
|
|
Bind_Global((CELL *) *aux_ptr, AbsPair(H)); \
|
|
|
|
*aux_ptr = (CELL) H; \
|
|
|
|
} else { \
|
|
|
|
int i; \
|
|
|
|
*aux_ptr-- = (CELL) H; \
|
|
|
|
*aux_ptr = 1; \
|
|
|
|
YENV = aux_ptr; \
|
|
|
|
aux_ptr += 1 + 2; \
|
|
|
|
*aux_ptr = subs_arity - 1; \
|
|
|
|
aux_ptr += subs_arity; \
|
|
|
|
Bind((CELL *) *aux_ptr, AbsPair(H)); \
|
|
|
|
for (i = 0; i < vars_arity; i++) { \
|
|
|
|
*aux_ptr = *(aux_ptr + 1); \
|
|
|
|
aux_ptr++; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
Bind_Global(H + 1, TermNil); \
|
|
|
|
H += 2; \
|
2009-06-24 20:04:16 +01:00
|
|
|
next_trie_instruction(node)
|
2009-07-05 05:14:08 +01:00
|
|
|
#else
|
|
|
|
#define stack_trie_pair_instr() \
|
|
|
|
if (heap_arity) { \
|
|
|
|
aux_ptr++; \
|
|
|
|
Bind_Global((CELL *) *aux_ptr, AbsPair(H)); \
|
|
|
|
*aux_ptr-- = (CELL) (H + 1); \
|
|
|
|
*aux_ptr-- = (CELL) H; \
|
|
|
|
*aux_ptr = heap_arity - 1 + 2; \
|
|
|
|
YENV = aux_ptr; \
|
|
|
|
} else { \
|
|
|
|
int i; \
|
|
|
|
*aux_ptr-- = (CELL) (H + 1); \
|
|
|
|
*aux_ptr-- = (CELL) H; \
|
|
|
|
*aux_ptr = 2; \
|
|
|
|
YENV = aux_ptr; \
|
|
|
|
aux_ptr += 2 + 2; \
|
|
|
|
*aux_ptr = subs_arity - 1; \
|
|
|
|
aux_ptr += subs_arity; \
|
|
|
|
Bind((CELL *) *aux_ptr, AbsPair(H)); \
|
|
|
|
for (i = 0; i < vars_arity; i++) { \
|
|
|
|
*aux_ptr = *(aux_ptr + 1); \
|
|
|
|
aux_ptr++; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
H += 2; \
|
2001-04-09 20:54:03 +01:00
|
|
|
next_trie_instruction(node)
|
2009-07-05 05:14:08 +01:00
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-06-03 09:19:18 +01:00
|
|
|
/* --------------------- **
|
|
|
|
** trie_struct **
|
|
|
|
** --------------------- */
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
#define stack_trie_struct_instr() \
|
|
|
|
if (heap_arity) { \
|
|
|
|
int i; \
|
|
|
|
aux_ptr++; \
|
|
|
|
Bind_Global((CELL *) *aux_ptr, AbsAppl(H)); \
|
|
|
|
for (i = 0; i < func_arity; i++) \
|
|
|
|
*aux_ptr-- = (CELL) (H + func_arity - i); \
|
|
|
|
*aux_ptr = heap_arity - 1 + func_arity; \
|
|
|
|
YENV = aux_ptr; \
|
|
|
|
} else { \
|
|
|
|
int i; \
|
|
|
|
for (i = 0; i < func_arity; i++) \
|
|
|
|
*aux_ptr-- = (CELL) (H + func_arity - i); \
|
|
|
|
*aux_ptr = func_arity; \
|
|
|
|
YENV = aux_ptr; \
|
|
|
|
aux_ptr += func_arity + 2; \
|
|
|
|
*aux_ptr = subs_arity - 1; \
|
|
|
|
aux_ptr += subs_arity; \
|
|
|
|
Bind((CELL *) *aux_ptr, AbsAppl(H)); \
|
|
|
|
for (i = 0; i < vars_arity; i++) { \
|
|
|
|
*aux_ptr = *(aux_ptr + 1); \
|
|
|
|
aux_ptr++; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
*H = (CELL) func; \
|
|
|
|
H += 1 + func_arity; \
|
2005-06-03 09:19:18 +01:00
|
|
|
next_trie_instruction(node)
|
2009-06-24 20:04:16 +01:00
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
|
|
|
#define stack_trie_struct_in_new_pair_instr() \
|
|
|
|
if (heap_arity) { \
|
|
|
|
int i; \
|
|
|
|
aux_ptr++; \
|
|
|
|
Bind_Global((CELL *) *aux_ptr, AbsPair(H)); \
|
|
|
|
*aux_ptr-- = (CELL) (H + 1); \
|
|
|
|
for (i = 0; i < func_arity; i++) \
|
|
|
|
*aux_ptr-- = (CELL) (H + 2 + func_arity - i); \
|
|
|
|
*aux_ptr = heap_arity - 1 + 1 + func_arity; \
|
|
|
|
YENV = aux_ptr; \
|
|
|
|
} else { \
|
|
|
|
int i; \
|
|
|
|
*aux_ptr-- = (CELL) (H + 1); \
|
|
|
|
for (i = 0; i < func_arity; i++) \
|
|
|
|
*aux_ptr-- = (CELL) (H + 2 + func_arity - i); \
|
|
|
|
*aux_ptr = 1 + func_arity; \
|
|
|
|
YENV = aux_ptr; \
|
|
|
|
aux_ptr += 1 + func_arity + 2; \
|
|
|
|
*aux_ptr = subs_arity - 1; \
|
|
|
|
aux_ptr += subs_arity; \
|
|
|
|
Bind((CELL *) *aux_ptr, AbsPair(H)); \
|
|
|
|
for (i = 0; i < vars_arity; i++) { \
|
|
|
|
*aux_ptr = *(aux_ptr + 1); \
|
|
|
|
aux_ptr++; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
Bind_Global(H, AbsAppl(H + 2)); \
|
|
|
|
H += 2; \
|
|
|
|
*H = (CELL) func; \
|
|
|
|
H += 1 + func_arity; \
|
2001-04-09 20:54:03 +01:00
|
|
|
next_trie_instruction(node)
|
2009-07-05 05:14:08 +01:00
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-07-06 20:34:12 +01:00
|
|
|
/* ------------------------ **
|
|
|
|
** trie_extension **
|
|
|
|
** ------------------------ */
|
|
|
|
|
2009-08-07 04:34:48 +01:00
|
|
|
#define stack_trie_extension_instr() \
|
|
|
|
*aux_ptr-- = 0; /* float/longint extension mark */ \
|
|
|
|
*aux_ptr-- = TrNode_entry(node); \
|
|
|
|
*aux_ptr = heap_arity + 2; \
|
|
|
|
YENV = aux_ptr; \
|
2005-07-06 20:34:12 +01:00
|
|
|
next_trie_instruction(node)
|
|
|
|
|
2005-06-03 09:19:18 +01:00
|
|
|
|
2005-07-06 20:34:12 +01:00
|
|
|
|
|
|
|
/* ---------------------------- **
|
|
|
|
** trie_float_longint **
|
|
|
|
** ---------------------------- */
|
|
|
|
|
2009-06-17 17:14:16 +01:00
|
|
|
#define stack_trie_float_longint_instr() \
|
2005-06-03 09:19:18 +01:00
|
|
|
if (heap_arity) { \
|
|
|
|
YENV = ++aux_ptr; \
|
|
|
|
Bind_Global((CELL *) *aux_ptr, t); \
|
|
|
|
*aux_ptr = heap_arity - 1; \
|
|
|
|
next_instruction(heap_arity - 1 || subs_arity, node); \
|
|
|
|
} else { \
|
2009-07-05 05:14:08 +01:00
|
|
|
int i; \
|
2009-06-24 20:04:16 +01:00
|
|
|
YENV = aux_ptr; \
|
2005-06-03 09:19:18 +01:00
|
|
|
*aux_ptr = 0; \
|
|
|
|
aux_ptr += 2; \
|
|
|
|
*aux_ptr = subs_arity - 1; \
|
|
|
|
aux_ptr += subs_arity; \
|
|
|
|
Bind((CELL *) *aux_ptr, t); \
|
|
|
|
for (i = 0; i < vars_arity; i++) { \
|
|
|
|
*aux_ptr = *(aux_ptr + 1); \
|
|
|
|
aux_ptr++; \
|
|
|
|
} \
|
|
|
|
next_instruction(subs_arity - 1, node); \
|
2009-06-24 20:04:16 +01:00
|
|
|
}
|
2005-06-03 09:19:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
/* --------------------------- **
|
|
|
|
** Trie instructions **
|
|
|
|
** --------------------------- */
|
|
|
|
|
2005-07-06 20:34:12 +01:00
|
|
|
PBOp(trie_do_null, e)
|
2005-06-03 09:19:18 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
|
|
|
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_null_instr();
|
2005-06-03 09:19:18 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2005-07-06 20:34:12 +01:00
|
|
|
PBOp(trie_trust_null, e)
|
2005-06-03 09:19:18 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2009-06-17 17:14:16 +01:00
|
|
|
register CELL *aux_ptr = (CELL *) (B + 1);
|
2005-06-03 09:19:18 +01:00
|
|
|
int heap_arity = *aux_ptr;
|
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
2009-06-24 20:04:16 +01:00
|
|
|
|
|
|
|
pop_trie_node();
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_null_instr();
|
2005-06-03 09:19:18 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
PBOp(trie_try_null, e)
|
2001-04-09 20:54:03 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2002-11-26 22:19:48 +00:00
|
|
|
register CELL *aux_ptr = YENV;
|
2001-04-09 20:54:03 +01:00
|
|
|
int heap_arity = *aux_ptr;
|
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
store_trie_node(TrNode_next(node));
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_null_instr();
|
2001-04-09 20:54:03 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
PBOp(trie_retry_null, e)
|
2001-04-09 20:54:03 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2009-06-17 17:14:16 +01:00
|
|
|
register CELL *aux_ptr = (CELL *) (B + 1);
|
2001-04-09 20:54:03 +01:00
|
|
|
int heap_arity = *aux_ptr;
|
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
restore_trie_node(TrNode_next(node));
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_null_instr();
|
2001-04-09 20:54:03 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_do_null_in_new_pair, e)
|
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
2009-06-24 20:04:16 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
|
|
|
register CELL *aux_ptr = YENV;
|
|
|
|
int heap_arity = *aux_ptr;
|
2009-07-05 05:14:08 +01:00
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
2009-06-24 20:04:16 +01:00
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_null_in_new_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
#else
|
2009-07-05 05:14:08 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_do_null_in_new_pair)");
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_trust_null_in_new_pair, e)
|
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
2009-06-24 20:04:16 +01:00
|
|
|
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();
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_null_in_new_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
#else
|
2009-07-05 05:14:08 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_trust_null_in_new_pair)");
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_try_null_in_new_pair, e)
|
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
2009-06-24 20:04:16 +01:00
|
|
|
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));
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_null_in_new_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
#else
|
2009-07-05 05:14:08 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_try_null_in_new_pair)");
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_retry_null_in_new_pair, e)
|
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
2009-06-24 20:04:16 +01:00
|
|
|
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));
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_null_in_new_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
#else
|
2009-07-05 05:14:08 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_retry_null_in_new_pair)");
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
PBOp(trie_do_var, e)
|
2001-04-09 20:54:03 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2008-09-05 18:34:26 +01:00
|
|
|
register CELL *aux_ptr = YENV;
|
2001-04-09 20:54:03 +01:00
|
|
|
int heap_arity = *aux_ptr;
|
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
|
|
|
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_var_instr();
|
2001-04-09 20:54:03 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
|
|
|
PBOp(trie_trust_var, e)
|
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2009-06-17 17:14:16 +01:00
|
|
|
register CELL *aux_ptr = (CELL *) (B + 1);
|
2001-04-09 20:54:03 +01:00
|
|
|
int heap_arity = *aux_ptr;
|
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
|
|
|
|
2009-06-24 20:04:16 +01:00
|
|
|
pop_trie_node();
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_var_instr();
|
2001-04-09 20:54:03 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
PBOp(trie_try_var, e)
|
2001-04-09 20:54:03 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2008-09-05 18:34:26 +01:00
|
|
|
register CELL *aux_ptr = YENV;
|
2001-04-09 20:54:03 +01:00
|
|
|
int heap_arity = *aux_ptr;
|
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
store_trie_node(TrNode_next(node));
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_var_instr();
|
2001-04-09 20:54:03 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
PBOp(trie_retry_var, e)
|
2001-04-09 20:54:03 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2009-06-17 17:14:16 +01:00
|
|
|
register CELL *aux_ptr = (CELL *) (B + 1);
|
2001-04-09 20:54:03 +01:00
|
|
|
int heap_arity = *aux_ptr;
|
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
restore_trie_node(TrNode_next(node));
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_var_instr();
|
2001-04-09 20:54:03 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_do_var_in_new_pair, e)
|
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
2009-06-24 20:04:16 +01:00
|
|
|
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);
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_var_in_new_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
#else
|
2009-07-05 05:14:08 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_do_var_in_new_pair)");
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_trust_var_in_new_pair, e)
|
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
2009-06-24 20:04:16 +01:00
|
|
|
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();
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_var_in_new_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
#else
|
2009-07-05 05:14:08 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_trust_var_in_new_pair)");
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_try_var_in_new_pair, e)
|
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
2009-06-24 20:04:16 +01:00
|
|
|
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));
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_var_in_new_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
#else
|
2009-07-05 05:14:08 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_try_var_in_new_pair)");
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_retry_var_in_new_pair, e)
|
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
2009-06-24 20:04:16 +01:00
|
|
|
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));
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_var_in_new_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
#else
|
2009-07-05 05:14:08 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_retry_var_in_new_pair)");
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
PBOp(trie_do_val, e)
|
2001-04-09 20:54:03 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2009-07-05 05:14:08 +01:00
|
|
|
register CELL *aux_ptr = YENV;
|
2001-04-09 20:54:03 +01:00
|
|
|
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));
|
|
|
|
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_val_instr();
|
2001-04-09 20:54:03 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
|
|
|
PBOp(trie_trust_val, e)
|
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2009-07-05 05:14:08 +01:00
|
|
|
register CELL *aux_ptr = (CELL *) (B + 1);
|
2001-04-09 20:54:03 +01:00
|
|
|
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));
|
|
|
|
|
2009-06-24 20:04:16 +01:00
|
|
|
pop_trie_node();
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_val_instr();
|
2001-04-09 20:54:03 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
PBOp(trie_try_val, e)
|
2001-04-09 20:54:03 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2009-07-05 05:14:08 +01:00
|
|
|
register CELL *aux_ptr = YENV;
|
2001-04-09 20:54:03 +01:00
|
|
|
int heap_arity = *aux_ptr;
|
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
2008-09-05 18:34:26 +01:00
|
|
|
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
store_trie_node(TrNode_next(node));
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_val_instr();
|
2001-04-09 20:54:03 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
PBOp(trie_retry_val, e)
|
2001-04-09 20:54:03 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2009-07-05 05:14:08 +01:00
|
|
|
register CELL *aux_ptr = (CELL *) (B + 1);
|
2001-04-09 20:54:03 +01:00
|
|
|
int heap_arity = *aux_ptr;
|
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
2008-09-05 18:34:26 +01:00
|
|
|
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
restore_trie_node(TrNode_next(node));
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_val_instr();
|
2001-04-09 20:54:03 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_do_val_in_new_pair, e)
|
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
2009-06-24 20:04:16 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2009-07-05 05:14:08 +01:00
|
|
|
register CELL *aux_ptr = YENV;
|
2009-06-24 20:04:16 +01:00
|
|
|
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));
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_val_in_new_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
#else
|
2009-07-05 05:14:08 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_do_val_in_new_pair)");
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_trust_val_in_new_pair, e)
|
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
2009-06-24 20:04:16 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2009-07-05 05:14:08 +01:00
|
|
|
register CELL *aux_ptr = (CELL *) (B + 1);
|
2009-06-24 20:04:16 +01:00
|
|
|
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();
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_val_in_new_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
#else
|
2009-07-05 05:14:08 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_trust_val_in_new_pair)");
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_try_val_in_new_pair, e)
|
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
2009-06-24 20:04:16 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2009-07-05 05:14:08 +01:00
|
|
|
register CELL *aux_ptr = YENV;
|
2009-06-24 20:04:16 +01:00
|
|
|
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));
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_val_in_new_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
#else
|
2009-07-05 05:14:08 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_try_val_in_new_pair)");
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_retry_val_in_new_pair, e)
|
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
2009-06-24 20:04:16 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2009-07-05 05:14:08 +01:00
|
|
|
register CELL *aux_ptr = (CELL *) (B + 1);
|
2009-06-24 20:04:16 +01:00
|
|
|
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));
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_val_in_new_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
#else
|
2009-07-05 05:14:08 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_retry_val_in_new_pair)");
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
PBOp(trie_do_atom, e)
|
2001-04-09 20:54:03 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2008-09-05 18:34:26 +01:00
|
|
|
register CELL *aux_ptr = YENV;
|
2001-04-09 20:54:03 +01:00
|
|
|
int heap_arity = *aux_ptr;
|
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
|
|
|
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_atom_instr();
|
2001-04-09 20:54:03 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
|
|
|
PBOp(trie_trust_atom, e)
|
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2009-06-17 17:14:16 +01:00
|
|
|
register CELL *aux_ptr = (CELL *) (B + 1);
|
2001-04-09 20:54:03 +01:00
|
|
|
int heap_arity = *aux_ptr;
|
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
2009-06-24 20:04:16 +01:00
|
|
|
|
|
|
|
pop_trie_node();
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_atom_instr();
|
2001-04-09 20:54:03 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
PBOp(trie_try_atom, e)
|
2001-04-09 20:54:03 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2002-11-26 22:19:48 +00:00
|
|
|
register CELL *aux_ptr = YENV;
|
2001-04-09 20:54:03 +01:00
|
|
|
int heap_arity = *aux_ptr;
|
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
store_trie_node(TrNode_next(node));
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_atom_instr();
|
2001-04-09 20:54:03 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
PBOp(trie_retry_atom, e)
|
2001-04-09 20:54:03 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2009-06-17 17:14:16 +01:00
|
|
|
register CELL *aux_ptr = (CELL *) (B + 1);
|
2001-04-09 20:54:03 +01:00
|
|
|
int heap_arity = *aux_ptr;
|
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
restore_trie_node(TrNode_next(node));
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_atom_instr();
|
2001-04-09 20:54:03 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_do_atom_in_new_pair, e)
|
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
2009-06-24 20:04:16 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
|
|
|
register CELL *aux_ptr = YENV;
|
2009-07-05 05:14:08 +01:00
|
|
|
int heap_arity = *aux_ptr;
|
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
2009-06-24 20:04:16 +01:00
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_atom_in_new_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
#else
|
2009-07-05 05:14:08 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_do_atom_in_new_pair)");
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_trust_atom_in_new_pair, e)
|
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
2009-06-24 20:04:16 +01:00
|
|
|
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();
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_atom_in_new_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
#else
|
2009-07-05 05:14:08 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_trust_atom_in_new_pair)");
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_try_atom_in_new_pair, e)
|
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
2009-06-24 20:04:16 +01:00
|
|
|
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));
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_atom_in_new_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
#else
|
2009-07-05 05:14:08 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_try_atom_in_new_pair)");
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_retry_atom_in_new_pair, e)
|
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
2009-06-24 20:04:16 +01:00
|
|
|
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));
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_atom_in_new_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
#else
|
2009-07-05 05:14:08 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_retry_atom_in_new_pair)");
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2001-04-09 20:54:03 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_do_pair, e)
|
2001-04-09 20:54:03 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2002-11-26 22:19:48 +00:00
|
|
|
register CELL *aux_ptr = YENV;
|
2001-04-09 20:54:03 +01:00
|
|
|
int heap_arity = *aux_ptr;
|
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_pair_instr();
|
2001-04-09 20:54:03 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_trust_pair, e)
|
2009-06-24 20:04:16 +01:00
|
|
|
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();
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_try_pair, e)
|
2009-06-24 20:04:16 +01:00
|
|
|
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));
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_retry_pair, e)
|
2009-06-24 20:04:16 +01:00
|
|
|
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));
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
PBOp(trie_do_struct, e)
|
2001-04-09 20:54:03 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2008-09-05 18:34:26 +01:00
|
|
|
register CELL *aux_ptr = YENV;
|
2001-04-09 20:54:03 +01:00
|
|
|
int heap_arity = *aux_ptr;
|
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
2005-05-31 09:19:31 +01:00
|
|
|
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
2001-04-09 20:54:03 +01:00
|
|
|
int func_arity = ArityOfFunctor(func);
|
|
|
|
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_struct_instr();
|
2001-04-09 20:54:03 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
|
|
|
PBOp(trie_trust_struct, e)
|
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2009-06-17 17:14:16 +01:00
|
|
|
register CELL *aux_ptr = (CELL *) (B + 1);
|
2001-04-09 20:54:03 +01:00
|
|
|
int heap_arity = *aux_ptr;
|
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
2005-05-31 09:19:31 +01:00
|
|
|
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
2001-04-09 20:54:03 +01:00
|
|
|
int func_arity = ArityOfFunctor(func);
|
|
|
|
|
2009-06-24 20:04:16 +01:00
|
|
|
pop_trie_node();
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_struct_instr();
|
2001-04-09 20:54:03 +01:00
|
|
|
ENDPBOp();
|
2005-06-03 09:19:18 +01:00
|
|
|
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
PBOp(trie_try_struct, e)
|
2005-07-06 20:34:12 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
|
|
|
register CELL *aux_ptr = YENV;
|
|
|
|
int heap_arity = *aux_ptr;
|
2008-09-05 18:34:26 +01:00
|
|
|
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);
|
2005-07-06 20:34:12 +01:00
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
store_trie_node(TrNode_next(node));
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_struct_instr();
|
2005-07-06 20:34:12 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
PBOp(trie_retry_struct, e)
|
2005-07-06 20:34:12 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2009-06-17 17:14:16 +01:00
|
|
|
register CELL *aux_ptr = (CELL *) (B + 1);
|
2005-07-06 20:34:12 +01:00
|
|
|
int heap_arity = *aux_ptr;
|
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
2008-09-05 18:34:26 +01:00
|
|
|
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
|
|
|
int func_arity = ArityOfFunctor(func);
|
2005-07-06 20:34:12 +01:00
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
restore_trie_node(TrNode_next(node));
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_struct_instr();
|
2005-07-06 20:34:12 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_do_struct_in_new_pair, e)
|
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
2009-06-24 20:04:16 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
|
|
|
register CELL *aux_ptr = YENV;
|
|
|
|
int heap_arity = *aux_ptr;
|
2009-07-05 05:14:08 +01:00
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
2009-06-24 20:04:16 +01:00
|
|
|
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
|
|
|
int func_arity = ArityOfFunctor(func);
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_struct_in_new_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
#else
|
2009-07-05 05:14:08 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_do_struct_in_new_pair)");
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_trust_struct_in_new_pair, e)
|
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
2009-06-24 20:04:16 +01:00
|
|
|
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);
|
|
|
|
|
|
|
|
pop_trie_node();
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_struct_in_new_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
#else
|
2009-07-05 05:14:08 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_trust_struct_in_new_pair)");
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_try_struct_in_new_pair, e)
|
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
2009-06-24 20:04:16 +01:00
|
|
|
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);
|
|
|
|
|
|
|
|
store_trie_node(TrNode_next(node));
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_struct_in_new_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
#else
|
2009-07-05 05:14:08 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_try_struct_in_new_pair)");
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2009-07-05 05:14:08 +01:00
|
|
|
PBOp(trie_retry_struct_in_new_pair, e)
|
|
|
|
#ifdef TRIE_COMPACT_PAIRS
|
2009-06-24 20:04:16 +01:00
|
|
|
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);
|
|
|
|
|
|
|
|
restore_trie_node(TrNode_next(node));
|
2009-07-05 05:14:08 +01:00
|
|
|
stack_trie_struct_in_new_pair_instr();
|
2009-06-24 20:04:16 +01:00
|
|
|
#else
|
2009-07-05 05:14:08 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_retry_struct_in_new_pair)");
|
|
|
|
#endif /* TRIE_COMPACT_PAIRS */
|
2009-06-24 20:04:16 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
PBOp(trie_do_extension, e)
|
2005-07-06 20:34:12 +01:00
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2008-09-05 18:34:26 +01:00
|
|
|
register CELL *aux_ptr = YENV;
|
2005-07-06 20:34:12 +01:00
|
|
|
int heap_arity = *aux_ptr;
|
|
|
|
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_extension_instr();
|
2005-07-06 20:34:12 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
|
|
|
PBOp(trie_trust_extension, e)
|
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2009-06-17 17:14:16 +01:00
|
|
|
register CELL *aux_ptr = (CELL *) (B + 1);
|
2005-07-06 20:34:12 +01:00
|
|
|
int heap_arity = *aux_ptr;
|
|
|
|
int vars_arity = *(aux_ptr + heap_arity + 1);
|
|
|
|
int subs_arity = *(aux_ptr + heap_arity + 2);
|
2009-06-24 20:04:16 +01:00
|
|
|
|
|
|
|
pop_trie_node();
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_extension_instr();
|
2005-07-06 20:34:12 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
PBOp(trie_try_extension, e)
|
|
|
|
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));
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_extension_instr();
|
2008-09-05 18:34:26 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
|
|
|
PBOp(trie_retry_extension, e)
|
|
|
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
2009-06-17 17:14:16 +01:00
|
|
|
register CELL *aux_ptr = (CELL *) (B + 1);
|
2008-09-05 18:34:26 +01:00
|
|
|
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));
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_extension_instr();
|
2008-09-05 18:34:26 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2005-06-03 09:19:18 +01:00
|
|
|
PBOp(trie_do_float, e)
|
|
|
|
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);
|
|
|
|
volatile Float dbl;
|
|
|
|
volatile Term *t_dbl = (Term *)((void *) &dbl);
|
2009-07-05 05:14:08 +01:00
|
|
|
Term t;
|
2009-06-17 17:14:16 +01:00
|
|
|
|
2007-04-26 15:13:21 +01:00
|
|
|
#if SIZEOF_DOUBLE == 2 * SIZEOF_INT_P
|
2009-08-07 04:34:48 +01:00
|
|
|
heap_arity -= 4;
|
2005-06-03 09:19:18 +01:00
|
|
|
*t_dbl = *++aux_ptr;
|
2009-08-07 04:34:48 +01:00
|
|
|
++aux_ptr; /* jump the float/longint extension mark */
|
2005-06-03 09:19:18 +01:00
|
|
|
*(t_dbl + 1) = *++aux_ptr;
|
2007-04-26 15:13:21 +01:00
|
|
|
#else /* SIZEOF_DOUBLE == SIZEOF_INT_P */
|
2009-08-07 04:34:48 +01:00
|
|
|
heap_arity -= 2;
|
2007-04-26 15:13:21 +01:00
|
|
|
*t_dbl = *++aux_ptr;
|
|
|
|
#endif /* SIZEOF_DOUBLE x SIZEOF_INT_P */
|
2009-08-07 04:34:48 +01:00
|
|
|
++aux_ptr; /* jump the float/longint extension mark */
|
2005-06-03 09:19:18 +01:00
|
|
|
t = MkFloatTerm(dbl);
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_float_longint_instr();
|
2005-06-03 09:19:18 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
BOp(trie_trust_float, e)
|
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_trust_float)");
|
|
|
|
ENDBOp();
|
|
|
|
|
|
|
|
|
2006-01-17 14:10:42 +00:00
|
|
|
BOp(trie_try_float, e)
|
2009-06-17 17:14:16 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_try_float)");
|
2006-01-17 14:10:42 +00:00
|
|
|
ENDBOp();
|
2005-06-03 09:19:18 +01:00
|
|
|
|
|
|
|
|
2006-01-17 14:10:42 +00:00
|
|
|
BOp(trie_retry_float, e)
|
2005-06-03 09:19:18 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_retry_float)");
|
2006-01-17 14:10:42 +00:00
|
|
|
ENDBOp();
|
2005-06-03 09:19:18 +01:00
|
|
|
|
|
|
|
|
2005-06-04 08:28:24 +01:00
|
|
|
PBOp(trie_do_long, e)
|
|
|
|
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);
|
2009-08-07 04:34:48 +01:00
|
|
|
Term t;
|
2009-06-17 17:14:16 +01:00
|
|
|
|
2009-08-07 04:34:48 +01:00
|
|
|
heap_arity -= 2;
|
|
|
|
t = MkLongIntTerm(*++aux_ptr);
|
|
|
|
++aux_ptr; /* jump the float/longint extension mark */
|
2009-06-17 17:14:16 +01:00
|
|
|
stack_trie_float_longint_instr();
|
2005-06-04 08:28:24 +01:00
|
|
|
ENDPBOp();
|
|
|
|
|
2009-06-17 17:14:16 +01:00
|
|
|
|
2008-09-05 18:34:26 +01:00
|
|
|
BOp(trie_trust_long, e)
|
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_trust_long)");
|
|
|
|
ENDBOp();
|
2005-06-04 08:28:24 +01:00
|
|
|
|
2009-06-17 17:14:16 +01:00
|
|
|
|
2006-01-17 14:10:42 +00:00
|
|
|
BOp(trie_try_long, e)
|
2005-06-04 08:28:24 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_try_long)");
|
2006-01-17 14:10:42 +00:00
|
|
|
ENDBOp();
|
2005-06-04 08:28:24 +01:00
|
|
|
|
|
|
|
|
2006-01-17 14:10:42 +00:00
|
|
|
BOp(trie_retry_long, e)
|
2005-06-04 08:28:24 +01:00
|
|
|
Yap_Error(INTERNAL_ERROR, TermNil, "invalid instruction (trie_retry_long)");
|
2006-01-17 14:10:42 +00:00
|
|
|
ENDBOp();
|