\section{Concluding Remarks}

The concept of using the same intermediate program representation for
both static {\em and} dynamic optimization has proven to be feasable. We
have a running protoptye that performs all the optimizations presented
in this paper. Our compiler has successfully optimized itself, i.e. the
complete TL compiler and library management code spread out in 98
modules containing more than 29,000 lines of TL source code.  Initial
performance measurements indicate that the speed of such non-trivial
modular programs as the TL compiler could (at least) be doubled by
dynamic, inter-module code optimization.

On the other hand, the space requirements of TL modules have nearly
doubled. The main reason for this space overhead is the additional
persistent encoding of the TML tree (in a data structure called PTML,
Persistent TML) for each TL source code function. We are currently
investigating techniques to re-construct a TML prepresentation by
examining the persistent executable code representation of a procedure,
effectively inverting the target machine code generation process
outlined in section
\ref{Section:Target Machine Code Generation}. In general, the TML tree
re-constructed this way will not be isomorphic to the original TML tree
that we currently encode in PTML. The interesting question is whether
this has an impact on the possible optimizations, especially in the
presence of nested recursive function bindings.

We will investigate further more global optimizations like code motion
(hoisting), data flow analysis and strength reduction in order to
estimate the potential and the limitations of general-purpose program
optimization in open database programming environments. This approach
may be regarded as an alternative to the well-understood yet limited
algebraic optimization rules of the relational algebra.  We conclude by
emphasizing that in our framework a main target for optimization is
represented by libraries of higher-order functions that encapsulate
iteration abstractions (SQL-like {\em select-from-where}, i.e. {\em
loops}) and by operations over bulk data structures (sets, lists, bags,
\dots).


% related work?



