You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During non-shallow PE, whether a default rule will be added to generated support module(s) is optimized based upon if its return value is compared/unified with a constant value. Because of how the compiler rewrites function calls, default functions don't have the same benefit, as the output argument will always be a non-constant variable without a bound value.
E.g.
package test
default f(x) :=truef(x) := y if {
y := x.size <100
}
p if {
f(input.x) ==false
}
is rewritten to
package test
default f(__local0__) :=truef(__local1__) := __local2__ if {
__local5__ = __local1__.size
__local3__ = __local5__ <100
__local2__ = __local3__
}
p if {
__local6__ = input.x
data.test.f(__local6__, __local4__)
__local4__ =false
}
Possibly, we could update the compiler to reorder generated statements, so that unification happens before the call, so that PE can retrieve any bound constants.
p if {
__local6__ = input.x
__local4__ =false
data.test.f(__local6__, __local4__)
}
This approach must however be investigated to explore whether it breaks any assumptions in other places of compile and eval.
Another alternative could be to detect when the generated output unification expr is superfluous, and can be replaced with a constant value:
p if {
__local6__ = input.x
data.test.f(__local6__, false)
}
The text was updated successfully, but these errors were encountered:
During non-shallow PE, whether a default rule will be added to generated support module(s) is optimized based upon if its return value is compared/unified with a constant value. Because of how the compiler rewrites function calls, default functions don't have the same benefit, as the output argument will always be a non-constant variable without a bound value.
E.g.
is rewritten to
Possibly, we could update the compiler to reorder generated statements, so that unification happens before the call, so that PE can retrieve any bound constants.
This approach must however be investigated to explore whether it breaks any assumptions in other places of compile and eval.
Another alternative could be to detect when the generated output unification expr is superfluous, and can be replaced with a constant value:
The text was updated successfully, but these errors were encountered: