| 1 |
\section{System Integration} |
| 2 |
In a heavily parameterized system like this, one very quickly ends up |
| 3 |
with a large number of modules and dependencies making it very |
| 4 |
easy to mix things up in the wrong way. |
| 5 |
\image{module dependencies}{pictures/png/sharing1.png}{align=center} |
| 6 |
\br{clear=left} |
| 7 |
For example, MLRisc is parameterised over pseudo-ops, |
| 8 |
constants, and regions. An instruction set must be parameterized |
| 9 |
over constants so that instructions that carry immediate operands |
| 10 |
can also carry these abstract constants. Instructions must also be |
| 11 |
parameterized over regions so that memory operations can be |
| 12 |
appropriately annotated. Finally, the flowgraph module must be |
| 13 |
parameterized over instructions it carries in basic blocks and |
| 14 |
pseudo-ops that describe data layout and alignment constraints. |
| 15 |
|
| 16 |
\image{sharing constraints}{pictures/png/sharing2.png}{align=right} |
| 17 |
\br{clear=left} |
| 18 |
In integrating a system that involves these modules, it must be the |
| 19 |
case that they were created with the same base modules. That is to |
| 20 |
say the pseudo-ops in flowgraphs must be the same abstraction that |
| 21 |
was used to define the MLRisc intermediate |
| 22 |
representation. Alternatively, we want |
| 23 |
\begin{color}{#ff0000}sharing constraints\end{color} |
| 24 |
that assert that identity of modules used to |
| 25 |
specialize other modules. In Standard ML, this is a complete |
| 26 |
non-issue. A single line that says exactly that is all that is |
| 27 |
needed to maintain consistency, and the module system does the rest |
| 28 |
to ensure that the final system is built correctly. |
| 29 |
|
| 30 |
\image{Back end optimizations}{pictures/png/sharing3.png}{align=left} |
| 31 |
\br{clear=right} |
| 32 |
In certain cases one wants to write a specific module for a |
| 33 |
particular architecture. For instance it may be desirable to collapse |
| 34 |
trap barriers on the DEC Alpha where it is legal to do so. The |
| 35 |
INSTRUCTIONS interface is abstract with no built-in knowledge of |
| 36 |
trap barriers as not all architectures have them. |
| 37 |
Further the DEC Alpha has fairly unique trap barrier semantics, |
| 38 |
that one may want to write an optimization module specific and |
| 39 |
dedicated to the Alpha instruction set and architecture, and forget |
| 40 |
about writing anything generic. In this case, the Standard ML module |
| 41 |
system allows one to say that a specific abstraction actually is or |
| 42 |
matches a more detailed interface. That is to say the INSTRUCTION |
| 43 |
interface is really the DEC Alpha instruction set. |