language: en

Optimizing ML with Run-Time Code Generation

Mark Leone Peter Lee
December 1995 CMU-CS-95-205
School of Computer Science Carnegie Mellon University
Pittsburgh, PA 15213

Abstract We describe the design and implementation of a compiler that automatically translates ordinary programs written in a subset of ML into code that generates native code at run time. Run-time code generation can make use of values and invariants that cannot be exploited at compile time, yielding code that is superior to statically optimal code. But the cost of optimizing and generating code at run time can be prohibitive. We demonstrate how compile-time specialization can reduce the cost of run-time code generation by an order of magnitude without greatly affecting code quality. Several benchmark programs are examined, which exhibit an average cost of six cycles per instruction generated at run time.

[The authors' electronic mail addresses are]

Mark.Leone@cs.cmu.edu and Peter.Lee@cs.cmu.edu.

[This research was sponsored in part by the Advanced Research Projects Agency CSTO under the title "The Fox Project: Advanced Langauges for Systems Software," ARPA Order No. C533, issued by ESC/ENS under Contract No. F19628-95-C-0050. The views and conclusions contained in this document are those of the authors and should not be interpreted as representing the official policies, either expressed or implied, of the Advanced Research Projects Agency or the U.S. Government.]