control for very large bdds.

This commit is contained in:
Vítor Santos Costa 2012-03-30 09:50:18 +01:00
parent edfb13c5e9
commit 3563dcbf03

View File

@ -530,14 +530,23 @@ p_cudd_to_term(void)
if (!dgen || !hash) if (!dgen || !hash)
return FALSE; return FALSE;
t = YAP_TermNil();
ar = (YAP_Term *)malloc(vars*sizeof(YAP_Term)); ar = (YAP_Term *)malloc(vars*sizeof(YAP_Term));
if (!ar) if (!ar)
return FALSE; return FALSE;
restart:
t = YAP_TermNil();
for (i= 0; i< vars; i++) { for (i= 0; i< vars; i++) {
ar[i] = YAP_ArgOfTerm(i+1, t3); ar[i] = YAP_ArgOfTerm(i+1, t3);
} }
while (node) { while (node) {
/* ensure we have enough memory */
if (YAP_RequiresExtraStack(0)) {
Cudd_GenFree(dgen);
t3 = YAP_ARG3;
dgen = Cudd_FirstNode(manager, n0, &node);
bzero(hash, sizeof(hash_table_entry)*sz);
goto restart;
}
t = build_prolog_cudd(manager, node, ar, hash, t, sz); t = build_prolog_cudd(manager, node, ar, hash, t, sz);
if (!Cudd_NextNode(dgen, &node)) if (!Cudd_NextNode(dgen, &node))
break; break;