Avoid Run Time Checks On Variables
Stratego -- Strategies for Program Transformation
The binding of a term variable does not coincide with its binding. That is, in the strategy expresssion
{x : ... ; ?Foo(x) ; ... ; !Bar(x) }
the variable
x
is first introduced in a new scope, some time later it is bound in a match, and at
the end its binding is used in a build.
This entails that a variable is not necessarily bound when it is used in a build.
Furthermore, a variable may be matched twice.
The second match only succeeds if it is against the same term that it was bound to the first time.
For these reasons the
Stratego Compiler generates run-time checks on variable matches and builds.
Often these checks are superfluous since the variable is sure to be bound or unbound at a certain position
in the program.
An optimization that avoids these checks allows the compiler to generate simpler code, which may also
be better amenable to optimization by the C compiler.
--
EelcoVisser - 11 Jul 2003