Five compilation models for C++ templates (Extended Abstract)
Abstract:
This paper proposes an alternate structure for C++ compilers. Type analysis is removed from the compiler and replaced with a type system library which is treated as source code by the compiler. Type computations are embedded in the intermediate language of the compiler, and partial evaluation is used to drive type analysis and template instantiation. By making simple changes to the behavior of the partial evaluator, a wide range of compilation models is achieved, each with a distinct tradeoff of compile time, code size, and code speed. These models range from pure dynamic typing-- ideal for scripting C++-- to profile-directed template instantiation. This approach may solve several serious problems in compiling C++: it achieves separate compilation of templates, allows template code to be distributed in binary form by deferring template instantiation until run time, and reduces the code bloat associated with templates.
Citations
| 249 | Compiling polymorphism using intensional type analysis – Harper, Morrisett - 1995 |
| 146 | Cayenne - a Language with Dependent Types – Augustsson - 1998 |
| 134 | Soft typing – Cartwright, Fagan - 1991 |
| 134 | Partial evaluation of computation process - An approach to a compiler-compiler – Futamura - 1971 |
| 97 | An Introduction to Partial Evaluation – Jones - 1996 |
| 68 | Binding Time Analysis for Higher Order Untyped Functional Languages – Consel - 1990 |
| 41 | Compilers and staging transformations – Jørring, Scherlis - 1986 |
| 11 | Enabling sparse constant propagation of array elements via array ssa form – Sarkar, Knobe - 1998 |
| 6 | Using partial evaluation in support of portability, reusability, and maintainability – Salomon - 1996 |

