* Prevent repeated wrapping of closed terms
(closed(closed(closed(...)))) since this reduces performance by producing bigger terms and killing caching (which incidentally also prevents useful infinite recursion detection).
This commit is contained in:
parent
2135e7c041
commit
0f827cc607
|
@ -233,7 +233,12 @@ Expr substitute(const ATermMap & subs, Expr e)
|
||||||
|
|
||||||
if (matchVar(e, name)) {
|
if (matchVar(e, name)) {
|
||||||
Expr sub = subs.get(name);
|
Expr sub = subs.get(name);
|
||||||
return sub ? makeClosed(sub) : e;
|
Expr wrapped;
|
||||||
|
/* Add a "closed" wrapper around terms that aren't already
|
||||||
|
closed. The check is necessary to prevent repeated
|
||||||
|
wrapping, e.g., closed(closed(closed(...))), which kills
|
||||||
|
caching. */
|
||||||
|
return sub ? (matchClosed(sub, wrapped) ? sub : makeClosed(sub)) : e;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In case of a function, filter out all variables bound by this
|
/* In case of a function, filter out all variables bound by this
|
||||||
|
|
Loading…
Reference in a new issue