Removed another nested function that didn't yield a trampoline warning.
This commit is contained in:
parent
65655a96c7
commit
d25445538e
@ -1008,33 +1008,9 @@ struct betg_state
|
|||||||
int newdecr;
|
int newdecr;
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
void
|
||||||
unifiesWithKeys (Termlist substlist, Termlist keylist,
|
wrapSubst (const Termlist sl, const struct betg_state *ptr_betgState,
|
||||||
struct betg_state *ptr_betgState)
|
const Termlist keylist)
|
||||||
{
|
|
||||||
int old_length;
|
|
||||||
int newgoals;
|
|
||||||
|
|
||||||
assert (ptr_betgState != NULL);
|
|
||||||
|
|
||||||
// TODO this is a hack: in this case we really should not use subterm
|
|
||||||
// unification but interm instead. However, this effectively does the same
|
|
||||||
// by avoiding branches that get immediately pruned anyway.
|
|
||||||
if (!ptr_betgState->newdecr && keylist != NULL)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We need some adapting because the height would increase; we therefore
|
|
||||||
// have to add recv goals before we know whether it unifies.
|
|
||||||
old_length = sys->runs[ptr_betgState->run].height;
|
|
||||||
newgoals =
|
|
||||||
add_recv_goals (ptr_betgState->run, old_length, ptr_betgState->index + 1);
|
|
||||||
|
|
||||||
{
|
|
||||||
// wrap substitution lists
|
|
||||||
|
|
||||||
void wrapSubst (Termlist sl)
|
|
||||||
{
|
{
|
||||||
if (sl == NULL)
|
if (sl == NULL)
|
||||||
{
|
{
|
||||||
@ -1067,11 +1043,11 @@ unifiesWithKeys (Termlist substlist, Termlist keylist,
|
|||||||
State.sl = sl;
|
State.sl = sl;
|
||||||
State.tvar = sl->term;
|
State.tvar = sl->term;
|
||||||
State.allgood = true;
|
State.allgood = true;
|
||||||
iterateTermOther (ptr_betgState->run, State.tvar, makeDepend,
|
iterateTermOther (ptr_betgState->run, State.tvar, makeDepend, &State);
|
||||||
&State);
|
|
||||||
if (State.allgood)
|
if (State.allgood)
|
||||||
{
|
{
|
||||||
wrapSubst (sl->next);
|
// Recursive call
|
||||||
|
wrapSubst (sl->next, ptr_betgState, keylist);
|
||||||
}
|
}
|
||||||
while (State.neworders > 0)
|
while (State.neworders > 0)
|
||||||
{
|
{
|
||||||
@ -1081,9 +1057,32 @@ unifiesWithKeys (Termlist substlist, Termlist keylist,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wrapSubst (substlist);
|
int
|
||||||
|
unifiesWithKeys (Termlist substlist, Termlist keylist,
|
||||||
|
struct betg_state *ptr_betgState)
|
||||||
|
{
|
||||||
|
int old_length;
|
||||||
|
int newgoals;
|
||||||
|
|
||||||
|
assert (ptr_betgState != NULL);
|
||||||
|
|
||||||
|
// TODO this is a hack: in this case we really should not use subterm
|
||||||
|
// unification but interm instead. However, this effectively does the same
|
||||||
|
// by avoiding branches that get immediately pruned anyway.
|
||||||
|
if (!ptr_betgState->newdecr && keylist != NULL)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need some adapting because the height would increase; we therefore
|
||||||
|
// have to add recv goals before we know whether it unifies.
|
||||||
|
old_length = sys->runs[ptr_betgState->run].height;
|
||||||
|
newgoals =
|
||||||
|
add_recv_goals (ptr_betgState->run, old_length, ptr_betgState->index + 1);
|
||||||
|
|
||||||
|
// wrap substitution lists
|
||||||
|
wrapSubst (substlist, ptr_betgState, keylist);
|
||||||
|
|
||||||
// undo
|
// undo
|
||||||
goal_remove_last (newgoals);
|
goal_remove_last (newgoals);
|
||||||
sys->runs[ptr_betgState->run].height = old_length;
|
sys->runs[ptr_betgState->run].height = old_length;
|
||||||
|
Loading…
Reference in New Issue
Block a user